Skip to content

test(console): pin long-name lookarounds and warm the rule before timing it - #2951

Merged
freeqaz merged 2 commits into
mainfrom
fix-1019d-names
Oct 19, 2026
Merged

freeqaz merged 2 commits into
mainfrom
fix-1019d-names

Conversation

@freeqaz

@freeqaz freeqaz commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Two gaps in tests/conformance/console-agent-name-runs.test.mjs (bughunt findings 2037 and 2038, follow-up to #2945):

  • 2037: the shape checks drop every lookaround before checking an alternative, so slow backtracking inside a lookahead is not pinned. The equivalent mutant list.mjs:284 -(?=\p{M}*[…]) -> -(?=(?:\p{M}+)*[…]) matches the same names, passes all 21 cases, and takes seconds on a- + 25 combining marks + x (0.03 ms on main). No timing name had a run of marks after a break character.
  • 2038: the 50 ms bound includes the rule's first build (about 6 ms idle, up to 40 ms on a loaded runner) and its tier-up compile on the second call (about 1 ms idle). Checks and Conformance 1 runs eight files at once, so a busy runner leaves little margin on a linear rule.

Change

Test-only; no product code changes.

  • New test: each lookaround body's branches must be one class or escape after at most one \p{M}*, or ^. splitLookarounds now returns the lookaround bodies along with the kept source. withoutLookarounds and the overlap check behave as before.
  • Five timing names put 25 combining marks after a hyphen (after an ASCII and after an accented letter, which reach different alternatives), an en dash, a thin space and an ideograph.
  • The rule runs three times before any case is timed. A call over 50 ms is retried twice and the fastest call counts. A linear rule is about 0.1 ms per name; a blowup is slow every time, so it still fails by seconds. The retry costs extra only when a call is already over the bound.

Verification

  • node --test tests/conformance/console-agent-name-runs.test.mjs: 27/27; 20/20 pinned to 2 CPUs (taskset -c 2,3).

  • Under load (7 busy threads on the same single CPU): passes 3/3, slowest case about 25 ms including harness overhead.

  • Mutants (\p{M}* -> (?:\p{M}+)* in each lookahead):

    mutant main's test file this PR
    list.mjs:284 (hyphen before closing) 21/21 pass fails: lookaround shape + both hyphen timing names (0.6 to 4 s per call)
    list.mjs:288 (hyphen before digit, no ASCII before) 21/21 pass fails: shape + accented-letter hyphen timing name
    list.mjs:289 (hyphen before digit after ASCII) n/a fails: shape + hyphen timing name
    list.mjs:292 (wide space or dash) n/a fails: shape + en dash and thin space timing names
    list.mjs:305 (ideograph before joiner) n/a fails: shape + ideograph timing name
  • Probe at 2 CPUs: calls 1 to 3 take 6.0, 1.0 and 0.09 ms. The warm-up covers both the build and the tier-up compile.

  • prettier --check and eslint --max-warnings 0 on the touched file: clean.

  • No open PR touches this test file, so it adds no new conflicts.

  • Internal review: approve. Its nits are applied: the comments now state the measured costs.

Risks

Low; test-only. The new shape test refuses a future lookaround that holds a group or several mark runs. Such a rule change has to restate the bound in this test, which is intended.

…ing it

The shape checks dropped lookaround bodies, so a nested quantifier inside a
lookahead (\p{M}* -> (?:\p{M}+)*) matched the same names, passed every case
and took seconds on a 28-character name (finding 2037). Each lookaround
branch must now be one class or escape after at most one run of marks, and
five timing names put 25 combining marks after a hyphen, an en dash, a thin
space and an ideograph.

The 50 ms bound also timed the rule's first build and its tier-up compile
(finding 2038). The rule now runs three times before any case is timed, and
a call over the bound is retried twice, the fastest counting, so a stalled
runner cannot flake a linear rule while a blowup still fails by seconds.
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@freeqaz
freeqaz requested a review from a team as a code owner October 19, 2026 17:18
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: test(console): pin long-name lookarounds and warm the rule before timing it This is item 1/1 in the current shard. Shard 0/1.

This temporary status tracks the active review worker. The completed review will appear in the durable ClawSweeper review comment.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 19, 2026
Review nit: the mutant costs 0.6 to 4 s on the new names and a linear
call about 0.1 ms, not the 8.7 s and 1 ms the comments said.
@freeqaz

freeqaz commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR checks long-name regex lookaround structure, adds five combining-mark timing cases, and warms the matcher before measuring it.

Example: A developer changes a lookahead to use nested combining-mark quantifiers.

  • Before: The existing checks can miss the resulting backtracking.
  • After: The new structure assertion and targeted timing cases detect it.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, useful test coverage with no identified defect; validation is in-process and CI-based rather than shipped-entry-point proof.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored test-only PR changes no shipped behavior; its reported mutation and load checks exercise the real classifier in process, supported by exact-head CI.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: A future regex regression could freeze the Agents list while passing existing tests, and cold matcher compilation can consume timing-test headroom.
Reason: The collaborator-authored direction extends established regression defenses with specific mutation evidence and no new production surface.

Merge readiness

✅ Ready for maintainer review

This PR adds useful regression coverage without changing product behavior; no actionable defect was found, and required CI passes for the reviewed head.

Priority: P3
Reviewed head: a775bcb0adbd63800f031f3c4a17c61b4fae99da

Before merge

None.

Findings

None.

Agent review details

How this fits together

The console classifies Agent names before rendering links; the conformance suite exercises that production classifier and checks its regex structure and execution time.

flowchart LR
  A[Agent names] --> B[Agents list renderer]
  B --> C[Long-name classifier]
  C --> D[Wrapping class]
  E[Conformance cases] --> C
  E --> F[Structure and timing assertions]
Loading

Technical review

Best possible solution:

Retain the focused lookaround guards and targeted timing cases alongside the existing overlap checks.

Do we have a high-confidence way to reproduce the issue?

Source inspection confirms that current-main structure checks discard lookaround bodies and lack the five new timing inputs; the PR reports mutation comparisons, which this read-only review did not execute.

Is this the best way to solve the issue?

The change extends the existing test owner, preserves production behavior, and combines deterministic structural rejection with timing coverage for distinct lookahead paths.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7144acebd52a.

Provenance checked

  • Timing coverage and bound changes intended behavior with a stated reason (e7c2e6b: Detect the exponential joiner-run backtracking that froze list rendering and search.)
  • Lookaround stripping for overlap analysis keeps the original intent (def1817: Widen alternatives before comparing their matching character sets.)
  • Single-atom structural assertions keeps the original intent (067655e: Reject internal branches and multi-character alternatives that evade overlap analysis.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Free Wortley: Raw commit 067655e adds tests/conformance/console-agent-name-runs.test.mjs:188 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 067655ee1fa4; files: tests/conformance/console-agent-name-runs.test.mjs)

Labels

Label changes:

  • add P3: This is focused test maintenance protecting an already-fixed console performance problem.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is focused test maintenance protecting an already-fixed console performance problem.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 1:55 PM ET / 17:55 UTC.

@freeqaz
freeqaz merged commit d80e9a8 into main Oct 19, 2026
59 of 62 checks passed
@freeqaz
freeqaz deleted the fix-1019d-names branch October 19, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant