Skip to content

test(engine): add predicted-gate golden parity runner (#2286) - #3687

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
kiannidev:test/engine-parity-golden-2286
Jul 6, 2026
Merged

test(engine): add predicted-gate golden parity runner (#2286)#3687
JSONbored merged 1 commit into
JSONbored:mainfrom
kiannidev:test/engine-parity-golden-2286

Conversation

@kiannidev

Copy link
Copy Markdown
Contributor

Summary

  • Add committed golden JSON snapshots for every test/fixtures/engine-parity/predicted-gate/ scenario.
  • Add test/contract/engine-parity.test.ts asserting buildPredictedGateVerdict (via src/rules/predicted-gate.ts) matches goldens byte-for-byte.
  • Add npm run test:engine-parity and wire it into test:ci.
  • Add scripts/record-engine-parity-goldens.ts for intentional golden refreshes.

Closes #2286

Conflict avoidance

Touches only test/contract/, test/fixtures/engine-parity/, scripts/record-engine-parity-goldens.ts, and package.json. No overlap with open PRs #3671, #3685, or #3686.

Test plan

  • npm run test:engine-parity (9 tests)
  • npm run typecheck

Made with Cursor

Commit golden snapshots for every predicted-gate fixture and assert the
public re-export surface stays byte-identical in CI via test:engine-parity.

Co-authored-by: Cursor <cursoragent@cursor.com>
@kiannidev
kiannidev requested a review from JSONbored as a code owner July 6, 2026 03:58
@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 6, 2026
@loopover-orb

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-06 04:10:56 UTC

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

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): package.json (matched package.json), package.json (matched **/package.json).

Review summary
This PR adds a golden-snapshot regression suite for buildPredictedGateVerdict: 8 committed golden JSON outputs, a vitest parity test that compares live output via toEqual, a recorder script for intentional refreshes, and wiring into test:ci. The mechanics are sound — the recorder and test consume identical fixture data and call the same function with the same argument shape, and the meta-test verifying golden/scenario file-count parity is a nice touch to catch drift when fixtures are added without a golden. One caveat worth flagging: this only guards against future silent drift in buildPredictedGateVerdict's output, not "parity between two implementations" (e.g. extracted vs. original) — worth confirming that's actually what issue #2286 asked for.

Nits — 6 non-blocking
  • The PR description calls this a 'byte-for-byte' comparison, but test/contract/engine-parity.test.ts:44 uses `expect(verdict).toEqual(golden)`, which is a structural deep-equal that ignores key ordering — harmless here but the wording overstates what's actually checked.
  • test:engine-parity (package.json) runs test/contract/engine-parity.test.ts as its own test:ci step even though test:coverage's default vitest run likely already picks up files under test/contract/, so the suite runs twice per CI pass — matches the existing test:upstream-contract precedent, so not a new pattern, but still worth a comment noting why the duplication is intentional.
  • The external IaC scan flagging a 'hardcoded service URL' in clean-pass-oss-anti-slop.json:13 is a false positive — that's a captured golden value of an existing funnel.registerUrl field already emitted by production code, not a new config injection point.
  • Confirm in the PR body that issue test(miner-foundation): engine-parity regression runner (assert extracted === original) #2286 is asking for golden-snapshot drift detection (what's built) rather than a live extracted-vs-original engine comparison, since the linked-issue coverage note suggests the original ask may have been for the latter.
  • Consider adding a one-line comment in record-engine-parity-goldens.ts warning that re-running it silently overwrites goldens for any behavior change, intentional or not — the test suite alone won't catch a golden that was regenerated to mask a regression.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2286
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 ❌ 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: 1478 registered-repo PR(s), 770 merged, 48 issue(s).
Contributor context ✅ Confirmed Gittensor contributor kiannidev; Gittensor profile; 1478 PR(s), 48 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: kiannidev
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: TypeScript, MDX, C++, HTML, Rust
  • Official Gittensor activity: 1478 PR(s), 48 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.34%. Comparing base (ddf68c3) to head (d4d7f4e).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3687   +/-   ##
=======================================
  Coverage   93.34%   93.34%           
=======================================
  Files         315      315           
  Lines       32107    32107           
  Branches    11769    11769           
=======================================
  Hits        29969    29969           
  Misses       1507     1507           
  Partials      631      631           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit b39d174 into JSONbored:main Jul 6, 2026
8 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. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

test(miner-foundation): engine-parity regression runner (assert extracted === original)

2 participants