Skip to content

fix(miner): fall back to global config.apiUrl in loopoverApiUrl - #8937

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jeffrey701:fix-8854-miner-global-apiurl-fallback-v2
Jul 26, 2026
Merged

fix(miner): fall back to global config.apiUrl in loopoverApiUrl#8937
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
jeffrey701:fix-8854-miner-global-apiurl-fallback-v2

Conversation

@jeffrey701

Copy link
Copy Markdown
Contributor

What

packages/loopover-miner/lib/github-token-resolution.ts's loopoverApiUrl() is a hand-maintained
copy of loopover-mcp's config resolution (the file's own header says so — there is no shared
module). But it diverged: loopover-mcp falls back activeProfile.apiUrl ?? config.apiUrl ?? default
(a top-level/global apiUrl), while the miner read only the active profile's apiUrl and then
went straight to the hardcoded DEFAULT_API_URL. A config that set apiUrl globally (not per-profile)
was silently ignored by the miner.

Change

  • Add the top-level apiUrl? to the LoopoverConfig type (mirrors loopover-mcp's config shape).
  • loopoverApiUrl() now tries the active profile's apiUrl then the global config.apiUrl before
    the default, applying the same trim + trailing-slash normalization + legacy-URL rejection to both.

LOOPOVER_API_URL env override still wins first; behavior when neither a profile nor a global apiUrl
is set is unchanged (still the default).

Validation

  • New tests in test/unit/miner-github-token-resolution.test.ts: the global config.apiUrl is used
    when the profile has none (with trailing-slash normalization), and the profile's apiUrl takes
    precedence over the global one.
  • npx vitest run test/unit/miner-github-token-resolution.test.ts → 30/30 pass; 100% coverage on the
    new resolution branch (lcov-verified).

Closes #8854

@jeffrey701
jeffrey701 requested a review from JSONbored as a code owner July 26, 2026 13:48
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.58%. Comparing base (546b260) to head (fb269ad).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8937      +/-   ##
==========================================
+ Coverage   90.56%   90.58%   +0.02%     
==========================================
  Files          96       97       +1     
  Lines       22490    22542      +52     
  Branches     3884     3910      +26     
==========================================
+ Hits        20367    20419      +52     
  Misses       1945     1945              
  Partials      178      178              
Flag Coverage Δ
backend 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ages/loopover-miner/lib/github-token-resolution.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 14:03:08 UTC

2 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR adds a top-level `apiUrl` fallback to the miner's hand-copied config resolver in `loopoverApiUrl()`, correctly mirroring loopover-mcp's `activeProfile.apiUrl ?? config.apiUrl ?? default` precedence. The loop iterates profile-then-global candidates, applies trim/trailing-slash normalization and legacy-URL rejection uniformly to both, and preserves the LOOPOVER_API_URL env override taking precedence first — this matches the stated intent exactly. New tests cover both the global-fallback case and profile-takes-precedence case with trailing-slash normalization, closing #8854 as described.

Nits — 4 non-blocking
  • packages/loopover-miner/lib/github-token-resolution.ts: the `for...of` loop over a 2-element array to pick the first valid candidate is a bit indirect — a simple `activeLoopoverProfile(env).apiUrl ?? loadLoopoverConfig(env).apiUrl` chain (matching the mirrored `??` style called out in the comment) would read closer to the loopover-mcp original it's copying.
  • test/unit/miner-github-token-resolution.test.ts: no test exercises the legacy-URL check on the *global* apiUrl branch specifically (only the profile branch is tested for legacy rejection), though the shared normalization logic makes this low-risk.
  • Consider replacing the `for` loop in `loopoverApiUrl()` with a flatter `??`-chain expression to mirror loopover-mcp's own resolver shape more literally, per the file's own stated sync intent.
  • Add one test case asserting a legacy URL set as the *global* `config.apiUrl` also falls through to the default, for full branch parity with the profile-level legacy test.

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 #8854
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: 76 registered-repo PR(s), 35 merged, 18 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jeffrey701; Gittensor profile; 76 PR(s), 18 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Partially addressed
The diff correctly adds the global config.apiUrl fallback to loopoverApiUrl(), addressing the core bug and testing profile-vs-global precedence, but the issue explicitly required a new dedicated parity test mirroring env-file-indirection-parity.test.ts that asserts loopoverApiUrl() and loopover-mcp's equivalent resolve identically across a matrix of cases — the PR only adds tests within the existi

Review context
  • Author: jeffrey701
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Rust, TypeScript, Clojure, JavaScript
  • Official Gittensor activity: 76 PR(s), 18 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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 &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; 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.

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.

fix(miner): loopoverApiUrl() omits the global config.apiUrl fallback that loopover-mcp itself has

1 participant