Skip to content

test(registry): cover refreshRegistry all-sources-failed path#9396

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
philluiz2323:test/registry-all-sources-failed-9314
Jul 27, 2026
Merged

test(registry): cover refreshRegistry all-sources-failed path#9396
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
philluiz2323:test/registry-all-sources-failed-9314

Conversation

@philluiz2323

Copy link
Copy Markdown
Contributor

Summary

refreshRegistry marks the syncRuns row status: "error" and re-throws when every API_CANDIDATES probe and the GITTENSOR_REGISTRY_URL raw fallback fail. That branch was never covered — the existing test only exercises a successful raw-GitHub fallback (same gap the sibling fetchTrackedSource already covers in upstream-ruleset.test.ts).

Adds a regression that stubs every candidate to fail (mix of non-OK + thrown errors), asserts the thrown error message, and checks the persisted sync_runs error row + 7 per-candidate warnings.

No production code change — the new test did not surface a defect.

Test plan

Closes #9314

refreshRegistry's status:error syncRuns branch (every API candidate + raw fallback
exhausted) had no test ? only the successful raw-GitHub fallback was covered.
Add a regression asserting the thrown error and persisted error sync_runs row.

Closes JSONbored#9314
@philluiz2323
philluiz2323 requested a review from JSONbored as a code owner July 27, 2026 16:01
@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 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 16:07:16 UTC

1 file · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a pure test-only addition to test/unit/registry.test.ts that covers the previously-untested all-sources-failed branch of refreshRegistry (src/registry/sync.ts): it stubs fetch to alternate between 404 responses and thrown errors across all 7 candidates (6 API_CANDIDATES + 1 GITTENSOR_REGISTRY_URL fallback), asserts the rejection message, and verifies the persisted sync_runs error row and 7 warnings. Tracing against sync.ts, the test correctly exercises both warning-push branches (the `!response.ok` continue path and the catch-block error path) and the final throw/catch that sets status:"error" with errorSummary and warningsJson — this matches the real code path, not a fabricated scenario. No production code changes, low risk, and the PR is correctly scoped to closing #9314.

Nits — 2 non-blocking
  • test/unit/registry.test.ts: the new test relies on `createTestEnv()` providing a `GITTENSOR_REGISTRY_URL` env var for the 7th candidate to be probed — worth a comment or assertion confirming that helper sets it, since if it were unset the warnings count would silently drop to 6.
  • Consider also asserting `row?.status` is not "running" left over from a stale row, e.g. by checking `ORDER BY rowid DESC LIMIT 1` picks the just-created run and not a prior test's leftover row, to guard against future test-isolation regressions.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9314
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 ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 992 registered-repo PR(s), 564 merged, 125 issue(s).
Contributor context ✅ Confirmed Gittensor contributor philluiz2323; Gittensor profile; 992 PR(s), 125 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: minor
Linked issue satisfaction

Addressed
The PR adds a new test that stubs every API_CANDIDATES probe and the raw-GitHub fallback to fail (mixing non-OK responses and thrown errors to hit both warning branches), asserts refreshRegistry rejects with the expected error message, and queries the persisted sync_runs row to confirm status "error" and 7 per-candidate warnings — matching all stated Deliverables and the template style from the si

Review context
  • Author: philluiz2323
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, TypeScript, CSS, Cuda, HTML, Kotlin
  • Official Gittensor activity: 992 PR(s), 125 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
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.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver 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.

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

@loopover-orb
loopover-orb Bot merged commit fa2bfd9 into JSONbored:main Jul 27, 2026
6 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(registry): refreshRegistry's all-sources-failed error path is never exercised

1 participant