Skip to content

fork(reviewRules): read lens posts as the gate does; lens_start follow-ups (#799, #841) - #956

Merged
scuttletoby merged 5 commits into
mainfrom
fork/review-rules-799-841
Nov 22, 2026
Merged

scuttletoby merged 5 commits into
mainfrom
fork/review-rules-799-841

Conversation

@scuttletoby

@scuttletoby scuttletoby commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Fixes #799, Fixes #841

The TypeScript copy of the review gate (apps/server/src/fork/reviewRules) and lens_start now 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 in fork-ci/actions/pr-queue/review.vectors.json, which both sides now replay.

#799: what changed, point by point

  1. Unicode version drift. The gate's Python 3.12 has Unicode 15.0.0. Node is newer. TS now refuses text that holds a code point the two assign differently when a rule reads it (a letter, number, mark, format character or space in this runtime, or one with an NFKC or case mapping). A new symbol such as an emoji reads alike on both sides and is not refused (see the lens round below). The check runs in pyText.pyUnicodeCheck, called by lensKey, lensHeader, lensProblem, fold and readFindings. The table of code points that Python assigns is a new shared vector section, py_unicode, and review_judge.test.py checks it against its own unicodedata. Three unicode cases (Ᲊ U+1C89, U+E0080, and assigned-only text) are replayed on both sides. lens_start turns 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.
  2. plan.ts reads 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 like R² is refused (no plan, so no lens starts), which fails closed. Matching Python's isdigit would only widen what is accepted.
  3. "No header" key wording. LensPost.where is now required at the type level, so a caller cannot fall back to post N. The doc on LensPost says a caller never matches on the key's text, only on the NO_HEADER prefix. The scan vectors build where as by <author> at <time>, as the gate does.
  4. Cases on one side only. The TS-only tests ("Python's regex and int rules", "Python's text rules") and the copied linear-time lines are gone. They are now shared vectors: a python-text findings group (10), more round-marker cases (Arabic-Indic, fullwidth and bold digits, code-point key order), and a new linear section (17 bodies, each timed on both sides within its ms). test_each_rule_keeps_its_vectors now counts named and python-text and checks that the group counts add up to all findings.
  5. LensPost is thinner than what the gate reads. LensPost now has when and unread. The newest entry per key is the max of (when, list index), as in lens_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's scan() 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

  • One changeOf for two questions. Fixed. LensStartPullRequest.sameChange is the gate's own rule (head_check.same_change) and is used only to decide whether a lens read this head. changeOf is used only to count rounds. When sameChange is absent, only the head itself counts. The test model of the gate in lensStart.test.ts uses sameChange too. New test: "the same diff in other commits (an amend, a rebase, a force-push) is not read: every lens starts again".
  • 10-PR cap. Added a test at exactly 10 PRs (one call, nothing refused). The refusal text at 11 is asserted in full.
  • Past the round cap, the gate already passes. When the gate judges no rounds (not enforce) and the head already passes, nothing starts. A note says so, and no person is asked to act. In enforce mode the refusal stays.
  • Message for an empty required-lenses input. It now says the gate requires no lens there (it fails a head only when the lens comments there do not all read it), so nothing starts.
  • Restart loop for dead children. Capped by LENS_START_MAX_ATTEMPTS = 3 per 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.
  • Enforce stuck on an unread report. postAgainKeys (was unreadKeys) mirrors head_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 in override_authors, for the head or the same change) clears it.
  • Loosely tested refusals. The moved-batch refusal and the empty-input refusal are now asserted in full.
  • Shadow starts extra lenses. A note names the path-rule lenses that shadow starts on purpose, and their cost: a child slot and the runner's usage (Fable usage for a Fable lens).
  • T3b stores earlier children. 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:

  • the old own-change pass check;
  • no attempt cap;
  • no unread check;
  • no past-cap pass branch;
  • no shadow note;
  • >= on the 10-PR cap;
  • the old empty-input text.

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 (pr is 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 code to start. One for the same change (sameChange) clears it. Replacing the condition with true now 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 reads vector "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. pyUnicodeCheck now refuses only code points a rule reads (above), so a Unicode 16 emoji in a chat comment or a report refuses nothing. repr escapes what the gate's Python leaves unassigned, as Python does. lensEntries names 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: a unicode case with U+1FAE9 (refused: [], every case now says what T3 refuses) and a rounds case whose finding line holds it (shown as \U0001fae9 on 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.findings had no test. Added: findings off in enforce, an edited report under an agent's override starts nothing. Dropping block.findings now 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.ts comments. 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 linear vectors (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 reads section (15 vectors) in review.vectors.json: posts with overrides, authors, times and reviews, a head, which reads are the same change, and override_authors; expected lens_reads per key, the keys review_rounds fails until that lens posts again, and whether verdict and the rounds pass. review_judge.test.py replays it with the gate's own lens.Review.lens_reads, head_check.review_rounds and head_check.verdict (a fake merge-commit checkout; same_change from the vector); lensStart.test.ts replays it with gateReads, postAgainKeys and gateReadsPass. README and the vectors' about say how.

merge-path minor: in enforce, a report at the head with no findings section counted as done. Fixed: postAgainKeys also returns a REPORT with no finding and no findings section (as judge_rounds fails 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 shared reads vector, 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). LensStartEarlierChild says the caller passes what delegate_task returned, never what was planned, and that the cap allows one more start per lost record; running says 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.children now says to read the children before the posts.

state minor: pr: null doc. LensStartRefusal.pr now 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 old pyText.ts 4 (the Unicode table, every round, the same-answer property, the Unicode refusal).
  • Mutations from the code lens: person-override sha → true fails 1, last-listed override fails 1, dropping block.findings fails 2.
  • vp run check:changed: format, lint, knip, typecheck (43 packages), tests: all pass.
  • effect-tsgo typecheck: OK.
  • vp lint: OK.
  • vp fmt --check: OK.
  • knip: OK.
  • Seam check: OK. No upstream file is changed.
  • Python tests: lens, review_judge, review_config, review_glob and head_check all pass (the one skip in head_check needs a checkout and also skips on main).

The state question

  • Runs again: lens_start is 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.
  • Stops half-way: a child that ends without its read is started again as the next attempt, up to 3 children per lens, pull request and head, in whatever batch they ran. After that it is refused for that pull request and a person looks, so a new or smaller batch cannot restart it. Heads are checked again just before starting (confirmLensStart), so a moved or closed PR refuses its batch whole.
  • Old or empty state: old posts with no when sort 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 no review block starts nothing and says why. A missing sameChange means 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

…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>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent (Opus 5.5) · read at: 9e4152b
verdict: not safe to merge
covered: the whole diff (apps/server/src/fork/reviewRules: lensComment, findings, rounds, plan, pyText, pyUnicode, lensStart, vectors.testkit and their tests; fork-ci/actions/pr-queue review.vectors.json, review_judge.test.py, lens.test.py), the PR body, and every point and comment of #799 and #841, checked against the gate's code (lens.py lens_scan / lens_reads / lens_posts / override_sha, head_check.py verdict / review_rounds, review_judge.py judge_rounds).
checks: vitest src/fork/reviewRules 64/64; review_judge.test.py 54 OK; lens.test.py 80 OK. A Python 3.12 (Unicode 15.0) vs Node 24 (Unicode 17) sweep over every code point assigned in both: lower, \w, Nd, NFKC, Cf and whitespace agree; only upper differs (U+019B, U+0264, U+A7D3, U+A7D5, whose new partners are refused, and the TS side reads no upper case). Mutation run, one mutation at a time, 15 mutations: 11 fail a test; 4 survive (below; one of them is equivalent).
state: runs again: request ids are deterministic per lens, PR set, heads and attempt, so a second call gives the same ids and no duplicate child. Stops half-way: an ended child without the read is started again as attempt 2, then 3, then refused with the last id (the "no attempt cap" mutation fails 2 tests). Old state: the count comes only from the caller's ended children, so it is correct only while the caller keeps every ended id (minor below). Empty state: no posts give attempt 1; no reads and nothing required pass, as in head_check.verdict.
plan: the review kit plan for this PR's paths says critical, lenses merge-path, state and code. So code alone is not enough: merge-path and state are needed too.
blocker: none
major: two lens_start rules that the PR body says are fixed have no test that fails without them. (1) The person's-override sha condition (apps/server/src/fork/reviewRules/lensStart.ts:279-284; head_check review_rounds sha == head or same_change): replacing it with true leaves 64/64 green. The test "A listed login's override for another change clears nothing" (lensStart.test.ts:1192) posts the person's override for B, which is the head, so it tests a clearing override, not one for another change. Fix: let the person override A while the head is B, and expect code to start. (2) newestOverride's (when, index) pick (lensStart.ts:241): taking the last listed override instead also leaves 64/64 green. The gate lists reviews after comments, and override_sha accepts an override posted as a review, so the order matters. Add a vector or test where an older override is listed last.
minor: the Unicode refusal (lensStart.ts:691-698, pyText.ts:54) is fail-closed, so it cannot pass a PR wrongly. But any post-15.0 code point in any counted post on the PR (an old or superseded comment, a person's discussion comment, a Unicode 16 emoji in a model-written report) holds lens_start for that PR until someone edits or deletes the post, and the refusal names neither the comment nor a way out (compare NO_HEADER_WAY_OUT)
minor: the attempt cap is per exact batch, not per lens and head. The id hashes the sorted PR set and heads (lensStart.ts:564-572) while the busy check matches per PR (lensStart.ts:723), so one lens on one head gets 3 attempts in each different batch it joins. A gap in the caller's stored ended ids also restarts the count at that attempt (lensStart.ts:743-748). Bounded, but not "3 per lens per head" as the comment at lensStart.ts:32 says
minor: the enforce && block.findings condition (lensStart.ts:440; judge_rounds counts UNREAD only with findings on) has no test: dropping block.findings leaves 64/64 green (it would only start extra lenses, never pass a head)
minor: a child that did read, but whose report was later edited or hidden, is reported as "ended without the read" and counts toward the cap (lensStart.ts:760-764). Wording only, fail-closed
minor: pyText.ts:32 says U+0000-0377 have been assigned since 1.1, but U+0370-0377 came in 5.1 (harmless, since both sides assign them). pyText.ts:51 says case pairs are stable, but U+019B, U+0264, U+A7D3 and U+A7D5 gained upper-case pairs after 15.0. The check is still sound because their new partners are refused and the TS code reads no upper case
minor: every linear-time vector is ASCII, so no time bound covers pyUnicodeCheck on long non-ASCII bodies
nit: the "unread before hidden" order in lensEntries cannot be mutated observably, because hidden is already false for an unread post (equivalent mutant, no test needed)

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: merge-path · reviewer: Claude Opus 5.5 lens agent · read at: 9e4152b
verdict: safe to merge
covered: the full diff against main (lensStart.ts, lensComment.ts, pyText.ts, pyUnicode.ts, findings.ts, rounds.ts, plan.ts, both TS test files, vectors.testkit.ts, review.vectors.json, review_judge.test.py, the pr-queue README), next to the gate's lens.py (lens_posts, lens_scan, lens_reads, override_sha, lens_problem), head_check.py (same_change, verdict, review_rounds, decide) and review_judge.py (judge_rounds); issues #799 and #841, every point
checks: ran the PR's TS tests (vp test run src/fork/reviewRules/: 64/64) and review_judge.test.py (54 tests, OK); compared every code point that Python 3.12.3 (Unicode 15.0.0) and Node 24.21 (Unicode 17.0) both assign, 286,719 of them, for alnum (the \w the rules use), Nd, Cf, lower() and NFKC: all identical; the only general-category changes are U+0295 (Ll to Lo) and U+1171E (Mn to Mc), and neither changes what any rule reads. So refusing the code points the two assign differently is enough for the drift #799 point 1 is about. Walked the newest-entry pick, the newest-override pick, the unread classification and the pass check against the Python line by line
state: runs again: lens_start is a pure plan over the posts, ids are deterministic per lens, heads and attempt, and a child already running is returned, not started twice. Stops half-way: a child that ended without its read starts again up to 3 attempts, then is refused for a person. Old or empty state: posts with no time sort oldest and tie by list place, as lens_posts does; a review whose flags were not read reads nothing; no sameChange means only the head itself counts. The Python gate still decides every merge, and nothing here can make it pass a head: every way lens_start can be wrong below ends in a failing gate (a stuck PR), never a merge.

blocker: none
major: none
minor: the Unicode refusal is wider than the drift it guards. lensEntries runs lensProblem, and so pyUnicodeCheck, on every counted post, not only ones that look like a lens report, and it refuses any code point the two Unicode versions assign differently. Of the 10,615 code points Node 24 assigns and Python 3.12 does not, 834 are So symbols (new emoji among them), and they read the same on both sides: not \w, no NFKC or case mapping, not Cf. One such emoji in any comment by a counted author then refuses lens_start for that PR until the comment is edited or deleted, and the refusal (lensStart.ts:696) names the code point but neither the post nor that way out. It fails closed. Suggest refusing only drift code points whose runtime category is a letter, number, mark, Cf or space, or that have an NFKC or case mapping, and naming the post in the refusal (pyText.ts:53, lensComment.ts:330).
minor: the part of the gate that lens_start copies by hand (gateReads as lens_reads with the newest override, unreadKeys as review_rounds' UNREAD and CLEARED, gateReadsPass as head_check.verdict with same_change) has no shared vectors. The scans section stops at lens_scan, and lensStart.test.ts holds these rules only to gatePasses (lensStart.test.ts:116), a second TS reading of the same Python. I found no divergence by reading, but nothing replays these rules on both sides, so a later change to lens_reads or review_rounds fails no TS test. Suggest a shared reads section (posts with overrides, times, authors, a head and which reads are the same change, giving lens_reads, the UNREAD keys and the verdict) that lens.py or head_check.py and lensStart.ts both replay.
minor: in enforce, passes (lensStart.ts:443) counts a required lens as done when its newest report at the head has no findings section, but judge_rounds fails that head (lens X: its newest report has no findings section). The way out is that lens posting again, and lens_start starts nothing and says nothing about it, so the PR waits for a person. It is the same kind of stuck state as #841's unread item, which this PR fixes; gatePasses has the same gap, so the shared-state test cannot see it. It fails closed.

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state · reviewer: lens agent (Opus 5.5) · read at: 9e4152b
covered: the full diff (lensStart.ts, lensComment.ts, pyText.ts, pyUnicode.ts, rounds.ts, plan.ts, findings.ts, the tests, review.vectors.json, review_judge.test.py, README), issues #799 and #841 point by point, and the gate's own lens_scan, lens_reads and head_check.review_rounds for the new when/unread/person-override logic.
checks: ran vp test run src/fork/reviewRules/ on the head: 64/64 pass. Probe tests (not committed) for the restart cap, a lost record and a Unicode 16 emoji; results below. Mutations: dropping !unread.has(key) from the done check fails 2 tests (the shared-vector property and "enforce: a report that reads nothing ..."); making an unread review count as hidden fails "every scan".
state: runs again: same posts and children give the same plan, and a running child is matched by lens key + PR + head, so it is returned, never started twice. Stops half-way: a dead child is started again as attempt 2 and 3, then refused, but only while the batch stays the same (major below). Old state: posts with no when sort by list order as in the gate; an unread review reads nothing; children stored before this PR do not exist yet (T3b wires the tool), and the request id scheme is unchanged. Empty state: no children means attempt 1; an empty required-lenses input starts nothing and says why.
blocker: none
major: the restart cap counts attempts per batch, not per lens + pull request + head, so a new batch starts a capped lens again from attempt 1 (apps/server/src/fork/reviewRules/lensStart.ts:737-760). ended is matched by exact request id, and the id is a digest of the batch's PR set. Probe: 3 dead children of lens code on #1 alone, then a call naming #1 and #2 starts code for [#1, #2] as attempt 1; after 3 dead [#1, #2] children, a call naming #1 and #3 starts attempt 1 again. A batch also shrinks by itself when a child posts for some PRs and dies before the rest. With PRs opening and closing, a lens that always dies on one PR keeps restarting, which is what #841 asked to cap and what the PR body says cannot happen ("so there is no endless restart"). The children already carry key and prs (earlierChild), so count ended children per (key, number, head), take the highest count over a batch's PRs for its attempt, and refuse the PRs at the cap. Add the test above (capped #1, then #1 with #2: #1 is refused, #2 starts).
minor: a caller that lost the record of attempt 1 but holds attempts 2 and 3 gets attempt 1 planned again with the original request id (probe). If delegate_task returns that ended task for a reused id, nothing new runs while the plan says it starts. Together with no age limit on a child recorded running: true (lensStart.ts:131), T3b has to store what delegate_task returns, not assume it runs. One line on LensStartEarlierChild would hand that on.
minor: a child that posts its read and ends between the caller's read of the posts and its read of the children is started again as a duplicate read of the same head. The doc on LensStartInput.children (lensStart.ts:148) could say to read the children first, then the posts.
minor: the Unicode refusal fires on any counted comment, not only lens reports: lensProblem checks every body (lensComment.ts:250). A plain chat comment with U+1FAE9 (an emoji from Unicode 16; this Node has Unicode 17) refuses lens_start for that PR. The refusal (lensStart.ts:696) names the code point but not the comment or the way out (edit or delete it), so a person has to search the thread. It fails closed, so nothing unsafe; name the post's where in the reason.
minor: the cap refusal for a batch uses pr: null, which LensStartRefusal documents as "the whole call" (lensStart.ts:176), though only that lens group is refused. The moved-batch refusal already does the same; the doc should say null also means "a batch".

scuttletoby and others added 2 commits November 22, 2026 15:46
…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>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: state r2 · reviewer: lens agent (Opus 5.5) · read at: e2252e5
verdict: safe to merge
covered: the fix commit 9814f4f and the diff since 9e4152b for this PR's paths (lensStart.ts, lensComment.ts, pyText.ts, reviewRules.test.ts, lensStart.test.ts, vectors.testkit.ts, review.vectors.json, review_judge.test.py, the pr-queue README); the rest of the diff since 9e4152b is the merge of main (heavy, review kit, secret sweep, thread roles), not this PR's change. Also read: the PR body's per-finding status, the round-1 lens comments, issues #799 and #841, and the gate's own rules for what the new code copies (review_judge.judge_rounds, head_check.review_rounds and verdict, lens.override_sha and lens_reads).
checks: vp test run src/fork/reviewRules/: 67/67. review_judge.test.py: 56 OK; lens.test.py: 80 OK (Python 3.12.3, Unicode 15.0; Node 26.13, Unicode 17.0). No changed test needs a socket, so none was skipped here. Round-1 mutations, one at a time: the person's-override sha check set to true fails 2 tests; picking the last-listed override fails 2; enforce without block.findings fails 2; dropping the no-findings-section rule fails 3. Cap mutations: ignoring the head in the per-PR count fails 1; dropping the lost-record skip fails 1; > for >= at the cap fails 2. Unicode mutations: refusing every drift code point again fails 4 (the emoji case among them); refusing none fails 2; dropping the escaping of code points Python leaves unassigned in repr fails 1. Shared reads vectors: flipping one expected value fails review_judge.test.py (replayed through the gate's own lens_reads, review_rounds and verdict) and lensStart.test.ts, so both sides run them. A sweep of every code point Node 26 assigns and Python 3.12 does not (10,615): 9,754 are a letter, number, mark, format character or space and are refused; 26 more are refused only for their NFKC mapping (U+1CCD6 to U+1CCEF, outlined Latin letters, category So, NFKC to ASCII letters); none of the rest matches Python's whitespace or a case-insensitive letter. A probe: a report line that starts with U+1CCE2 and then ajor: is refused on the head, the gate's read_findings reads no finding in it, and a U+1FAE9 emoji refuses nothing.
state: runs again: the plan is pure over the posts and the children; the request ids are deterministic per lens, PR set, heads and attempt; a running child is returned, not started twice. Stops half-way: ended children are now counted per lens, pull request and head in whatever batch they ran. A capped PR is refused on its own, a new or smaller batch cannot restart it (tested: capped alone and then named with #2, capped in pairs and then named with #3, a batch that shrinks after a partial post), and a new head starts afresh. Lost records: a lost record of attempt 1 plans attempt 4, never an id that already ended. The doc says that each lost record allows one more start, and that running is read from the task's own state. A child that ends between the two reads is handled by the documented order (children before posts). Old or empty state: posts with no time sort oldest by list order, an unread review reads nothing, no children means attempt 1, and a missing sameChange counts only the head. Unicode: the narrowed refusal can only refuse (fail closed), never pass. It refuses only code points a rule reads (each other drift code point reads alike on both sides, by the sweep above), only for that PR, and it names the post and how to clear it. A drift code point in config text gives the config message, because every lens body is checked whole by lensProblem before readFindings runs on it.
round 1, fixed: the restart cap counted per batch; it now counts per lens, pull request and head, and the new test fails without it.
round 1, fixed: the code lens's person-override sha check and newest-override pick had no test; both mutations now fail tests, and a shared reads vector covers the pick.
round 1, fixed: the Unicode refusal on any counted comment; it is narrowed and now names the post and the way out.
round 1, fixed: lost records, the order of the two reads, and the pr: null doc.
round 1, fixed: a report with no findings section counted as done in enforce; the merge-path minors are fixed as well (shared reads vectors replayed on both sides).
blocker: none
major: none

follow-up:
minor: the lens part of the cap count has no test. Removing the key match at apps/server/src/fork/reviewRules/lensStart.ts:780 leaves 67/67. The test comment at lensStart.test.ts:1214 says another lens has its own count, but no assertion checks it. If that line broke, one lens's dead children would cap another lens on the same PR. That fails closed (a person looks), so this is only a test gap. Suggest dead code children at the cap and a state lens that still starts.
minor: the NFKC and case part of the Unicode check has no test (pyText.ts:45-49). Dropping it leaves 67/67, and on Unicode 17 it is the only thing that refuses U+1CCD6 to U+1CCEF. The TS fold applies NFKC (findings.ts:65), so without that part a report line starting with U+1CCE2 then ajor: would read as a major finding in T3 and as nothing in the gate. Suggest a unicode vector with U+1CCE2 whose refused lists it.
minor: no test has a batch whose PRs have different counts. Taking the smallest count over the batch instead of the largest (lensStart.ts:806) leaves 67/67. Only the attempt number and id change: the per-PR cap and the skip of ended ids still hold.

🤖 Generated with Claude Code

@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: lens agent (Opus 5.5) · read at: e2252e5
verdict: safe to merge
covered: the fix commit 9814f4f (lensStart.ts, lensComment.ts, pyText.ts, the TS tests, vectors.testkit.ts, review.vectors.json, review_judge.test.py, the pr-queue README) and the merge of main, against the round-1 code, merge-path and state comments, the PR body's per-finding status, issues #799 and #841, and the gate's own lens_reads, head_check.review_rounds and review_judge.judge_rounds / fold.
checks: vp test run src/fork/reviewRules/ 67/67; review_judge.test.py 56 OK, lens.test.py 80 OK, head_check.test.py 262 OK (1 skip). None of the PR's changed test files opens a socket, so nothing was skipped for blocked loopback. 18 TS mutations, one at a time: 13 fail a test, 5 survive (2 equivalent; the other 3 below). 3 gate mutations (person override for any sha, no "no findings section" rule, no UNREAD) each fail the Python replay of the new reads vectors, and the same rules mutated on the TS side fail the TS replay, so both sides really run that section. A Node (Unicode 17) sweep over the code points Python 3.12 (Unicode 15.0) leaves unassigned: the narrowed check lets through 835 (808 So, 13 Po, 12 Sm, 1 Sc, 1 Pd), none of them in any decomposition and none composing, and the only rule classes the TS side reads (L, N, Nd, Cf, its whitespace set) never match them, so letting them through cannot change a read. A probe of HTML number references (below).
state: runs again: the plan is pure and ids are deterministic per lens, PRs, heads and attempt; a running child is matched per lens + PR + head and returned. Stops half-way: ended children are now counted per (lens key, PR, head) in whatever batch they ran, so a new, larger or shrunk batch does not reset the count; a capped PR is refused on its own and the rest start at one more than their highest count. Lost records: a start never reuses an ended id, so each lost record allows exactly one more start at that head (tested: 2 and 3 known gives 4). New head: starts at 1, by design. Old or empty state: no children gives attempt 1; posts with no time sort oldest by list place.
round 1, fixed: the restart cap per batch (state). Mutations matching per exact batch, dropping the head from the match, starting at attempt 1, > for >= and dropping the lost-record loop each fail "the attempt cap counts per lens, pull request and head".
round 1, fixed: the person's-override sha condition (code). Replacing it with true fails 2 tests, one of them the shared reads vector "a person's override for another change clears nothing".
round 1, fixed: the newest override's (when, index) pick (code). Taking the last listed fails 2 tests, one a shared reads vector.
round 1, fixed: enforce && block.findings untested (code). Dropping block.findings fails 2 tests.
round 1, fixed: an enforce report at the head with no findings section counted as done (merge-path). Dropping the rule fails 3 tests; the gate side's rule fails the Python replay.
round 1, fixed: the Unicode refusal on any counted comment, naming no post (all three lenses). Only code points a rule reads are refused now (an emoji vector proves the narrowing; refusing everything again fails 4 tests, refusing nothing fails 2), the error names the post, and dropping where fails the refusal-text test. repr escaping what Python leaves unassigned is pinned by a rounds vector.
round 1, fixed: hand-copied rules with no shared cases (merge-path): the reads section, replayed on both sides as above.
round 1, fixed: the doc and wording minors (children before posts, store what delegate_task returns, pr: null, "no read the gate counts", the pyText comments, non-ASCII linear vectors).
blocker: none
major: none
minor: follow-up. An HTML number reference gets past the Unicode check. fold (apps/server/src/fork/reviewRules/findings.ts:64-65) checks the raw text and then unescapes it, so the reference turns into the Unicode 16 letter after the check. Probe 1 below: the gate's read_findings gives one major and a findings section; TS readFindings gives no finding and no section, so postAgainKeys calls it "no findings section" and lens_start starts the lens again at the same head (up to the cap) while the gate holds the head for a major. Probe 2 reads clean in TS and holds a major in the gate. This is #799 point 1's own example, written as an entity. The Python gate still decides, so no head passes wrongly, but T5 should not rely on it as it is. Fix: run pyUnicodeCheck on the unescaped text inside fold too, and add unicode vectors for both probes.
minor: follow-up. Two branches of readsOtherwise have no case, so tests stay green without them (apps/server/src/fork/reviewRules/pyText.ts:38-49). Dropping the NFKC clause lets the 26 Unicode 16 OUTLINED LATIN letters (U+1CCD6 and on, category So) through; TS folds them to ASCII letters while Python leaves them alone, so an outlined label reads as a finding on one side only. Dropping \p{M} lets the 93 new marks through. Add a unicode vector for each (U+1CCD6 refused, a new mark refused). The \p{Z} branch matches nothing new on this Node (equivalent for now), and PAST_SAFE back at U+0378 is equivalent (U+0370-0377 are assigned on both sides).
minor: follow-up. Replacing said.length === 0 && !section with !section (lensStart.ts:310) leaves 67/67 green. Then a report with a major and no blocker: line starts the lens again at the same head, though the gate wants a fixed head. Add a reads vector for that kind of report.
minor: follow-up. endedAt (lensStart.ts:775-785) counts every ended child at a head, including ones whose read counted. A head that comes back (A, then B, then A again after a force-push) counts the earlier good reads of A, and the note says they "ended with no read the gate counts". It is rare and fails closed (a person looks after 3).

probe 1 (a lens report body after its header):
blocker: none
&#x1C89;major: the bug

probe 2:
blocker: none
major: none
&#x1C89;major: the bug

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit 251a347 into main Nov 22, 2026
40 checks passed
scuttletoby added a commit that referenced this pull request Nov 22, 2026
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>
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