Skip to content

feat(inventory): --write re-points the contract instead of a hand-run jq - #9

Merged
itsvedantkumar merged 3 commits into
mainfrom
feat/inventory-write
Sep 2, 2026
Merged

feat(inventory): --write re-points the contract instead of a hand-run jq#9
itsvedantkumar merged 3 commits into
mainfrom
feat/inventory-write

Conversation

@itsvedantkumar

Copy link
Copy Markdown
Owner

Every payload commit needed a hand-run jq to re-point derived_at.head and payload_digest, then a "Re-point inventory at " commit. tests/inventory-contract.sh --write now does the rewrite, refuses on a dirty tree, re-validates, and prints the commit line. Idempotent: no-op when the contract already holds.

Verified: simulated payload edit -> FAIL, --write -> 2-line diff, re-run clean. Dirty tree -> exit 2. ./.claude/verify.sh VERIFIED.

… stale dance

Every stale-inventory failure resolves the same hand-rolled way: recompute
payload_digest, set derived_at.head to HEAD, commit. Agents kept getting one
field wrong. --write (alias --repoint) reuses payload_digest_compute(),
refuses on a dirty payload tree, writes both fields with jq, re-validates,
and prints the commit command. FAIL messages for both stale fields now end
with the fix.
Unconditionally bumping derived_at.head to current HEAD made --write rewrite
the file after any non-payload commit, even when the contract already
validated. needs_repoint() mirrors the contract's own staleness definition
so --write only touches the file when payload_digest or derived_at.head
actually needs fixing, matching the idempotence the flag promises.
Check 30 (shellcheck suppressions carry a reason) failed on both new
SC2086 disables in needs_repoint() and the --write dirty check -- bare,
no same-line or preceding-comment reason. Matches the inline-reason
convention used elsewhere in the repo (bootstrap.sh:228, install.sh:751).
@itsvedantkumar
itsvedantkumar merged commit 711b1b4 into main Sep 2, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant