Repository navigation
fix(ship-receipt): name the non-ancestor targeted-read commit in RECEIPT_INVALID (GST-1700) - #4106
Merged
Merged
Conversation
…IPT_INVALID (GST-1700) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
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.
When the commit the targeted reader read is not an ancestor of HEAD,
gstack-ship-receipt write --review-targetedrefused the record with "the product changed after the read", even while printing two equal product patch ids (qm#2952:whose product patch 58b965dd1ece is not this receipt's 58b965dd1ece). The lane went looking for a product change that wasn't there.What changed.
parseReviewTargetedtakes an optionalancestorcallback that only picks the wording; write passesgit merge-base --is-ancestor <read> <head>. When the existing refusal fires and the read commit is not HEAD's ancestor, RECEIPT_INVALID now says:The "even when the product patch is unchanged" clause appears only when the patches really are equal. Every other refusal keeps the old text.
What passes and fails is unchanged. The refusal condition is untouched. A non-ancestor read already failed because
targetedClassesSinceanddocsChangeSincereturn null for a non-ancestorfrom(by design since GST-986, andgstack-review-plan's targeted-delta skips the same case), so a fresh targeted read on HEAD is required. The read does not carry even with an unchanged patch.Test.
test/review-targeted-record.test.tsadds a failing-first case: read on a main merge, redo that merge (same tree, new commit), then write. Before the fix it printed the "product changed" text with equal patch ids. Now it pins the new message and the RECEIPT_INVALID code.Changelog:
changelog.d/capy-gst-1700-non-ancestor-targeted-read.md.What changed
RECEIPT_INVALID for a targeted read on a redone merge: before, it blamed a product change while printing two equal patch ids. Now it names the non-ancestor commit and the recovery.
Before/after as text: RECEIPT_INVALID for a targeted read on a redone merge: before it blamed a product change while printing two equal patch ids; now it names the non-ancestor commit and the recovery
Why
Lanes reported that "the receipt says the product changed after the read but prints the same patch id twice" (qm#2952). They then went looking for a product change that wasn't there. The real cause was a targeted read on a commit that a rebase or a redone merge resolution had rewritten. The refusal now says that directly. It also tells the lane to run the targeted reader on HEAD, rerun verify, and write again.
Blast radius
Only the wording of one RECEIPT_INVALID refusal in
gstack-ship-receipt writechanges. The newancestorcallback runs only after the existing refusal condition is already true, so no receipt that passed before fails now, and none that failed now passes (verified by reading lib/ship-receipt-depth.ts:252, and by running test/review-targeted-record.test.ts, 21 pass, 0 fail).parseReviewTargetedhas one caller, bin/gstack-ship-receipt:300, andv.headis checked against hex 40-64 before it reachesgit merge-base.Approvals
No approvals recorded for branch capy/name-the-non-ancestor.
Summary
gstack-ship-receipt writeused to refuse a targeted record read on a rewritten commit by saying the product changed after the read, even when both patch ids were equal. It now names the read commit, says it is not an ancestor of HEAD, and says the record carries only from HEAD or an ancestor. Which receipts pass and which fail is unchanged. A regression test redoes a main merge, giving the same tree on a new commit, and asserts the new wording.Test Coverage
Both changed runtime files have a changed test naming them (deterministic coverage map, no audit reader). New test:
a read on a redone merge resolution names the non-ancestor commit and the recoveryin test/review-targeted-record.test.ts.Tests ran: tests 1622 (files, carried from CI run 42328238636/1 at tree 6018aaa70f0b)
Pre-Landing Review
Review plan: gate class, full depth (bin/gstack-ship-receipt is a gate path). Readers: a batched specialist (testing, security and state-machines checklists), red team, native adversarial, and an outside voice (openai/gpt-6.1-sol, completed, no findings). There were no blocking findings and no fix round. The two specialist test-gap items were skipped as nits below the blocking floor. The four native adversarial items are Low, marked
Blocks: no, and scoped as notes.REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=0 fixed=0 scope=frozen ledgers_read=2 dispatches=4
Gate edits: none detected (1 listed, 0 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: completed (openai/gpt-6.1-sol via host subagent): no actionable findings.
Review notes
Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.
bin/gstack-ship-receipt:300null/128 merge-base status read as non-ancestor; wording only (Low, Blocks: no)bin/gstack-ship-receipt:300absent read commit (exit 128) worded as rewritten; recovery unchanged (Low, Blocks: no)lib/ship-receipt-depth.ts:252equal-ids product-changed message still prints for ancestor reads refused by classesSince; pre-existing (Low)lib/ship-receipt-depth.ts:238ancestor without classesSince could word a passing case as refused; no such caller (Low)bin/gstack-ship-receipt:300(testing, skipped): any nonzeromerge-base --is-ancestorstatus takes the non-ancestor wording. For an absent commit (exit 128) the statement is still true and the recovery is the same.test/review-targeted-record.test.ts:383(testing, skipped): no end-to-end test covers a non-ancestor read with a different product patch (no suffix). QA probe 003 exercised that branch directly.Exploratory QA
Functional (CLI/library), smoke budget 300 s:
bun test test/review-targeted-record.test.ts: 21 pass, 0 fail (exit 0).parseReviewTargetedwith an absent read commit, with an equal-patch non-ancestor read, and with an ancestor read. The first two refuse with the non-ancestor wording (suffix only when the patches are equal), and the ancestor read passes.git merge-base --is-ancestor <absent sha> HEADexits 128.Design Review
No frontend files changed, so design review was skipped.
Eval Results
No prompt-related files changed, so evals were skipped.
Plan Completion
Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). This is a bug fix (--kind fix) with a failing-first regression test.
TODOS
No TODO items completed in this PR.
Documentation
Status: current. The docs already match this change, so nothing was edited.
Scope: base e4b1e34 to head b01d420 (one commit, GST-1700), with no staged, unstaged or untracked changes. It touches
bin/gstack-ship-receipt,lib/ship-receipt-depth.ts,test/review-targeted-record.test.tsand a new changelog fragment. The change only rewords oneRECEIPT_INVALIDmessage: when the targeted reader read a commit that is not an ancestor of HEAD, the message now says so. What passes and fails is unchanged.Documentation health:
docs/troubleshooting.md: current. TheRECEIPT_INVALIDentry already covers the non-ancestor refusal and its recovery.docs/review-policy.md: current. Thereview_targetedrow already names the non-ancestor refusal.changelog.d/capy-gst-1700-non-ancestor-targeted-read.md: new fragment, not edited.Coverage debt: none. The change adds no new public surface.
Diagram drift: none.
Test plan
🤖 Generated with Claude Code