Repository navigation
fix(pr-queue): lens rules follow-ups from #283's lenses (#303) - #591
Conversation
- no_lens_text: the <, >, [ and ] one clean pass leaves become blanks, so nested markup in a quoted comment cannot turn into a lens field when the reader cleans it again; keep_markdown checks both readings. - Fences follow GFM: a line with an info string no longer closes a fence, and a backtick line with another backtick after it opens none (plain_lines and unquoted_lines share fence_step). - A second header below a valid one counts in the forms `lens —`, `lens –` and `lens=` too (not `LENS = '...'`, test code in reports). - README: in a fix-round comment, a sha goes on its own line; a quote does not help a lens field. The queue's advice says so. - Tests for the two round-1 mutation gaps (tab before `>`, fence kind and length). Fixes #303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
not a lens: review of #591, lens B (merge-path attack, state question), read-only The example lines below use SAFE (the code). No new way to fake a lens read or to hide a blocking lens: Blocking (merge only, not the code)
Major: none. Minor
Checked and fine
General vs project: all general pr-queue code, nothing project-specific. |
|
lens: merge-path A · reviewer: opus · read at: 0b6ee5b Verdict: SAFE for the lens rules. One item blocks the merge, and it is CI only: Lint is red (a one-line README format fix, details below). No finding fails open. Every new rule is stricter than main, or exactly as strict. Blocking
MajorNone. Minor
What I checked
|
…-block note (#591 lenses) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fix for the two lens reviews (#591 (comment), #591 (comment)), commit 6d0e969:
lens.test.py, pr_queue.test.py and pr_queue_laws.test.py pass. |
What and why
Follow-ups from the lenses on #283 (all minor; none was a regression). Each point of #303:
1. Nested markup cleaned twice.
no_lens_textcleans the text once, and the reader cleans the queue's comment again. With nested tags or links (lens<<a>b>= …,lens[[](z)](w)= …, alsoread<<a>b> at,safe<<a>b> to merge), the second pass made a lens field, so the queue's own turn-off comment was flagged. Now the<,>,[and]that one pass leaves become blanks before the rewrite, so another pass (either way of reading tags and links) changes nothing. A 20,000-case random test checks exactly that, and that the queue's comment stays clear.Also:
keep_markdown(the queue's own advice) now keeps the text as written only when both readings (narrow and not) hold no lens form. Before, only the wide reading was checked, so<lens= x 0123abcd99 <q></b>was kept although the narrow reading showslens=with a sha. The advice comes from the config, so this was not reachable from outside.2. A lens field and a sha on one line block for good. Doc fix, as the issue asks. The README now says that a
>quote does not help a lens field (only aread atline), and that in a fix-round comment each sha goes on a line of its own. It has a short fix-round template. The queue's advice (NO_HEADER_WAY_OUT) now also says "no sha on a line with a lens field". A test pins the README rule.3. Carried from round 1.
plain_linesandunquoted_linesnow share onefence_step). Only a line of the same character, at least as long, with nothing but blanks after it, closes a fence. So```jsinside an open fence is code. A backtick line with another backtick after it (```x```) is inline code, not a fence. Before, a fence line with an info string closed the fence, so a>line that GitHub shows as code was skipped as a quote. Inplain_linesit went both ways, for example a plainsafe to mergeline after a```pyline inside a fence was hidden as code.lens —,lens –orlens=(as well aslens:) and names a sha is a second header.=counts only when written right afterlens: the replay found a real skyrpg lens report whose test code saysLENS = 'lens: … read at: 1234567', and countingLENS =would have blocked it.~~~fence is not closed by a backtick line, afence is not closed by``` ````, and the other way round.Mutations (each run alone on
lens.test.py; all killed)\s*>)matchforfullmatch)<>/ only[]keep_markdownchecks the wide reading onlylens:only / no—/ no=/ no–=after blanks counts tooplain_lineswith the old fence ruleTests
New tests run against main's
lens.py: 29 failures and 7 errors (nested markup, the random clean-twice test, info-string fences,plain_linesfences, second headers, narrowkeep_markdown). Not red on main, by design: the tab and fence-kind tests (today's code was right; they hold it against the M9/M10 mutations) and the README-rule test.At this head:
lens.test.py78 OK,pr_queue.test.py389 OK,pr_queue_laws.test.py3 OK,review_config/review_glob/review_judgeOK,head_check.test.py199 OK (1 skipped),head_gate.test.py106 OK.Time stays linear: 64 KB backtick or blank runs, 16K fence lines and 64 KB of nested
<each take under 0.2 s forlens_problemplusno_lens_text.State question
The rules are pure functions of the comments: the same comments give the same answer.
recoverreads the comments again with these rules.leave_offwrites it) stays clear before and after.no_lens_text. Only one with nested markup around a lens field could read differently, and it was already flagged before (the bug); it stays flagged until deleted. Empty or missing: an empty body or no comments behave as before.Not changed
‒,―,−,:… stay open). Not a regression; it can be its own issue.# … lenscan still trip the heading rule in the queue's comment. The random test found it. It needs a gh error with a Markdown heading naming a lens on a later line, so I left it as is.>quote does not help a lens field.General vs project
All of this is general pr-queue code (
fork-ci/actions/pr-queue):lens.py, its tests and README. It applies to every project that uses the queue or the head gate (head-checkimportslens.py). The replay used this repository's and one project's PR comments as sample data only. Nothing project-specific was added.Fixes #303
🤖 Generated with Claude Code