Repository navigation
fork(reviewRules): read lens posts as the gate does; lens_start follow-ups (#799, #841) - #956
Conversation
…t follow-ups Fixes #799, #841. - Newest entry per key by (when, list index), as lens_reads: the gate lists comments, then reviews, then inline comments, so the last one listed is not always the newest. - Unread review flags win over hidden; NO_HEADER keys use the post's place. - Text holding a code point the gate's Python (Unicode 15.0.0) and this runtime assign differently is refused, not read two ways; the table and cases are shared vectors both sides test. - Linear-time, Python-text, round-marker and scan vectors move into the shared vector file; the TS-only copies go. - lens_start: attempt cap, person override clears older findings (UNREAD), same-change check instead of the own-change hash for reads, past-cap and shadow notes, earlierChild helper, clearer refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: code · reviewer: lens agent (Opus 5.5) · read at: 9e4152b |
|
lens: merge-path · reviewer: Claude Opus 5.5 lens agent · read at: 9e4152b blocker: none |
|
lens: state · reviewer: lens agent (Opus 5.5) · read at: 9e4152b |
…ly Unicode a rule reads lens_start counted ended children by exact batch request id, so a new set of pull requests started a capped lens again at attempt 1. It now counts ended children per (lens key, PR number, head) whatever batch they ran in, refuses a capped PR on its own, starts the rest at one more than their highest count, and never plans an id that already ended (a lost record). In enforce with findings judged, a lens whose newest report at the head has no findings section now starts again, as the gate fails that head until it posts again (postAgainKeys, replacing unreadKeys). The Unicode refusal now refuses only code points a rule reads (a letter, number, mark, format character or space, or one with an NFKC or case mapping), so a new emoji refuses nothing; repr escapes what Python leaves unassigned; and the refusal names the post and how to clear it. Shared vectors: a new `reads` section (lens_reads, review_rounds' lenses that must post again, verdict) replayed by review_judge.test.py and lensStart.test.ts; unicode `refused`; an emoji vector; a finding line shown escaped; non-ASCII linear-time bodies. Tests for the person-override sha, the newest-override pick and the findings condition. Docs: children read before posts, store what delegate_task returns, `pr: null` also names a batch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: state r2 · reviewer: lens agent (Opus 5.5) · read at: e2252e5 follow-up: 🤖 Generated with Claude Code |
|
lens: code · reviewer: lens agent (Opus 5.5) · read at: e2252e5 🤖 Generated with Claude Code |
Keeps both sides: #956's post reading (reviews, inline comments, post age, unread flags, pyUnicodeCheck, lensEntries for lens_start) and #865's lens marker rule (a look-alike without the marker is no lens report: notLens). - lensComment.ts: pyUnicodeCheck moves into looksProblem; lensEntries reads looksProblem + hasMarker and returns notLens; lensScan passes it on. - review.vectors.json: every vector from both sides; the about text keeps both additions. No vector's expectation changed. - reviewRules.test.ts / review_judge.test.py: both sides' sections and fields; scan() reads scan_posts over #956's vector_pr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #799, Fixes #841
The TypeScript copy of the review gate (
apps/server/src/fork/reviewRules) andlens_startnow read lens posts the way the gate does, and the follow-ups from both issues are done. The Python gate still decides. The TS copy is held to the shared vectors infork-ci/actions/pr-queue/review.vectors.json, which both sides now replay.#799: what changed, point by point
pyText.pyUnicodeCheck, called bylensKey,lensHeader,lensProblem,foldandreadFindings. The table of code points that Python assigns is a new shared vector section,py_unicode, andreview_judge.test.pychecks it against its ownunicodedata. Threeunicodecases (U+1C89, U+E0080, and assigned-only text) are replayed on both sides.lens_startturns the error into a refusal for that one PR only. Test: "the gate's Unicode table, and text whose code points this runtime assigns otherwise is refused". With the check made a no-op, 2 tests fail.plan.tsreads ASCII digits only in a status. Done as a comment. Git writes a score in ASCII digits only, so every status git writes reads the same on both sides. A status likeR²is refused (no plan, so no lens starts), which fails closed. Matching Python'sisdigitwould only widen what is accepted.LensPost.whereis now required at the type level, so a caller cannot fall back topost N. The doc onLensPostsays a caller never matches on the key's text, only on theNO_HEADERprefix. The scan vectors buildwhereasby <author> at <time>, as the gate does.python-textfindings group (10), more round-marker cases (Arabic-Indic, fullwidth and bold digits, code-point key order), and a newlinearsection (17 bodies, each timed on both sides within itsms).test_each_rule_keeps_its_vectorsnow countsnamedandpython-textand checks that the group counts add up to all findings.LensPostis thinner than what the gate reads.LensPostnow haswhenandunread. The newest entry per key is the max of(when, list index), as inlens_reads. An unread review reads nothing (FLAGS_UNREAD, which wins over hidden).lens_start's newest override is picked the same way. Eight new scan vectors cover reviews, unread flags, out-of-order posts, the same time, no time, an older edit and repr quoting. Python'sscan()lists comments, then reviews, then inline comments, as the gate does. Test: "the newest post by time counts, not the last one listed (the gate lists reviews after comments)". Without the(when, index)pick, 3 tests fail.#841: what changed, point by point
changeOffor two questions. Fixed.LensStartPullRequest.sameChangeis the gate's own rule (head_check.same_change) and is used only to decide whether a lens read this head.changeOfis used only to count rounds. WhensameChangeis absent, only the head itself counts. The test model of the gate inlensStart.test.tsusessameChangetoo. New test: "the same diff in other commits (an amend, a rebase, a force-push) is not read: every lens starts again".LENS_START_MAX_ATTEMPTS = 3per lens, pull request and head, whatever batch each child ran in (see the lens round below). After that the lens is refused for that pull request with the last child's id, and a person looks. A new head starts it afresh.postAgainKeys(wasunreadKeys) mirrorshead_check.review_rounds. A newest entry with no full sha that is covered only by an override that is not a person's override for this head is read again. A person's override for this head (an author inoverride_authors, for the head or the same change) clears it.earlierChild(child, running)builds what the caller stores (id, lens key, PRs), because a long request id is a digest and cannot be read back. The test "the caller stores each child's lens and pull requests: a hashed long id is still found again" covers it. The wiring into a tool is T3b's job and outside this PR, which is why the box stays the caller's.Each fix fails its test without it
I ran one mutation run with every #841 fix reverted at once:
>=on the 10-PR cap;8 tests failed, one for each fix ("the same diff in other commits…", "a lens child that ended without its read…", "enforce: a report that reads nothing…", "past the round cap…", "shadow says…", "refuses a bad call whole", "a repo without a review block…", and the shared-vector property test). The #799 order and Unicode fixes fail 3 and 2 tests, as noted above.
Lens round on 9e4152b: what changed per finding
state, major: the restart cap counted per batch. Fixed. Ended children are now counted per (lens key, PR number, head), in whatever batch they ran. A PR at the cap is refused on its own (
pris its number), the rest of the batch starts at one more than their highest count, and a new start never reuses an id that already ended. New test "the attempt cap counts per lens, pull request and head": #1 capped alone and then named with #2 (#1 refused, #2 starts as attempt 1); #1 capped in [#1, #2] batches and then named with #3; a [#1, #2] batch that shrinks after #2 posted (#1 alone is still capped); one dead batch child makes #1 alone attempt 2; a new head starts afresh; a lost record. Without the fix it fails (old code starts [#1, #2] as attempt 1).code, major (1): the person's-override sha condition had no test. The test now has a listed login override A while the head is B, and expects
codeto start. One for the same change (sameChange) clears it. Replacing the condition withtruenow fails "enforce: a report that reads nothing…".code, major (2): the newest override's (when, index) pick had no test. Added: two overrides where the older one is listed last; the newer one by time covers the report. Taking the last listed fails "the newest post by time counts…". The same case is the shared
readsvector "the newest override by time covers, not the last one listed".code / merge-path / state minor: the Unicode refusal blocked a PR for any new code point, and named neither the post nor the way out.
pyUnicodeChecknow refuses only code points a rule reads (above), so a Unicode 16 emoji in a chat comment or a report refuses nothing.represcapes what the gate's Python leaves unassigned, as Python does.lensEntriesnames the post (where) in the error, and the refusal says the gate reads that post, lens_start does not, and how to clear it: edit the post to drop the code points or delete it (hiding is not enough), then call lens_start again. A code point in the config or the required-lenses input says a person changes that text. New shared vectors: aunicodecase with U+1FAE9 (refused: [], every case now says what T3 refuses) and aroundscase whose finding line holds it (shown as\U0001fae9on both sides). Without the fix the TS test fails.code minor: the attempt cap was per exact batch, and a gap in stored ids restarted the count. Fixed with the state major above.
code minor:
enforce && block.findingshad no test. Added: findings off in enforce, an edited report under an agent's override starts nothing. Droppingblock.findingsnow fails 2 tests.code minor: a child that read but whose report was later edited or hidden was reported as "ended without the read". The texts now say "ended with no read the gate counts (no report, or one edited, hidden or unread since)".
code minor:
pyText.tscomments. Fixed: U+0370–0377 came in 5.1 (the fast path now starts at U+0370), and the doc names the four code points that gained an upper-case partner after 15.0 (no rule reads upper case; each new partner is refused).code minor: every linear-time vector was ASCII. Added 4 non-ASCII
linearvectors (a long run ofé, of U+3000/U+00A0 spaces, a wide table row withü, and letters with emoji before a read-at), timed on both sides.merge-path minor: no shared vectors for what lens_start copies by hand. New
readssection (15 vectors) inreview.vectors.json: posts with overrides, authors, times and reviews, a head, which reads are the same change, andoverride_authors; expectedlens_readsper key, the keysreview_roundsfails until that lens posts again, and whetherverdictand the rounds pass.review_judge.test.pyreplays it with the gate's ownlens.Review.lens_reads,head_check.review_roundsandhead_check.verdict(a fake merge-commit checkout;same_changefrom the vector);lensStart.test.tsreplays it withgateReads,postAgainKeysandgateReadsPass. README and the vectors'aboutsay how.merge-path minor: in enforce, a report at the head with no findings section counted as done. Fixed:
postAgainKeysalso returns a REPORT with no finding and no findings section (asjudge_roundsfails it), so that lens starts again with a note; not in shadow, not with findings off, not once a person's override clears it. New test "enforce: a report of the head with no findings section is read again…" (fails without the fix), a sharedreadsvector, and the test's own gate model (gatePasses) now has the rule too.state minor: lost attempt records. A new start never plans an id that already ended, so a lost record of attempt 1 gives attempt 4, not attempt 1's id again (tested).
LensStartEarlierChildsays the caller passes whatdelegate_taskreturned, never what was planned, and that the cap allows one more start per lost record;runningsays it is read from the task's own state at each call. A timeout for a child recorded running is not added: this module is pure and has no clock, and the task's own state is the truth; that belongs to the T3b wiring.state minor: a child that posts and ends between the two reads.
LensStartInput.childrennow says to read the children before the posts.state minor:
pr: nulldoc.LensStartRefusal.prnow says null is the whole call or a batch child of several PRs. The cap refusal no longer uses null (it is per PR now); the moved-batch refusal still does.code nit (equivalent mutant): no change needed, as the lens says.
Nothing is deferred.
Checks run
vp test run src/fork/reviewRules/: 67/67 (after merging main). The new tests fail on the old code: 4 TS tests (Unicode refusal text, the cap ×2, no findings section), and with the oldpyText.ts4 (the Unicode table, every round, the same-answer property, the Unicode refusal).truefails 1, last-listed override fails 1, droppingblock.findingsfails 2.vp run check:changed: format, lint, knip, typecheck (43 packages), tests: all pass.effect-tsgotypecheck: OK.vp lint: OK.vp fmt --check: OK.lens,review_judge,review_config,review_globandhead_checkall pass (the one skip inhead_checkneeds a checkout and also skips on main).The state question
lens_startis a pure plan over what GitHub shows now. Running it again with the same posts and children gives the same plan. Request ids are deterministic per lens, PRs, heads and attempt, so a child already running is returned, not started twice.confirmLensStart), so a moved or closed PR refuses its batch whole.whensort oldest and tie by list order, as the gate does. A review whose flags were not read counts as reading nothing (fail closed). Text the two Unicode versions read differently refuses that PR only, never guessed, and the refusal names the post and how to clear it. An empty required-lenses input with noreviewblock starts nothing and says why. A missingsameChangemeans only the head itself counts (fail closed: a lens starts again rather than being counted as read).General vs project
All of this is general. It is the fork's TS copy of the general pr-queue gate, plus shared vectors that any repo using the action replays. There are no project facts (repo names, paths, lens names beyond test fixtures) in it. The Unicode table is generated from the gate's Python version, not from a project setting.
Out of scope: #865 (separate, critical).
🤖 Generated with Claude Code