fix(orb): drop unreachable bare ::1 branch in isLocalBrokerHost#8340
fix(orb): drop unreachable bare ::1 branch in isLocalBrokerHost#8340shin-core wants to merge 3 commits into
Conversation
isLocalBrokerHost's hostname is always a WHATWG URL's .hostname, which always brackets an IPv6 literal ([::1], never bare ::1) -- so the hostname === "::1" comparison is dead code that can never match given how the function is actually called. Remove it, leaving the reachable localhost/127.0.0.1/[::1] forms, and add a comment noting why only the bracketed IPv6 form is checked so the bare form isn't reintroduced. Behavior-neutral; the existing bracketed-[::1] test still passes unchanged.
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
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 #8340 +/- ##
==========================================
- Coverage 92.42% 89.63% -2.80%
==========================================
Files 791 98 -693
Lines 79294 22833 -56461
Branches 23950 3925 -20025
==========================================
- Hits 73291 20467 -52824
+ Misses 4866 2187 -2679
+ Partials 1137 179 -958
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-24 13:46:22 UTC
Review summary Nits — 4 non-blocking
Flagged checks (non-blocking)
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk 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.
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.
|
What & why
Closes #8334.
isLocalBrokerHost(src/orb/broker-client.ts) checkshostname === "::1", buthostnamehere is always a WHATWGURL's.hostname, which always brackets an IPv6 literal —new URL("http://[::1]:8787").hostnameis"[::1]", never the bare"::1". So the bare-::1arm is unreachable dead code given how the function is actually called, andtest/unit/orb-broker-client.test.ts:96only ever exercises the bracketed form.The fix
Remove the unreachable bare
"::1"comparison, leaving the three reachable forms (localhost/127.0.0.1/[::1]), and add a one-line comment noting why only the bracketed IPv6 form is checked (so a future reader doesn't reintroduce the bare form). This is a dead-code cleanup — no externally-observable behavior change.Validation
test/unit/orb-broker-client.test.ts(40 tests) pass unchanged; the bracketed-[::1]case still exercises the simplified line.codecov/patch100% on the diff — removing a branch only improves coverage);broker-client.tswhole-file stays at ~99% branch / 100% lines.main, mergeable-clean.Per the issue: this removes a branch rather than adding one, so no new test is required to hit the patch gate — the existing bracketed-form test keeps the real behavior covered.