Skip to content

test(engine): build a true live-gate-vs-predicted-gate cross-check#5529

Merged
JSONbored merged 2 commits into
mainfrom
test/live-gate-predicted-gate-crosscheck-4257
Jul 13, 2026
Merged

test(engine): build a true live-gate-vs-predicted-gate cross-check#5529
JSONbored merged 2 commits into
mainfrom
test/live-gate-predicted-gate-crosscheck-4257

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • test/contract/engine-parity.test.ts is a SELF-consistency regression detector: it diffs buildPredictedGateVerdict'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, 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 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 — see PREDICTED_GATE_NOTE_SLOP).
  • What this catches that the existing self-consistency suite can't: (1) behavioral drift between the two hand-maintained gate-decision twins (src/rules/advisory.tspackages/gittensory-engine/src/advisory/gate-advisory.ts) — scripts/check-engine-parity.ts only checks these for 4 marker-string presence, explicitly noting they're "deliberately maintained as structurally divergent implementations"; (2) drift between gateCheckPolicy'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.
  • 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.

Verification the harness has real teeth

Ran a mutation test before committing: deliberately broke one derivation (requireLinkedIssue, forced to always false). 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

  • All 14 fixtures pass on the real (non-mutated) implementation — the live gate and predicted-gate genuinely agree for every scenario currently covered
  • npm run test:coverage (full suite) — 799 files / 15524 tests passing, 0 regressions
  • npm run test:live-gate-parity standalone
  • npx tsc --noEmit clean
  • npm run docs:drift-check && npm run manifest:drift-check && npm run engine-parity:drift-check && npm run command-reference:check
  • npm audit --audit-level=moderate — 0 vulnerabilities

Closes #4257

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.90%. Comparing base (f0b1840) to head (407a44f).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
shard-1 44.22% <ø> (ø)
shard-2 35.78% <ø> (+0.32%) ⬆️
shard-3 32.14% <ø> (+<0.01%) ⬆️
shard-4 31.15% <ø> (ø)
shard-5 32.93% <ø> (ø)
shard-6 44.18% <ø> (ø)

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

gittensory-orb Bot commented Jul 13, 2026

Copy link
Copy Markdown

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-13 04:41:21 UTC

4 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a new contract test (`test/contract/live-gate-parity.test.ts`) that replays the 14 existing predicted-gate fixtures through both `buildPredictedGateVerdict` (engine package) and a new `buildLiveGateVerdict` harness that calls the ROOT src twin (`buildPullRequestAdvisory`/`evaluateGateCheck` from `src/rules/advisory.ts`) via the real `gateCheckPolicy`/`resolveEffectiveSettings` path, asserting the two gate decisions agree. It's wired into `test:ci` via a new `test:live-gate-parity` script and documented in the contributing skill files. The approach is sound and closes a real gap (self-consistency vs. cross-twin drift), reuses fixtures rather than fabricating new ones, and the harness's simplifications (reusing `predicted.readinessScore`/`confirmedContributor`, changedLineCount hardcoded to 0, no live check-run) are explicitly justified in comments as deliberate, in-scope boundaries rather than hidden gaps.

Blockers

  • test/contract/live-gate-parity.test.ts:46 imports `buildPredictedGateVerdict` from `../../src/rules/predicted-gate`, so this does not exercise `packages/gittensory-engine/src/predicted-gate.ts` and cannot catch the package-vs-live drift described by the PR; change the predicted-side import to the engine package source/export, e.g. `import { buildPredictedGateVerdict } from "../../packages/gittensory-engine/src/predicted-gate";`, or explain why the root module is a guaranteed package re-export.
Nits — 6 non-blocking
  • The harness hardcodes `changedLineCount: 0` in the `gateCheckPolicy` call (live-gate-parity.test.ts around the policy invocation); if any of the 14 fixtures' gate mode logic keys off line-count thresholds this could mask a real live/predicted divergence — worth a comment confirming none of the current fixtures exercise that branch.
  • `NO_DB_OVERRIDES` is cast via `{} as unknown as RepositorySettings` (live-gate-parity.test.ts) — an unsafe cast that bypasses type-checking; a `Partial<RepositorySettings>` with an actual empty-defaults helper (if one exists) would be safer, though this is test-only code.
  • The block comment above `buildLiveGateVerdict` is very long (40+ lines) — consider trimming to the essential rationale and moving deep design notes to the PR description or an issue comment for long-term maintainability.
  • Add a short comment or assertion documenting which specific policy-relevant field (e.g. changedLineCount) is intentionally stubbed to 0 across all fixtures, so a future contributor adding a line-count-sensitive fixture doesn't silently get a false pass.
  • Consider extracting the `NO_DB_OVERRIDES` cast into a shared test helper (e.g. `test/helpers/settings.ts`) if this pattern is likely to be reused by other contract tests.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4257
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), 36 merged, 399 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 44 PR(s), 399 issue(s).
Gate result ✅ Passing No configured blocker found.
Improvement ⚠️ ℹ️ Insufficient signal risk: clean · value: insufficient-signal — Nothing measurable for the structural-improvement analyzers on this PR (e.g. no code files changed).
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • 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), 399 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
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.
[BETA] Chat with Gittensory

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

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

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.

  • Re-run Gittensory review

@gittensory-orb gittensory-orb Bot added the manual-review Gittensor contributor context label Jul 13, 2026
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.
@JSONbored JSONbored force-pushed the test/live-gate-predicted-gate-crosscheck-4257 branch from e909028 to 407a44f Compare July 13, 2026 04:42
@JSONbored JSONbored merged commit de9e07a into main Jul 13, 2026
6 checks passed
@JSONbored JSONbored deleted the test/live-gate-predicted-gate-crosscheck-4257 branch July 13, 2026 04:43
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. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(engine): build a true live-gate-vs-predicted-gate cross-check

1 participant