test(miner-manage): cover ci-poller transient-failure edge cases - #4356
Conversation
Extends test/unit/miner-ci-poller.test.ts (JSONbored#2323) with the three transient-failure modes it did not exercise, per JSONbored#4281: (1) a 403/429 response propagates as github_<status> and aborts the poll without consuming a backoff attempt or retrying through the remaining maxAttempts; (2) a fetchFn promise rejection (network timeout/abort) during the PR head-SHA fetch and during the check-runs fetch propagates a clear error rather than hanging or swallowing; (3) page 1 of check-runs succeeding but page 2 failing mid-pagination aborts deterministically (fetchCheckRuns has no per-page retry). Test-only, injected fetchFn/sleepFn, no real network. These pin the current no-retry/no-swallow behavior; if the poll should instead retry on 429, that is a separate feat/fix intentionally not made here. Closes JSONbored#4281.
|
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 #4356 +/- ##
=======================================
Coverage 93.95% 93.95%
=======================================
Files 399 399
Lines 36782 36782
Branches 13436 13436
=======================================
Hits 34557 34557
Misses 1569 1569
Partials 656 656 🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-09 17:14:57 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Linked issue satisfactionAddressed 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.
|
Summary
Closes #4281.
test/unit/miner-ci-poller.test.ts(#2323) already coverspollCheckRunsthoroughly (13 cases). This adds the three transient-failure modes it does not exercise, using the existing injectedfetchFn/sleepFnstyle (no real network):403/429propagates as agithub_403/github_429error and aborts the poll on attempt 1 —pollCheckRuns' attempt loop has notry/catcharound the fetches, so it does not consume a backoff attempt or retry through the remainingmaxAttempts(asserted:sleepFnnever called, only the head-SHA fetch issued).fetchFnpromise rejection (network timeout/abort) during the PR head-SHA fetch and during the check-runs fetch — propagates a clear error rather than hanging or silently swallowing.rel="next"Link header) but page 2 fails;fetchCheckRunshas no per-page retry, so the error propagates deterministically out of the whole poll.These pin the current behavior (a single transient failure kills the poll with no retry). Per the issue's guidance, I did not change that behavior under a
test-prefixed PR: if the poller should instead retry specifically on a429, that is worth a separatefeat/fix— flagging it here rather than silently altering it.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.md; does not reintroduce GitHub Pages, VitePress,site/, orCNAME.help wanted/gittensor:featureissue).Validation
git diff --checknpm run typecheck(green)test/unit/miner-ci-poller-failure-modes.test.ts— 5 assertions (403 + 429 viait.each, head-SHA-fetch rejection, check-runs-fetch rejection, mid-pagination page-2 failure) all pass.If any required check was skipped, explain why:
npm run test:ciwas not run locally (several self-host suites require Linux/bash/Docker/Postgres and fail only on Windows). This PR is test-only — it adds onetest/unit/*.test.tsfile and changes nosrc//package source, so there is no runtime, generated-artifact, or Codecov-patch surface; typecheck and the new tests are green, and the remaining CI runs on this PR.Safety
UI Evidence
N/A - test-only change; no UI, frontend, docs, or extension change.