Skip to content

test(deploy): pin the two widest citation ranges' interiors, not just their first lines (BLO-32210) - #1686

Open
allyblockcast[bot] wants to merge 1 commit into
masterfrom
ci/blo-32210-contains-guards
Open

test(deploy): pin the two widest citation ranges' interiors, not just their first lines (BLO-32210)#1686
allyblockcast[bot] wants to merge 1 commit into
masterfrom
ci/blo-32210-contains-guards

Conversation

@allyblockcast

@allyblockcast allyblockcast Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thinking Path

  • Paperclip is the open source app people use to manage AI agents for work
  • The production deploy chain gates helm upgrade behind an approval ring managed by scripts/approve-paperclip-api-digest.sh, whose two in-flight-lock retirement loops carry long comments defending non-obvious choices (flat vs linear backoff, silent vs chatty success)
  • test(deploy): assert the two retirement loops' retry pacing (BLO-32109) #1671/test(deploy): pin the two retirement loops' messaging asymmetry (BLO-32122) #1674 converted those defended claims into assertions, and test(deploy): pin the two retirement loops' messaging asymmetry (BLO-32122) #1674 added LINE_CITATIONS so each `:NNN` comment reference is mechanically pinned to the content it cites
  • But that pin anchors only each range's first line. Three of six entries carried a contains guard for the rest; the two widest ranges (10-line and 5-line) did not — the inverse of where interior drift matters most
  • Ally measured this as reachable rather than theoretical: gutting the interior of :751-760, or the last line of :759-763, each left the suite 81/81 green with the citation still claiming content that was no longer there
  • This pull request adds contains to both, corrects a comment that overstated what survives a rewrap, and — the durable part — asserts structurally that no multi-line citation can exist without a guard
  • The benefit is that the gap cannot reopen silently: the next wide citation added is unguarded by default, and that now fails a test instead of quietly shipping

Linked Issues or Issue Description

What Changed

Test-only. scripts/approve-paperclip-api-digest.sh is not modified (git diff --quiet origin/master -- scripts/approve-paperclip-api-digest.sh is clean).

  • LINE_CITATIONS entry :751-760 gains contains: /only remaining asymmetry[\s\S]*unfinished parity fix[\s\S]*no such deadline/, pinning the interior of the ten lines defending the release loop's flat backoff.
  • LINE_CITATIONS entry :759-763 gains contains: /not a parity gap[\s\S]*returnvsexit is structurally required/, pinning through the last line of the messaging-asymmetry defence.
  • New structural assertion in no line citation can be added to this file without being pinned: any multi-line cite lacking contains fails the suite. This is what stops the gap reopening — patching the two known instances alone would leave the default for the next wide citation exactly as unguarded as before.
  • Corrected the comment at the ring-sentence assertion: it said "a rewrap stays green", which is true of that assertion but not of the suite — a rewrap deletes a line, shifting every citation below it by −1 and correctly turning the citation test red. Now says both halves explicitly.
  • Corrected the "seven citations" header comment to note seven occurrences across six distinct ranges (the messaging-asymmetry range is cited twice), which is why the table has six rows.

Verification

Rebased onto current master (457f7da26) — the branch had been stacked on #1674's pre-merge commits, which never landed; master carries their merge-queue-rebased equivalents. Real git rebase --onto origin/master, not a splice. Single commit, one file, +34/−7.

node --test ./scripts/approve-paperclip-api-digest.test.js   # 81 pass, 0 fail
git diff --quiet origin/master -- scripts/approve-paperclip-api-digest.sh   # clean

Mutation-verified with a before/after control, because "the mutation fails now" only proves a gap closed if it passed before. Each mutation confirmed a real edit (git diff --numstat non-empty) and bash -n/node --check clean before its result was recorded; tree restored to 0 modified files after each.

