Skip to content

fix(engine): sync gate-advisory CHECK_RUN_FORBIDDEN_TERMS with its host twin and diff regex bodies in CI - #8719

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-8697
Jul 26, 2026
Merged

fix(engine): sync gate-advisory CHECK_RUN_FORBIDDEN_TERMS with its host twin and diff regex bodies in CI#8719
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-8697

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(engine): sync gate-advisory CHECK_RUN_FORBIDDEN_TERMS with its host twin and diff regex bodies in CI

The engine copy's CHECK_RUN_FORBIDDEN_TERMS regex had silently dropped the
likely_duplicate and reviewability\s*\d alternatives its host twin in
src/rules/advisory.ts carries, so sanitizeForCheckRun would leak those terms
into a public check-run for any direct consumer of evaluateGateCheck. The
existing guard (checkGateDecisionVersionBump / GATE_DECISION_CORE_MARKERS) only
enforced function-name presence, never the regex body itself, so the drift went
undetected despite both files' comments claiming byte-identical enforcement.

  • Restore the two missing alternatives so the two copies are byte-identical.
  • Add checkGateDecisionForbiddenTermsParity to scripts/check-engine-parity.ts,
    which extracts and diffs the actual regex literal of both twins and wires into
    runEngineParityChecks so a future body divergence fails CI immediately.
  • Cover the newly-redacted terms through sanitizeForCheckRun/evaluateGateCheck
    and the strengthened drift check's failure path (including a synthetic
    divergence fixture mirroring the marker-presence test pattern).

Closes #8697

…st twin and diff regex bodies in CI

The engine copy's CHECK_RUN_FORBIDDEN_TERMS regex had silently dropped the
likely_duplicate and reviewability\s*\d alternatives its host twin in
src/rules/advisory.ts carries, so sanitizeForCheckRun would leak those terms
into a public check-run for any direct consumer of evaluateGateCheck. The
existing guard (checkGateDecisionVersionBump / GATE_DECISION_CORE_MARKERS) only
enforced function-name presence, never the regex body itself, so the drift went
undetected despite both files' comments claiming byte-identical enforcement.

- Restore the two missing alternatives so the two copies are byte-identical.
- Add checkGateDecisionForbiddenTermsParity to scripts/check-engine-parity.ts,
  which extracts and diffs the actual regex literal of both twins and wires into
  runEngineParityChecks so a future body divergence fails CI immediately.
- Cover the newly-redacted terms through sanitizeForCheckRun/evaluateGateCheck
  and the strengthened drift check's failure path (including a synthetic
  divergence fixture mirroring the marker-presence test pattern).

Closes JSONbored#8697
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 26, 2026 00:45
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.79%. Comparing base (44f4ee9) to head (6df733d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8719   +/-   ##
=======================================
  Coverage   93.79%   93.79%           
=======================================
  Files         797      797           
  Lines       79477    79477           
  Branches    24078    24078           
=======================================
  Hits        74542    74542           
  Misses       3563     3563           
  Partials     1372     1372           
Flag Coverage Δ
backend 95.06% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ages/loopover-engine/src/advisory/gate-advisory.ts 97.56% <100.00%> (ø)
src/rules/advisory.ts 98.13% <ø> (ø)

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

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 01:02:51 UTC

5 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · unknown

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 4 non-blocking
  • scripts/check-engine-parity.ts: `extractForbiddenTermsRegex` finds the const declaration via a plain `indexOf`, so if the regex body itself ever legitimately contained the literal substring `const CHECK_RUN_FORBIDDEN_TERMS =` (extremely unlikely but worth a comment) the scan would still work correctly by construction since it only looks *after* the match — no actual bug, just worth a one-line note on why a naive `indexOf` is safe here.
  • packages/loopover-engine/src/advisory/gate-advisory.ts and scripts/check-engine-parity.ts are both already long files per the size-smell scan, but this diff's net addition (+64/-0, +6/-4) is small relative to the existing size, so it's not this PR's problem to fix.
  • test/unit/check-engine-parity-script.test.ts: the 'passes against the real repo' test (`checkGateDecisionForbiddenTermsParity({ root: process.cwd() })`) is a nice end-to-end sanity check but is redundant with the synthetic fixture tests and could drift if the real files' formatting changes in unrelated ways — low risk, just flagging for awareness.
  • Consider whether `extractForbiddenTermsRegex`'s single-regex-literal assumption (first `/…/flags` after the const) needs a bound like the sibling `RAW_CONTEXT_MAX_DIFF_CHARS` pattern elsewhere in this codebase, in case a future regex body legitimately contains an unescaped-looking sequence — not required now since the literal syntax is well-formed today.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8697
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 44 registered-repo PR(s), 28 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 44 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 44 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver 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.

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

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.

fix(engine): gate-advisory.ts's CHECK_RUN_FORBIDDEN_TERMS has silently drifted from its host twin, missing two redaction terms

1 participant