fix: clear the polynomial-redos class across main - #1546
Conversation
Three sites of the same CodeQL js/polynomial-redos family: - packages/replay-test session-test-artifacts/-discovery slugs trimmed edge dashes with /^-+|-+$/g, which backtracks polynomially on long dash runs built from caller-supplied paths (alerts #27/#28). Replaced with a shared linear trimEdgeDashes. - src/replay/target-identity.ts's target-v1 annotation line regex had the \s+(.*) ambiguity (the shape flagged as alert #29 on the #1536 copy). Anchored the payload group on \S so the split point is unique; the only caller matches against trimmed lines, so behavior is unchanged. Adversarial regression test on the slug path (100k-char dash run, sub-second); the annotation-regex adversarial case is covered on the #1536 package copy and the frozen replay-compat corpus passes here unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Re-reviewed One blocking test-validity issue remains: the claimed adversarial test uses dashes only at the edges, which the old |
The edge-run input matched the old /^-+|-+$/g in one pass; the quadratic case is an interior run (each dash restarts a -+$ attempt that fails at the trailing byte). The slug pipeline collapses runs before trimming, so the test targets trimEdgeDashes directly and asserts the input comes back byte-identical. Co-Authored-By: Claude <noreply@anthropic.com>
|
Fixed in Generated by Claude Code |
|
Re-reviewed exact head
Please rerun the exact-head gates after those changes. |
Co-Authored-By: Claude <noreply@anthropic.com>
|
Both blockers addressed at Errata on my own process, in the spirit of this review thread: the first push of this commit carried a red version of the new test (my initial artifact-slug input wasn't actually all-dash after slugging — it returned Generated by Claude Code |
Artifact slug falls back to 'test', invocation id to 'suite', and a session-name slug that trims to nothing is omitted without a dangling separator. Co-Authored-By: Claude <noreply@anthropic.com>
c1d16b7 to
2ae86d9
Compare
|
Re-review at |
|
You flagged that the CodeQL finding on #1536 exists elsewhere already — correct, and this clears the whole class on main in one small PR:
packages/replay-testslug builders, from the merged refactor(replay-test): extract packages/replay-test (#1478 P3b) #1525):/^-+|-+$/gedge-trim backtracks polynomially on long dash runs derived from caller-supplied file paths/request ids. Replaced with a shared lineartrimEdgeDashes(no import cycle; discovery already sits above artifacts).src/replay/target-identity.ts:16) — the identical\s+(.*)ambiguity that alert fix: iOS snapshot not showing password fields #29 flagged on refactor: extract the .ad script codec into packages/ad-script (#1478) #1536's moved copy. Same fix as there: anchor the payload on\Sso the split point is unique. Behavior-preserving (the only caller matches trimmed lines); when refactor: extract the .ad script codec into packages/ad-script (#1478) #1536 rebases, its already-fixed package copy supersedes this file wholesale, so no conflict of substance.Gates: typecheck, lint, format,
check:replay-compat(frozen corpus unchanged), fallow zero at main scope; 45/45 in the touched suites plus a 100k-char adversarial slug test asserting sub-second completion.Refs #1478