chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291) - #7423
Closed
jaytbarimbao-collab wants to merge 1 commit into
Closed
chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291)#7423jaytbarimbao-collab wants to merge 1 commit into
jaytbarimbao-collab wants to merge 1 commit into
Conversation
…Nbored#7291) Convert packages/loopover-mcp/lib/local-branch.js to real TypeScript, using the tsc build pipeline landed in Phase 1 (JSONbored#7409). Types only; runtime behavior is byte-identical (the compiled lib/local-branch.js changes only in tsc formatting and the elision of an already-dead node:path `join` import). Add unit coverage for the local scorer-preview machinery (previously untested in the .js) so the newly-typed file clears codecov/patch, and mark the handful of provably-unreachable defensive fallbacks with `v8 ignore` directives (the pattern already used across the converted packages/loopover-miner/lib TypeScript files). Remove the now-unused `@ts-expect-error package helper is plain JS` directives above the dynamic local-branch.js imports in test/unit/local-branch.test.ts and test/unit/local-scorer-adapter.test.ts, which now resolve to the typed .ts source. Closes JSONbored#7329
JSONbored
reviewed
Jul 20, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
Issue already completed, closing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7423 +/- ##
==========================================
+ Coverage 91.27% 91.34% +0.07%
==========================================
Files 716 716
Lines 72972 72983 +11
Branches 21528 21628 +100
==========================================
+ Hits 66605 66667 +62
+ Misses 5327 5272 -55
- Partials 1040 1044 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 2 of the
packages/loopover-mcpTypeScript migration (#7291): convertlib/local-branch.jsto real TypeScript, using thetscbuild pipeline landed in Phase 1 (#7409).lib/local-branch.js→lib/local-branch.ts(592 lines). Types only — runtime behavior is byte-identical. The compiledlib/local-branch.jsdiffers from the original only in tsc formatting, normalized trailing commas, and the elision of an already-deadnode:pathjoinimport (imported but never called in the original).noUncheckedIndexedAccessandexactOptionalPropertyTypes: provably-in-bounds index accesses use non-null assertions (erase at compile time — no new runtime branches), and optional fields that may receiveundefinedare declared?: T | undefined..jsextension (NodeNext), matching the Phase 1 files.Test coverage
lib/local-branch.jsshipped a substantial, previously-untested local scorer-preview surface (runExternalScorePreview,classifyScorerExecFailure,setupGuidanceForLocalScorer,probeLocalScorer,normalizeScorerOutput, and helpers). Now that the file is real TypeScript under the 99% patch gate, this PR adds the missing unit coverage:test/unit/local-scorer-adapter.test.ts(scorer exec-failure classification, JSON-shape parsing, guidance, redaction, timeouts — driven by fixture subprocesses and a selectivechild_processmock) andtest/unit/local-branch.test.ts(git-metadata branch partials via real temp repos: base-ref resolution priorities, remote-tracking SHA, CI hints, typechange status codes, workspace-root normalization).titleFromBranchis never nullish, gitdiff -Mnever emits copy codes) are marked with/* v8 ignore -- <reason> */, matching the pattern already used across the convertedpackages/loopover-miner/libTypeScript files.lib/local-branch.tsis at 100% line and branch coverage.Test adjustment
Removes the now-unused
// @ts-expect-error package helper is plain JS ...directives above the dynamicimport("../../packages/loopover-mcp/lib/local-branch.js")calls intest/unit/local-branch.test.tsandtest/unit/local-scorer-adapter.test.ts— those imports resolved to the untyped plain.jsbefore this conversion and now resolve to the typed.tssource.Verification
npm run build(mcp package):tsccompile +node --checkverify both pass.npx vitest run test/unit/local-branch.test.ts test/unit/local-scorer-adapter.test.ts: 99/99 pass;local-branch.tscoverage 100% lines / 100% branch.tsc -p tsconfig.json --noEmit: clean.Closes #7329