Skip to content

chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291) - #7416

Closed
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:mcp-local-branch-7329
Closed

chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291)#7416
jaytbarimbao-collab wants to merge 1 commit into
JSONbored:mainfrom
jaytbarimbao-collab:mcp-local-branch-7329

Conversation

@jaytbarimbao-collab

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of the packages/loopover-mcp TypeScript migration (#7291): convert lib/local-branch.js to real TypeScript, using the tsc build pipeline landed in Phase 1 (#7409).

  • lib/local-branch.jslib/local-branch.ts (592 lines). Types only — runtime behavior is byte-identical. The compiled lib/local-branch.js differs from the original only in tsc formatting, normalized trailing commas, and the elision of an already-dead node:path join import (imported but never called in the original).
  • Strict-mode compliant against the root config's noUncheckedIndexedAccess and exactOptionalPropertyTypes: provably-in-bounds index accesses use non-null assertions (which erase at compile time — no new runtime branches), and optional fields that may receive undefined are declared ?: T | undefined.
  • Imports keep their .js extension (NodeNext), matching the Phase 1 files.

Test adjustment

Removes the now-unused // @ts-expect-error package helper is plain JS ... directives above the dynamic import("../../packages/loopover-mcp/lib/local-branch.js") calls in test/unit/local-branch.test.ts (8) and test/unit/local-scorer-adapter.test.ts (7). Those imports resolved to the untyped plain .js before this conversion (hence the directive); they now resolve to the typed .ts source, so the directives would otherwise fail validate-code as unused.

Verification

  • npm run build (mcp package): tsc compile + node --check verify both pass.
  • npx vitest run test/unit/local-branch.test.ts test/unit/local-scorer-adapter.test.ts: 66/66 pass.
  • Root tsc -p tsconfig.json --noEmit: clean.

Closes #7329

…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).

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
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.14286% with 106 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.20%. Comparing base (603ea35) to head (8f61580).

Files with missing lines Patch % Lines
packages/loopover-mcp/lib/local-branch.ts 62.14% 50 Missing and 56 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7416      +/-   ##
==========================================
- Coverage   91.27%   91.20%   -0.08%     
==========================================
  Files         716      716              
  Lines       72972    72994      +22     
  Branches    21527    21635     +108     
==========================================
- Hits        66605    66572      -33     
+ Misses       5327     5322       -5     
- Partials     1040     1100      +60     
Flag Coverage Δ
shard-1 32.56% <39.64%> (-0.09%) ⬇️
shard-2 36.01% <47.14%> (-0.06%) ⬇️
shard-3 34.52% <0.00%> (-0.02%) ⬇️
shard-4 42.88% <0.00%> (-0.02%) ⬇️
shard-5 36.97% <0.00%> (-0.02%) ⬇️
shard-6 33.55% <0.00%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
packages/loopover-mcp/lib/local-branch.ts 62.14% <62.14%> (ø)

... and 2 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 20, 2026
@loopover-orb

loopover-orb Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-20 08:32:05 UTC

4 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This is a mechanical JS→TS conversion of lib/local-branch.js (592→656 lines), adding types without touching runtime logic. Diffing the emitted local-branch.js against the original shows only formatting/whitespace changes and the removal of an already-dead `join` import, consistent with the PR's byte-identical claim. The `@​ts-expect-error` cleanup in the two test files is a correct consequence of the module now resolving as typed .ts rather than plain .js.

Nits — 6 non-blocking
  • packages/loopover-mcp/lib/local-branch.ts:507 `normalizeScorerOutput(payload: any)` uses an explicit `any`, which undercuts the PR's claim of being fully strict-mode compliant — type it as `Record<string, unknown>` and access fields defensively, matching the pattern used elsewhere in this file.
  • The external brief flags `splitCommand`'s regex `(?:[^\s"]+|"[^"]*")+` (local-branch.ts:604) as a nested-quantifier ReDoS risk, but this is pre-existing code carried over unchanged from the original .js — not introduced by this diff, so it's out of scope here but worth a follow-up issue.
  • This PR adds 0 new test lines for a 656-line file; codecov/patch reports 62.14% against a 99% target, so the type-narrowing branches (e.g. `noUncheckedIndexedAccess` guards, `stripUndefined` generics) added by the conversion aren't exercised by new assertions even though the existing 66 tests still pass on the compiled output.
  • packages/loopover-mcp/lib/local-branch.ts:107 `collectLocalBranchMetadata` and :457 `classifyScorerExecFailure`(js) are both already fairly complex; the conversion is a good moment to note (not fix here) that these could be split in a follow-up for readability.
  • Swap the `any` in `normalizeScorerOutput` for `Record<string, unknown>` to keep the file's strict-typing story consistent (local-branch.ts:507).
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

CI checks failing

  • codecov/patch — 62.14% of diff hit (target 99.00%)

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 #7329
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High 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: 178 registered-repo PR(s), 92 merged, 14 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jaytbarimbao-collab; Gittensor profile; 178 PR(s), 14 issue(s).
Improvement ℹ️ None detected risk: low · value: none · LLM: moderate
Linked issue satisfaction

Addressed
The PR converts lib/local-branch.js to lib/local-branch.ts (656 lines of typed source) using the tsc pipeline from Phase 1, keeps the compiled output behaviorally identical, and updates dependent test files to remove now-unneeded @​ts-expect-error directives while confirming existing tests still pass.

Review context
  • Author: jaytbarimbao-collab
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Rust
  • Official Gittensor activity: 178 PR(s), 14 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #7328)
  • Related work: Titles/paths share 6 meaningful terms. (issue #7330)
  • Related work: Titles/paths share 11 meaningful terms. (issue #7329, issue #7328)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Start here: Review top overlaps.
  • Then work through the remaining 2 steps in the Signals table above.
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 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291)

1 participant