Skip to content

test(enrichment): cover redos {n,} quantifier and escape branches - #3389

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
dhgoal:test/redos-coverage
Jul 5, 2026
Merged

test(enrichment): cover redos {n,} quantifier and escape branches#3389
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
dhgoal:test/redos-coverage

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Hardens unit coverage for the redos analyzer's hasCatastrophicBacktracking state machine, whose single existing test only uses +/* quantifiers and never exercises two real branches:

  • The {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.
  • Escape (\\) 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

  • Conventional Commit; focused; touches only review-enrichment/test/redos.test.ts. No site//CNAME/**/lovable/**; no CHANGELOG.md.

Validation

  • npm --prefix review-enrichment test970 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 --check clean.

Safety

  • Test-only, no runtime change. No secrets/wallets/hotkeys/trust/reward terms.

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.
@dhgoal
dhgoal requested a review from JSONbored as a code owner July 5, 2026 06:00
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 5, 2026
@loopover-orb

loopover-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 05:59:47 UTC

1 file · 1 AI reviewer · no blockers · readiness 80/100 · CI green · clean

⏸️ Suggested Action - Manual Review

Review summary
This is a focused test-only change that adds real coverage for two redos state-machine branches: open-ended `{n,}` quantifiers inside an outer quantified group, and escaped grouping/quantifier characters. The new assertions are consistent with the existing compiled-dist test convention in this file and do not change runtime behavior. I do not see a reachable correctness defect in the diff.

Nits — 2 non-blocking
  • nit: review-enrichment/test/redos.test.ts:41 uses an all-caps word in the comment (`BOUNDED`) where the surrounding tests use normal prose; lowercasing it would keep the file tone consistent.
  • review-enrichment/test/redos.test.ts:43 could pass the pattern as the assertion message, matching the existing loop above and making any future failure easier to identify: `assert.equal(hasCatastrophicBacktracking("(a{2,})+"), true, "(a{2,})+");`.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ No-issue rationale PR body explains why no issue is linked.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 69 registered-repo PR(s), 42 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor dhgoal; Gittensor profile; 69 PR(s), 0 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: dhgoal
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 69 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 708d141 into JSONbored:main Jul 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant