feat(miner): pre-submission gate prediction on the local branch (self-gate) - #688
Conversation
…-gate) Closes the biggest miner gap: a contributor can now see "will my PR pass repo X's gate, and what would block it?" BEFORE opening the PR — the score-moving feedback that was previously only computed in the maintainer PR pipeline. - New src/rules/predicted-gate.ts: buildPredictedGateVerdict builds a SYNTHETIC PR from the local branch metadata and runs the EXACT same engine the maintainer PR pipeline runs — buildPullRequestAdvisory + buildPublicReadinessScore + evaluateGateCheck — so the verdict a miner sees pre-submission is the verdict the gate computes post-submission (true parity, one engine). - Boundary-safe by construction: the gate POLICY is sourced ONLY from the repo's PUBLIC .gittensory.yml (manifest.gate) + safe defaults, NEVER the maintainer's private dashboard/DB settings. The .gittensory.yml is in the repo and publicly viewable, so this leaks nothing a contributor could not already read. The verdict is labelled predicted/public_config and notes that private overrides and the dual-model AI-consensus blocker are not evaluated pre-submission. - Wired into POST /v1/local/branch-analysis (already requireContributorAccess + self-scoped) as a `predictedGate` block, so every existing miner branch-analysis tool inherits it. Output runs through sanitizePublicComment (public-safe). - A non-confirmed contributor's prediction is forced neutral, matching the real gate (only confirmed Gittensor contributors are ever hard-blocked). Tests: clean pass; duplicate→block (and off→no block); missing-linked-issue blocks only on linkedIssue:block; non-confirmed→neutral. Branch coverage 97%. Part of #525.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 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. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 3 changed file(s) — two independent AI reviewers. Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Suggestions
Worth double-checking
|
The highest-leverage miner feature: a contributor can now see "will my PR pass repo X's gate, and what would block it?" before opening the PR — the score-moving feedback that previously only existed in the maintainer PR pipeline.
How (true parity, one engine)
New
src/rules/predicted-gate.ts→buildPredictedGateVerdictbuilds a synthetic PR from the local branch metadata and runs the exact same engine the maintainer PR pipeline runs:buildPullRequestAdvisory+buildPublicReadinessScore+evaluateGateCheck. So the verdict a miner sees pre-submission is the verdict the gate computes post-submission — not a separate approximation.Boundary-safe by construction (per the access invariant)
The gate policy is sourced only from the repo's public
.gittensory.yml(manifest.gate) + safe defaults — never the maintainer's private dashboard/DB settings. The.gittensory.ymllives in the repo and is publicly viewable, so this leaks nothing a contributor couldn't already read. The verdict is labelledpredicted/public_configand notes that private overrides and the dual-model AI-consensus blocker aren't evaluated pre-submission. Output runs throughsanitizePublicComment.POST /v1/local/branch-analysis(alreadyrequireContributorAccess+ self-scoped) as apredictedGateblock, so every existing miner branch-analysis tool inherits it.neutral, matching the real gate (only confirmed Gittensor contributors are ever hard-blocked).Tests
predicted-gate.test.ts: clean→pass; duplicate→block (andduplicates:off→no block); missing-linked-issue blocks only onlinkedIssue:block(advisory by default); non-confirmed→neutral.Verification
typecheck✅ ·test:coverage✅ (97.01% branch, 1692 tests) ·test:workers✅ ·git diff --check✅Part of #525. (Follow-ups: AI advisory on the local diff arrives with contributor BYOK; a dedicated
gittensory_self_check_gateMCP tool name.)