mutation edit on master (no fix) on this branch
MC6b — replace interior lines 752-754 of the :751-760 target +3/−3 GREEN (the gap) fails every line citation …
MC7b — replace the last line, 763, of the :759-763 target +1/−1 GREEN (the gap) fails every line citation …
MC8 — strip the contains off :751-760 (the gap reopening) +0/−1 n/a fails no line citation can be added …

Both MC6b and MC7b are deliberately line-count-preserving, so they cannot trip the first-line anchor via line-shift — they isolate the contains guard itself. MC8 confirms the structural assertion discriminates rather than being decorative.

Risks

Low. Test-only; no shipping script or runtime path is touched.

The one real consequence is intentional and worth naming: a multi-line citation is now required to carry a contains, so adding one without a guard fails CI. That is the point — but it means a future contributor adding a wide citation must also write its guard. The failure message says exactly that.

Inherited from #1674 and unchanged here: any script edit that changes line count above :763 shifts the citations below it and turns this suite red. The failure is true rather than noise (it names where each citation moved to), but it is a real maintenance cost on this one file.

Model Used

  • Claude Opus 4.5 (claude-opus-4-5), 1M context, extended thinking, with tool use and code execution (Claude Code CLI / Claude Agent SDK).

Checklist

  • I have included a thinking path that traces from project context to this change
  • I have specified the model used (with version and capability details)
  • I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work
  • I have searched GitHub for duplicate or related PRs and linked them above
  • I have either (a) linked existing issues with Fixes: # / Closes # / Refs # OR (b) described the issue in-PR following the relevant issue template
  • I have run tests locally and they pass
  • I have added or updated tests where applicable
  • If this change affects the UI, I have included before/after screenshots — n/a, no UI surface
  • I have updated relevant documentation to reflect my changes — the two corrected in-file comments are the documentation this change affects
  • I have considered and documented any risks above
  • All Paperclip CI gates are green — pending; will confirm before requesting merge
  • Greptile is 5/5 with no open P2s, recommendations, or follow-ups — pending review
  • I will address all Greptile and reviewer comments before requesting merge

… their first lines

The citation pinning added in #1674 anchors each `:NNN` range to its FIRST
LINE, and three of the six entries additionally carry a `contains` guard
holding the rest of the range to the content the citing comment claims is
there. The three that got one are the three NARROWEST ranges (3, 3 and 2
lines); the two that went without are the two widest (10 and 5) -- the
inverse of where interior drift matters most.

Measured, not supposed. Against the previous head:

  MC6b  replace the interior of `:751-760` (script lines 752-754,
        leaving the 751 anchor intact)              -> 81/81 GREEN
  MC7b  replace the last line of `:759-763`
        (script line 763, anchor intact)            -> 81/81 GREEN

Both now fail the citation test by name. Guards are in the existing idiom
and span the range rather than re-checking the anchor:

  :751-760  only remaining asymmetry -> unfinished parity fix -> no such
            deadline   (script 752 -> 754 -> 757)
  :759-763  not a parity gap -> `return` vs `exit` is structurally required
            (script 759 -> 763)

Also makes the invariant mechanical instead of adding a fourth unchecked
promise to a file whose thesis is that its comments are checkable: the
completeness test now asserts every multi-line entry HAS a `contains`, so
the next wide citation cannot be added unguarded and reopen this quietly.

Two comment corrections from the same review:

- the wrap comment claimed a rewrap "stays green". True of that assertion,
  false of the suite -- a rewrap deletes a line, so every citation below
  shifts by -1 and the citation test correctly goes red. It now says so.
- the header said "all seven citations" above a six-row table. Both numbers
  are right (seven occurrences, six distinct ranges, one cited twice); it
  now says which is which.

Test-only. `scripts/approve-paperclip-api-digest.sh` is byte-identical.

Refs BLO-32210
@allyblockcast

allyblockcast Bot commented Sep 6, 2026

Copy link
Copy Markdown
Author

🔗 Paperclip issue: BLO-32109
🔗 Paperclip issue: BLO-32122
🔗 Paperclip issue: BLO-32210

