feat(miner-foundation): extract predicted-gate types into gittensory-engine (#2276) - #3873
Conversation
…engine (JSONbored#2276) Move the PredictedGateVerdict/PredictedGateInput types and the predictedGateNote/ publicSafeFinding pure helpers out of src/rules/predicted-gate.ts into packages/gittensory-engine/src/predicted-gate.ts, re-exported from the engine barrel, so a miner can model its own predicted gate verdict locally with the same shapes the maintainer gate uses. This is the types-and-pure-helpers-first slice; buildPredictedGateVerdict itself follows in the keystone (JSONbored#2283). src/rules/predicted-gate.ts re-exports the two types and imports the helpers via the relative source path (../../packages/gittensory-engine/src/predicted-gate), matching this repo's existing engine-consumption convention (see src/scoring/preview.ts), so typecheck and test:coverage never depend on the engine's built dist/ that is not guaranteed present when they run in CI. The two small union shapes the surface needs (GatePolicyPack, GateCheckConclusion) are mirrored engine-side with src kept canonical, mirroring the scoring/types.ts convention. publicSafeFinding takes its redaction function as an argument so the engine stays isolated from src/github/commands' sanitizePublicComment; src binds the canonical sanitizer. The existing predicted-gate test suite passes unmodified.
|
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 #3873 +/- ##
=======================================
Coverage 93.54% 93.54%
=======================================
Files 337 338 +1
Lines 33334 33335 +1
Branches 12192 12192
=======================================
+ Hits 31181 31182 +1
Misses 1528 1528
Partials 625 625
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-06 23:10:33 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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.
|
Closes #2276
What
Moves the pure, dependency-light predicted-gate surface out of
src/rules/predicted-gate.tsinto a newpackages/gittensory-engine/src/predicted-gate.ts, re-exported from the engine barrel, so a miner can model its own "will my PR pass the gate?" verdict locally with the exact shapes the maintainer gate uses. This is the types-and-pure-helpers-first slice;buildPredictedGateVerdictitself follows in the keystone (#2283).Moved (ported verbatim):
PredictedGateVerdict,PredictedGateInputtypespredictedGateNote(+ itsPREDICTED_GATE_NOTE_*constants)publicSafeFindingsrc/rules/predicted-gate.tsnow re-exports the two types and imports the helpers instead of defining them, so there is exactly one definition.buildPredictedGateVerdictstays insrc/and calls the imported/bound helpers unchanged.Boundary wiring (please read — deviates slightly from the issue text)
The issue text suggests importing from the bare specifier
@jsonbored/gittensory-engineand adding it to rootpackage.json. I followed the already-merged convention from the scoring extraction (#2282,src/scoring/preview.ts) and the duplicate-winner extraction (#2278) instead, because it is what actually keeps CI green:src/rules/predicted-gate.tsimports../../packages/gittensory-engine/src/predicted-gate. The engine'spackage.jsonexportsresolve to its builtdist/, which is not guaranteed to exist when roottypecheck/test:coveragerun in CI (the engine is built later in the job). The relative source path avoids that ordering dependency with zero config changes — no root dep, notsconfigpaths, novitestalias — exactly matching the two prior extractions. I verified typecheck exits 0 with the enginedist/moved aside.PredictedGateVerdictneedsGatePolicyPack(src/types.ts) andGateCheckConclusion(src/rules/advisory.ts). The engine package is isolated (rootDir: "src",types: []) and cannot import across intosrc/, so these two-/five-member unions are mirrored engine-side withsrc/kept canonical — mirroring thescoring/types.tsconvention from feat(miner-foundation): extract scoring preview/model modules into gittensory-engine #2282.publicSafeFindingtakes its redaction fn as an argument. The originalpublicSafeFindingcallssanitizePublicComment(which lives insrc/github/commands.tsand has ~145 call sites acrosssrc/). Rather than relocate that core sanitizer here (out of scope for a "keep the surface small" slice), the engine helper acceptssanitizeas a parameter andsrc/binds the canonicalsanitizePublicComment. The sanitizer can move to the engine alongsidebuildPredictedGateVerdictin feat(miner-foundation): move buildPredictedGateVerdict into gittensory-engine and re-point src/ #2283, where it is actually needed engine-side.Verification
npm run typecheck→ exit 0 (also verified exit 0 withpackages/gittensory-engine/distmoved aside — the source-path shim resolves without the built engine)npm run build --workspace @jsonbored/gittensory-engine→ exit 0 (new module compiles under the engine's isolated tsconfig)predicted-gatesuite + engine-parity fixtures + contract parity pass unmodifiednpm run test:coverage→ exit 0;src/rules/predicted-gate.tsat 100% (statements/branches/functions/lines)ui:typecheck/ui:lint(0 errors) /ui:test,rees:testall greengit diff --checkclean