feat(inventory): --write re-points the contract instead of a hand-run jq - #9
Merged
Conversation
… 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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.