Skip to content

chore(mcp): convert lib/local-branch to TypeScript - #7420

Closed
lourincedaging0-commits wants to merge 1 commit into
JSONbored:mainfrom
lourincedaging0-commits:chore/mcp-local-branch-ts3
Closed

chore(mcp): convert lib/local-branch to TypeScript#7420
lourincedaging0-commits wants to merge 1 commit into
JSONbored:mainfrom
lourincedaging0-commits:chore/mcp-local-branch-ts3

Conversation

@lourincedaging0-commits

Copy link
Copy Markdown
Contributor

Phase 2 of the packages/loopover-mcp TypeScript migration (#7291), on the tsc pipeline from Phase 1 (#7409).

What

Port lib/local-branch.jslib/local-branch.ts. The tsconfig include glob picks it up; it compiles in place to lib/local-branch.js (inline source map, no .d.ts) — the same layout the package already ships. Runtime behavior and the public export surface are unchanged; bin/loopover-mcp.js and test/unit/local-scorer-adapter.test.ts consume the compiled .js exactly as before. Types are added at the git-diff / scorer-JSON boundaries as open records, matching the already-converted lib/ files.

Why the one-line ci.yml change is included

local-branch is the first packages/loopover-mcp/lib file that imports @loopover/engine. Once it is real TypeScript, npm run typecheck pulls it into the root check (a test imports the compiled .js, which Bundler-resolves to the sibling .ts) and needs @loopover/engine's built dist/*.d.ts. The Typecheck gate already runs for mcp/miner changes, but Build engine package did not (backend || engine || ui only) — so on an mcp-only change engine was unbuilt at typecheck time and every @loopover/engine import (mcp, miner, discovery-index) failed to resolve. The later Build MCP/Build miner CLI steps build engine transitively via turbo, but they run after Typecheck. Phase 1 (#7409) didn't hit this because none of its converted files import the engine. The fix widens that one step's gate to match the Typecheck gate (and the Turborepo-cache restore directly above it).

Closes #7329

Phase 2 of the packages/loopover-mcp TypeScript migration (JSONbored#7291), on the
tsc build pipeline from Phase 1 (JSONbored#7409). Port lib/local-branch.js to
lib/local-branch.ts; it compiles in place to lib/local-branch.js (inline
source map, no .d.ts) -- the same file set the package already ships, so
no import path changes. Runtime behavior and the public export surface are
unchanged; bin/loopover-mcp.js and test/unit/local-scorer-adapter.test.ts
consume the compiled .js exactly as before. Types are added at the
git-diff / scorer-JSON boundaries as open records, matching the already
converted lib/ files, so the strict build stays clean.

ci: build the engine package for mcp/miner-scoped changes in validate-code

local-branch.ts is the first packages/loopover-mcp/lib file that imports
@loopover/engine. Once it is real TypeScript, 'npm run typecheck' pulls it
into the root check (a test imports the compiled .js, which resolves to the
.ts source) and needs @loopover/engine's built dist/*.d.ts. The Typecheck
gate already runs for mcp/miner changes, but 'Build engine package' did not
-- so engine was unbuilt at typecheck time and every @loopover/engine import
(across mcp, miner and discovery-index) failed to resolve. Widen that step's
gate to match Typecheck (and the Turborepo-cache restore just above it).

Closes JSONbored#7329
@superagent-security

Copy link
Copy Markdown
Contributor

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

1 similar comment
@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.80702% with 106 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.20%. Comparing base (603ea35) to head (4936517).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/loopover-mcp/lib/local-branch.ts 62.80% 55 Missing and 51 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7420      +/-   ##
==========================================
- Coverage   91.27%   91.20%   -0.07%     
==========================================
  Files         716      716              
  Lines       72972    72999      +27     
  Branches    21527    21638     +111     
==========================================
- Hits        66605    66581      -24     
  Misses       5327     5327              
- Partials     1040     1091      +51     
Flag Coverage Δ
shard-1 32.59% <38.94%> (-0.05%) ⬇️
shard-2 36.01% <48.07%> (-0.06%) ⬇️
shard-3 34.52% <0.00%> (-0.02%) ⬇️
shard-4 42.88% <0.00%> (-0.03%) ⬇️
shard-5 36.96% <0.00%> (-0.02%) ⬇️
shard-6 33.54% <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.80% <62.80%> (ø)

... and 1 file 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 - reject/close recommended

Review updated: 2026-07-20 09:23:29 UTC

3 files · 1 AI reviewer · 2 blockers · CI failing · blocked

🛑 Suggested Action - Reject/Close

Review summary
The AI review returned blocking findings for this change but did not include a separate narrative summary. Review the blockers below before deciding this PR.

Blockers

  • packages/loopover-mcp/lib/local-branch.ts imports `join` from `node:path` at the top of the file but never references it anywhere in the port — TS's emit elides it from the compiled `.js` (visible in the .js diff losing `join`), but the dead import itself will fail a strict typecheck/lint pass if `noUnusedLocals` (or similar) is enabled, which lines up with the `validate`/`validate-code` CI failures this exact PR is meant to unblock.
Nits — 6 non-blocking
  • classifyScorerExecFailure uses an explicit `execError: any` (local-branch.ts:528) instead of a narrower `NodeJS.ErrnoException`-style shape, undercutting the type-safety goal of the migration.
  • The `splitCommand` regex `(?:[^\s"]+|"[^"]*")+` (local-branch.ts:594) is pre-existing (carried over from the .js, not introduced by this diff) but is nested-quantifier-shaped and worth a follow-up hardening pass if it ever takes untrusted input.
  • Remove the unused `join` import in local-branch.ts:4 (or use it) so the migration's own typecheck gate doesn't choke on it.
  • Give `classifyScorerExecFailure`'s `error` parameter a real type (e.g. `NodeJS.ErrnoException & { stdout?: string; stderr?: string; status?: number }`) instead of `any`, since this is exactly the kind of boundary the migration is meant to type.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.
  • Pull request duplicates other open work — Check for an existing pull request or issue covering this change and coordinate or consolidate before continuing.

Why this is blocked

  • packages/loopover-mcp/lib/local-branch.ts imports `join` from `node:path` at the top of the file but never references it anywhere in the port — TS's emit elides it from the compiled `.js` (visible in the .js diff losing `join`), but the dead import itself will fail a strict typecheck/lint pass if `noUnusedLocals` (or similar) is enabled, which lines up with the `validate`/`validate-code` CI failures this exact PR is meant to unblock.
  • Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.
📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. packages/loopover-mcp/lib/local-branch.ts imports \`join\` from \`node:path\` at the top of the file but never references it anywhere in the port — TS's emit elides it from the compiled \`.js\` \(visible in the .js diff losing \`join\`\), but the dead import itself will fail a strict typecheck/lint pass if \`noUnusedLocals\` \(or similar\) is enabled, which lines up with the \`validate\`/\`validate-code\` CI failures this exact PR is meant to unblock.

2. Linked issue overlaps another open PR — Review the related PRs before spending reviewer time on duplicate work.

CI checks failing

  • validate
  • codecov/patch — 62.80% of diff hit (target 99.00%)
  • validate-code

Decision drivers

  • ❌ Code review — 2 blockers (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7329
Related work ⚠️ Same linked issue: #7419 Another open PR references the same linked issue.
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: 94 registered-repo PR(s), 46 merged, 5 issue(s).
Contributor context ✅ Confirmed Gittensor contributor lourincedaging0-commits; Gittensor profile; 94 PR(s), 5 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 with typed inputs/outputs, and the compiled output preserves the runtime behavior (same exports, logic unchanged) matching the Phase 1 build pipeline, satisfying both the file-format deliverable and no-behavior-change requirement.

Review context
Contributor next steps
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 (validate, codecov/patch, validate-code); Linked issue overlaps another open PR; AI reviewers agree on a likely critical defect: packages/loopover-mcp/lib/local-branch.ts imports `join` from `node:path` at the top of the file but never references it anywhere in the port — TS's emit elides it from the compiled `.js` (visible in the .js diff losing `join`), but the dead import itself will fail a strict typecheck/lint pass if `noUnusedLocals` (or similar) is enabled, which lines up with the `validate`/`validate-code` CI failures this exact PR is meant to unblock.; duplicate of open PR #7419). 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