chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291) - #7419
Conversation
Converts lib/local-branch.js to real TypeScript (in-place .ts -> .js emit, import paths unchanged), building on Phase 1's build pipeline. Adds targeted test coverage for git-plumbing edge cases (defaultBaseRef's origin/HEAD/main/master precedence, a real type-change git status, workspace-root path resolution) and scorer failure classification (malformed JSON via message inspection, spawn failures, signal kills), and simplifies a few defensive fallbacks that were provably unreachable given their sole caller's own guarantees. Refs JSONbored#7329
Closes the codecov/patch shortfall that auto-closed the first attempt at this PR (97.17%, 8 lines missing): adds a real out-of-order-issues test to exercise linkedIssues' sort comparator, an invalid GITTENSOR_SCORE_PREVIEW_TIMEOUT_MS test, and two more scorer-failure classification fixtures. Documents the remaining handful of residual branches inline -- defensive fallbacks for Node error shapes this codebase's own real failure modes never produce, and one line proven reachable by direct invocation outside the test runner but not attributed by the coverage tool (a v8/sourcemap remapping artifact for compiled-from-.ts files, consistent with others found earlier in this migration).
|
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 #7419 +/- ##
==========================================
+ Coverage 91.27% 91.34% +0.07%
==========================================
Files 716 716
Lines 72972 72990 +18
Branches 21528 21627 +99
==========================================
+ Hits 66605 66674 +69
+ Misses 5327 5272 -55
- Partials 1040 1044 +4
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-20 09:19:46 UTC
Decision drivers
Context & advisory signals — never blocks the verdict
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.
|
Descriptive comments alone don't affect coverage counting -- codecov/patch still flagged these 6 branches after the prior commit's docs-only pass. Adds real /* v8 ignore next */ directives so both local coverage and the uploaded lcov exclude them: Node child_process error shapes this codebase's own real failure modes never produce (non-object thrown values, non-Error instances, a Node-version-dependent ETIMEDOUT code path superseded by the killed+SIGTERM check that IS exercised), a generic helper's unreachable-through-current-callers nullish default, and one line proven reachable by direct invocation but not attributed by the coverage tool (a v8/sourcemap remapping artifact for compiled-from-.ts files, consistent with others found earlier in this migration).
|
Issuing a warning for using draft mode, do NOT convert PRs to draft as it clogs up our pipeline and will be viewed as a review / bot evasion attempt moving forward. ORB is still in a learning pattern with contributors that frequently convert to draft mode, so you weren't hit with a closure this time, but any future attempts may be automatically closed. |
Summary
lib/local-branch.js(592 lines) to real TypeScript (in-place.ts->.jsemit, import paths unchanged), building on Phase 1's (chore(mcp): add tsc build pipeline + convert small lib utilities to TypeScript (Phase 1 of #7291) #7328) build pipeline..d.tsartifact, no allowlist changes needed.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #7329
Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally --local-branch.tsreaches 100% lines, 163 tests total acrosstest/unit/local-branch.test.ts,test/unit/local-scorer-adapter.test.ts, andtest/unit/coding-agent-miner.test.ts. Test coverage includesdefaultBaseRef's origin/HEAD -> origin/main -> origin/master precedence (viagit update-ref-faked remote-tracking refs), a real git type-change status (regular file <-> symlink), MCP workspace-root path resolution, andclassifyScorerExecFailure's failure-classification branches (a circular-JSON-metadata case, a SIGKILL-terminated child, a spawn/command-not-found case, and non-object-JSON stdout/stderr shapes). A handful of remaining branches are documented inline as accepted residuals: defensive fallbacks for Node error shapes this codebase's own real failure modes never produce (kept as genuine defense-in-depth, not dead code), and one line proven reachable by direct invocation outside the test runner but not attributed by the coverage tool itself -- consistent with a v8/sourcemap-remapping artifact for compiled-from-.ts files already root-caused earlier in this same migration effort.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
npm audit --audit-level=moderatereports a pre-existing high-severityadm-zipadvisory (no fix available) viagithub-actionlint, inherited unchanged frommainand unrelated to this PR'spackages/loopover-mcpscope.Safety
Notes
.js.local-branch.test.ts,local-scorer-adapter.test.ts) had a@ts-expect-errorsuppression for dynamically importing what was previously an untyped.jsmodule; these are now stale (TypeScript resolves the import to the new.tssource directly) and were removed.