test(enrichment): cover redos {n,} quantifier and escape branches - #3389
Conversation
hasCatastrophicBacktracking's single existing test only used `+`/`*`. Adds the
uncovered branches: an open-ended `{2,}` inside a quantified group is
catastrophic while a bounded `{2,3}` is not, and escaped parens/quantifiers
(`\(a+\)+`, `(a\+)+`) are literals, not structure. Test-only.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 05:59:47 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Hardens unit coverage for the
redosanalyzer'shasCatastrophicBacktrackingstate machine, whose single existing test only uses+/*quantifiers and never exercises two real branches:{n,}unbounded-quantifier branch (unboundedQuantifierAt's{case):(a{2,})+is catastrophic (open-ended{2,}inside a quantified group), while a bounded(a{2,3})+is not.\\) handling:\(a+\)+has escaped parens — no real group, so not catastrophic; and(a\+)+'s inner\+is an escaped literal, not a quantifier, so it's linear.Test-only, against the compiled
dist/, in the analyzer's own test file. No source or shared-registry change.No linked issue — edge/branch coverage hardening of a pure function; no runtime behavior change.
Scope
review-enrichment/test/redos.test.ts. Nosite//CNAME/**/lovable/**; noCHANGELOG.md.Validation
npm --prefix review-enrichment test— 970 pass / 0 fail (build + sourcemap validate +metadata --check+ node tests; exactly CI). The 4 new assertions were traced against the state machine and confirmed.git diff --checkclean.Safety