test(engine): build a true live-gate-vs-predicted-gate cross-check#5529
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5529 +/- ##
=======================================
Coverage 94.90% 94.90%
=======================================
Files 569 569
Lines 45260 45260
Branches 14675 14675
=======================================
Hits 42955 42955
Misses 1571 1571
Partials 734 734
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-13 04:41:21 UTC
✅ Suggested Action - Approve/Merge
Review summary Blockers
Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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.
|
test/contract/engine-parity.test.ts is a SELF-consistency regression detector: it diffs buildPredictedGateVerdict's output against committed golden fixtures, catching "predicted-gate's output silently changed." It never verifies predicted-gate's output still agrees with what the REAL live gate (src/queue/processors.ts, via gateCheckPolicy + buildPullRequestAdvisory + evaluateGateCheck) would decide for the same PR -- the actual "byte-parity" promise gittensory-engine exists for. This suite closes that gap without a live GitHub/DB round-trip: it replays each of the same 14 predicted-gate fixtures through both buildPredictedGateVerdict (which uses the ENGINE package's own advisory/gate-advisory.ts) and a new buildLiveGateVerdict harness that mirrors predicted-gate's assembly steps but resolves the gate-check policy via the REAL production path -- resolveEffectiveSettings + gateCheckPolicy -- feeding the ROOT src twin (src/rules/advisory.ts) that src/queue/processors.ts actually calls for a real PR. Comparing the final evaluateGateCheck decision (not raw policy args) avoids false mismatches from documented pre-submission-only omissions (slop/AI/lockfile gates, which need diff content this metadata-only predictor never receives). Verified the harness has real teeth via a mutation test: deliberately breaking one derivation (requireLinkedIssue) made exactly the two fixtures that depend on it fail, while the other 12 stayed green -- reverted before committing. Wired into test:ci alongside test:engine-parity via a new test:live-gate-parity script; updated the contributor skill docs' test:ci step list and no-dedicated-CI-job table to match. Closes #4257
…ne package Review raised that importing buildPredictedGateVerdict via src/rules/predicted-gate.ts might not exercise packages/gittensory-engine/src/predicted-gate.ts. It does: the root module is a single-line `export *` re-export (a live ES-module alias, not a copy) -- the same pattern engine-parity.test.ts already uses and documents. Verified with a mutation test (a real behavior change in the engine package's predicted-gate.ts breaks this suite through the import). Makes that guarantee explicit in the file's comments.
e909028 to
407a44f
Compare
Summary
test/contract/engine-parity.test.tsis a SELF-consistency regression detector: it diffsbuildPredictedGateVerdict's output against committed golden fixtures. It never verifies predicted-gate's output still agrees with what the REAL live gate (src/queue/processors.ts, viagateCheckPolicy+buildPullRequestAdvisory+evaluateGateCheck) would decide for the same PR — the actual "byte-parity" promisegittensory-engineexists for.buildPredictedGateVerdict(which uses the ENGINE package's ownadvisory/gate-advisory.ts) and a newbuildLiveGateVerdictharness that mirrors predicted-gate's assembly steps but resolves the gate-check policy via the REAL production path —resolveEffectiveSettings+gateCheckPolicy— feeding the ROOT src twin (src/rules/advisory.ts) thatsrc/queue/processors.tsactually calls for a real PR.evaluateGateCheckdecision (not raw policy args objects) avoids false mismatches from documented, intentional pre-submission-only omissions (slop/AI/lockfile gates, which need diff content this metadata-only predictor never receives — seePREDICTED_GATE_NOTE_SLOP).src/rules/advisory.ts↔packages/gittensory-engine/src/advisory/gate-advisory.ts) —scripts/check-engine-parity.tsonly checks these for 4 marker-string presence, explicitly noting they're "deliberately maintained as structurally divergent implementations"; (2) drift betweengateCheckPolicy's DB-settings-based policy mapping and predicted-gate's inline manifest-based mapping — two independent hand-written config→args translations that could silently diverge.test:cialongsidetest:engine-parityvia a newtest:live-gate-parityscript; updated the contributor skill docs'test:cistep list and no-dedicated-CI-job table to match.Verification the harness has real teeth
Ran a mutation test before committing: deliberately broke one derivation (
requireLinkedIssue, forced to alwaysfalse). Exactly the two fixtures whose scenario depends on it (missing-linked-issue-block,merge-readiness-composite-block) failed, while the other 12 stayed green — confirming the suite genuinely exercises the comparison rather than trivially passing. Reverted before committing (not part of the diff).Test plan
npm run test:coverage(full suite) — 799 files / 15524 tests passing, 0 regressionsnpm run test:live-gate-paritystandalonenpx tsc --noEmitcleannpm run docs:drift-check && npm run manifest:drift-check && npm run engine-parity:drift-check && npm run command-reference:checknpm audit --audit-level=moderate— 0 vulnerabilitiesCloses #4257