Skip to content

Add a per-repo lane_guards extension point; narrow review_return.py's backref heuristic - #1734

Merged
fdaviddpt merged 3 commits into
mainfrom
fix/1722
Sep 23, 2026
Merged

fdaviddpt merged 3 commits into
mainfrom
fix/1722

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional lane_guards key to .oss.json -- a list of {prefix, test, why} objects a managed repository uses to register its own cross-cutting CI guard tests. Merged into scripts/lane_setup_patterns.py's built-in CROSS_CUTTING_GUARDS table via a new _repo_declared_guards(repo) function, wired into known_guards()/guards_for_files(). Tolerant by construction: missing/malformed .oss.json, no lane_guards key, or a malformed entry all degrade to "no extra guards" rather than raising. Validated by a new oss_config.lane_guards_problem() function.
  • Narrows scripts/review_return.py's classify() so a fully-enumerated FINDINGS: N message is no longer forced into referred-not-stated purely for containing an incidental back-reference phrase ("shown above", "given ... earlier") -- only when that phrase is confined to the paragraph span of an already-enumerated block. A back-reference in the message's preamble, in a separate trailing paragraph, or in a single-block message still forecloses exactly as before.

Motivation

Both issues were filed from measured, repeated costs on a downstream maintainer loop (claude-supertool): #1722 from 6 of 8 developer-lane PRs in one day each needing an extra CI round for a repo-specific guard the lane never ran locally; #1727 from three independently dispatched lanes in one tick each hitting the same false-trigger shape on different diffs.

Review

Two reviewers (Explore, oss:auditor) ran per agents/developer/review.md. Explore found two real issues, both fixed: the confinement check's first draft used bare position rather than block span, reopening the #392 false-shielding class from a different angle; fixed with a _block_span()-based per-match check plus three new regression tests. A docstring overclaim resolved as a side effect of that same fix. oss:auditor returned FINDINGS: 0 across all four defect classes.

A related classifier limitation (quoted repro text inside a fenced code block can itself trip the backref heuristic) was found and logged to trap.d/ rather than patched here, deferred to /oss:curate.

Test plan

  • tests/test_lane_setup_patterns_1722.py (21 new tests): red (StopIteration/AttributeError) before the fix via git-stash, green after.
  • tests/test_review_return_1727.py (6 tests) plus two later regression tests: red before the fix, green after (141 passed, 1 pre-existing skip, across the narrowed 8-file suite).
  • Guard receipt via lane_setup.py --claim: 3 cross-cutting guards, all run and green.
  • Full CI matrix (13 legs) -- the merge gate, not re-run locally.

Closes #1722
Closes #1727

🤖 Generated with Claude Code

[AI-generated]

fdaviddpt and others added 3 commits September 23, 2026 23:46
…n backref heuristic (#1722, #1727)

#1722: `.oss.json` may now declare `lane_guards` -- a list of {prefix, test,
why} objects a managed repository uses to register its own cross-cutting
guard tests, merged into `lane_setup_patterns.CROSS_CUTTING_GUARDS` (a
claude-oss-only table until now) whenever `known_guards`/`guards_for_files`
are called with a repo. Validated by a new `oss_config.lane_guards_problem`.

#1727: `review_return.classify` no longer forecloses `states-findings` on a
fully-enumerated `FINDINGS: N` message whose only back-reference phrase sits
at or after the first of at least two enumerated blocks -- confined to
material the message demonstrably carries, rather than pointing outside it.
#392's own defended shape (a preamble gesture ahead of a trailing, unrelated
bullet list) and every `tests/test_review_return_backref_1270.py` single-block
fixture are unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
A spawned Explore review found the first draft's `_backref_confined_to_
enumeration` checked only position ("at or after the first enumerated
block's own start"), which reopens the #392 class it was supposed to
guard: an unrelated trailing section can inflate the block count past
`claimed`, and a message can enumerate exactly `claimed` real findings
and then announce an undisclosed extra issue in a separate trailing
paragraph -- both wrongly shielded a genuinely dangling gesture.

Fixed by checking each block's own paragraph span (`_block_span`: from
its marker to the next marker, the next blank line, or the end of the
body) instead of a bare position bound. Both reproductions are now
pinned as must-fire regressions in tests/test_review_return_1727.py,
alongside a new must-not-fire case for a genuine multi-line finding
whose aside sits on a continuation line of the same block.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…o text

Observed during this lane's own self-review round: a reviewer final message
piped through `review_return.py --framed` (per the review-return phase file)
was misclassified `referred-not-stated`, even though it fully states two
real findings, because a fenced code block quoting example/repro text inside
finding #1's own body contains the words `_BACKREF` matches on. Not a fix --
a fragment for /oss:curate to weigh against the module's own four prior
hardening rounds (#1270, #1327, and now this).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@fdaviddpt
fdaviddpt merged commit f0736be into main Sep 23, 2026
10 checks passed
@fdaviddpt
fdaviddpt deleted the fix/1722 branch September 23, 2026 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant