Skip to content

feat(miner-manage): add maintainer-gate verdict poller (read-only) - #4464

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-gate-verdict-poller
Jul 9, 2026
Merged

feat(miner-manage): add maintainer-gate verdict poller (read-only)#4464
JSONbored merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/miner-gate-verdict-poller

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Adds a read-only poller for the miner's own PRs' REAL gate disposition (Closes #4273).

Today manage-poll.js's mapPollConclusionToGateVerdict turns ci-poller.js's generic CI-check-run aggregate into a pass/block/advisory proxy — but the authoritative gate verdict is server-internal gate_decision state, not a GitHub check-run. This reads the real source:

  • mapGateDisposition / readGateDisposition — pure: read the disposition from the API body (tolerant of disposition / gateDisposition / verdict) and map it to a typed verdict merge | close | hold | pending. Synonym-tolerant, case-insensitive; unknown/missing → pending (never a false decided verdict).
  • pollGateVerdict(url, options) — polls until a decided verdict or maxAttempts, backing off exponentially while pending. Injectable fetchFn/sleepFn (mirrors ci-poller.js) → fully unit-testable with no real network. Throws on a missing URL or non-OK HTTP.

Read-only, no GitHub token (targets the gittensory API, not api.github.com; any endpoint auth is passed via options.headers). ci-poller.js is left untouched — CI state and gate verdict are two different signals a caller records independently.

Test

test/unit/miner-gate-verdict-poller.test.ts (injected fetchFn/sleepFn, no network) — the frozen vocab, each disposition family + synonyms + the pending fallback, tolerant field reading, a first-attempt decided verdict (no sleep), backoff-while-pending (asserts the exact backoff delays), exhausted-while-pending, and a non-OK HTTP throw. 9 tests pass; build:miner + test:miner-pack + typecheck green.

New packages/gittensory-miner/lib/gate-verdict-poller.js: reads the REAL gate disposition from the
gittensory API (the authoritative server-internal gate_decision, not a GitHub check-run) and maps it to
a typed verdict (merge | close | hold | pending), replacing manage-poll.js's CI-conclusion-as-proxy
heuristic as the source of the gateVerdict signal.

- mapGateDisposition / readGateDisposition: pure, synonym-tolerant, unknown/missing -> pending.
- pollGateVerdict: injectable fetchFn/sleepFn + exponential backoff while pending (fully unit-testable,
  no real network). Read-only, no GitHub token (targets the gittensory API); ci-poller.js left untouched.

Closes JSONbored#4273
@dhgoal
dhgoal requested a review from JSONbored as a code owner July 9, 2026 20:03
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 9, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.01%. Comparing base (9514ae6) to head (29e847d).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4464   +/-   ##
=======================================
  Coverage   94.01%   94.01%           
=======================================
  Files         418      418           
  Lines       37410    37410           
  Branches    13675    13675           
=======================================
  Hits        35171    35171           
  Misses       1583     1583           
  Partials      656      656           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels Jul 9, 2026
@loopover-orb

loopover-orb Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Tip

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

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-09 20:20:37 UTC

3 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · unstable

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Adds a small, well-isolated pure-function module (`gate-verdict-poller.js`) plus a `.d.ts` and a solid unit-test file that reads the authoritative server-side gate disposition and maps it to a typed `merge|close|hold|pending` verdict, distinct from the existing CI-check-run proxy in `ci-poller.js`/`manage-poll.js`. The logic is correct and matches its own tests (backoff math, exhaustion, first-attempt short-circuit, non-OK throw), but nothing in this diff actually calls `pollGateVerdict` from `manage-poll.js` or any other caller, so the stated goal of PR #4464 — replacing the CI-check-run proxy for real gate decisions — is not yet wired into a reachable path; this PR only adds dead-but-tested library code toward #4273, which the external brief also flags as only partial issue coverage.

Nits — 5 non-blocking
  • gate-verdict-poller.js is not called anywhere yet (no changes to manage-poll.js or any caller) — worth stating explicitly whether wiring this into `mapPollConclusionToGateVerdict`'s call site is a deliberate follow-up PR, since as-is this ships inert code.
  • readGateDisposition (gate-verdict-poller.js:60-64) only falls back to gateDisposition/verdict when the primary field is entirely absent; if `disposition` is present but non-string (e.g. a number), it returns null instead of trying the other fields — confirm that's the intended contract for the real API shape.
  • mapGateDisposition's switch (gate-verdict-poller.js:23-44, approx. complexity 14) could be a flat synonym→verdict lookup object/Map to cut branch count and make adding new synonyms less error-prone.
  • The magic numbers for attempt/interval bounds (10/1/20, 2000, 60, 60_000 at gate-verdict-poller.js:83-85) aren't named constants — pulling them into DEFAULT_MAX_ATTEMPTS/MIN_INTERVAL_MS/MAX_INTERVAL_MS style constants would self-document the poll policy.
  • No test exercises the `!response` (falsy response) branch of the non-OK-HTTP throw at gate-verdict-poller.js:88 — only the `ok:false` case is covered.
Flagged checks (non-blocking)
  • Contributor trust — Contributor flagged for review
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #4273
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 85 registered-repo PR(s), 51 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor dhgoal; Gittensor profile; 85 PR(s), 7 issue(s).
Gate result ✅ Passing No configured blocker found.
Linked issue satisfaction

Addressed
The PR adds gate-verdict-poller.js with a pure mapGateDisposition/readGateDisposition mapper (merge|close|hold|pending), an injectable fetchFn/sleepFn poll loop mirroring ci-poller.js's backoff shape, leaves ci-poller.js untouched, requires no GitHub token, and ships unit tests covering decided/pending/backoff/exhaustion/error cases as requested.

Review context
  • Author: dhgoal
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 85 PR(s), 7 issue(s).
  • Related work: Titles/paths share 3 meaningful terms. (issue #642, issue #539)
  • Related work: Titles/paths share 3 meaningful terms. (issue #642, issue #2013)
  • Related work: Titles/paths share 6 meaningful terms. (issue #4261, issue #4307)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Check active issues and PRs before submitting.
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

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@JSONbored
JSONbored merged commit 6020670 into JSONbored:main Jul 9, 2026
9 of 10 checks passed
@loopover-orb loopover-orb Bot removed the gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. label Jul 9, 2026
@JSONbored JSONbored added the gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(miner-manage): maintainer-gate verdict watcher (read-only, webhook or poll)

2 participants