@allyblockcast allyblockcast Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ally — Consolidated PR Review

Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex.
Reviewed head: ffc4357

Looks good. Test-only, no shipping-script path touched, and every claim in the description reproduced independently rather than taken on trust. I re-ran the suite and the mutation controls against the files fetched at this exact head:

control result
baseline node --test 81 pass / 0 fail
MC6b — replace interior lines 752-754 of :751-760, line-count preserving fails every line citation …
MC7b — replace last line 763 of :759-763, line-count preserving fails every line citation …
MC8 — strip contains off :751-760 fails no line citation can be added …
rewrap :346-348 into one line fails, naming all four shifted citations and where each moved to

Both new guards discriminate, and the structural assertion is load-bearing rather than decorative. I also checked the two corrected comments against reality: `:NNN` occurrences are 7 across 6 distinct ranges (matching the six-row table), and the rewrap claim is exactly right — the last control above shows :751-760, :755-757, :759-763, :761-762 all reported at −1 with their new positions.

Critical Issues (0)

Important Issues (0)

Suggestions (2)

  • [native-codex] scripts/approve-paperclip-api-digest.test.js:2178 — the new assertion checks that a contains is present, not that it reaches. !c.contains is satisfied by any regex, including one that pins nothing. Measured: replacing the :751-760 guard with contains: /#/ leaves the suite at 81 pass / 0 fail, and MC6b then passes green again — i.e. the exact gap this PR closes reopens, while the new assertion reports it as guarded. This is the same distinction the comment two lines above it draws ("Pinned AT ALL is not the same as pinned THROUGHOUT"), applied one level up.

    • Not asking for it here — the two entries this PR adds are genuine guards, and presence-checking is a strict improvement over nothing. But if a cheap reach check is wanted later, asserting that each contains match extends to within N lines of the range end would close it; the harness already computes citedRange(cite), so the match offset is in hand.
  • [gstack/review] scripts/approve-paperclip-api-digest.test.js:2063 — "contains additionally holds the rest of the range to the content the citing comment claims is there" slightly overstates what :751-760 achieves. Its match ends at script line 757, so lines 758-760 sit inside the cited range with no content pin from that entry. Line 760 (# to close: this loop's caller (cleanup_on_exit) prints the operator) is inside both :751-760 and :759-763 and is wildcarded by [\s\S]* in both — a line-count-preserving rewrite of it leaves the suite at 81 pass / 0 fail. (Line 758 is a bare #, so its gap is immaterial; 759 and 761-762 are covered by sibling entries.)

    • Worth a word only because comment-vs-reality accuracy is this PR's own subject: "every multi-line entry carries one" is exactly true and is the durable claim; "holds the rest of the range" is the part that reaches further than the regexes do. Tightening the :751-760 guard to anchor on its final line — as :759-763 already does — would make the sentence true as written.

Strengths

  • The structural assertion is the right shape of fix. Patching the two known instances would have left the default for the next wide citation exactly as unguarded as before; asserting the invariant means the gap fails CI instead of shipping quietly, and MC8 confirms it discriminates.
  • Before/after mutation controls with line-count-preserving edits. That is the detail that makes MC6b/MC7b meaningful — a line-shifting mutation would have tripped the first-line anchor and proved nothing about contains.
  • The rewrap comment correction is the more valuable of the two comment fixes: the original was true of the assertion and false of the suite, which is precisely the kind of locally-true/globally-wrong comment that sends a future reader in the wrong direction. The corrected version now states both halves, and the control above confirms both.
  • Correctly scoped: scripts/approve-paperclip-api-digest.sh is untouched, so nothing here can affect the production deploy chain it tests.

Recommended Action

  1. No Critical or Important issues — nothing blocking from this review.
  2. Both Suggestions are optional and neither needs to land here; the second is a one-line regex tightening if you want the comment at :2063 to be literally true.

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.

0 participants