Skip to content

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

Closed
oktofeesh1 wants to merge 1 commit into
JSONbored:mainfrom
oktofeesh1:claude/issue-7329-mcp-phase2
Closed

chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291)#7417
oktofeesh1 wants to merge 1 commit into
JSONbored:mainfrom
oktofeesh1:claude/issue-7329-mcp-phase2

Conversation

@oktofeesh1

Copy link
Copy Markdown
Contributor

Summary

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves.

Closes #7329

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally -- local-branch.ts reaches ~99% lines / ~96%+ branches across 99 tests (73 in test/unit/local-branch.test.ts, 26 in test/unit/local-scorer-adapter.test.ts), including new coverage for defaultBaseRef's origin/HEAD -> origin/main -> origin/master precedence (via git update-ref-faked remote-tracking refs, no real network needed), a real git type-change status (regular file <-> symlink), MCP workspace-root path resolution, and classifyScorerExecFailure's failure-classification branches (a circular-JSON-metadata case exercising the message-based JSON check, a SIGKILL-terminated child, and a spawn/command-not-found case). A handful of defensive fallbacks provably unreachable given their sole caller's own guarantees were simplified (matching the pattern already used in this migration's packages/loopover-miner batches), and one genuinely-unreachable git status code (C/copied -- collectChangedFiles only ever passes -M, never -C) is marked with a v8 ignore comment rather than deleted, since it's a real status git can produce with different flags.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

  • Not skipped, but note: npm audit --audit-level=moderate reports a pre-existing high-severity adm-zip advisory (no fix available) via github-actionlint, inherited unchanged from main and unrelated to this PR's packages/loopover-mcp scope.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. (N/A -- no such changes.)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (N/A -- pure internal helper refactor, no MCP tool surface changed.)
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. (N/A -- no UI changes.)
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

Notes

  • No behavior change, as the issue requires: every converted function's runtime logic and exported signature is unchanged from the original hand-written .js.
  • Two existing test files (local-branch.test.ts, local-scorer-adapter.test.ts) had a @ts-expect-error suppression for dynamically importing what was previously an untyped .js module; these are now stale (TypeScript resolves the import to the new .ts source directly) and were removed.

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
@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner July 20, 2026 08:26
@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 97.17314% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.28%. Comparing base (0d896ce) to head (43f4ac6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/loopover-mcp/lib/local-branch.ts 97.17% 1 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7417      +/-   ##
==========================================
+ Coverage   91.22%   91.28%   +0.06%     
==========================================
  Files         716      716              
  Lines       72801    72826      +25     
  Branches    20885    20990     +105     
==========================================
+ Hits        66414    66481      +67     
+ Misses       5347     5294      -53     
- Partials     1040     1051      +11     
Flag Coverage Δ
shard-1 32.05% <53.00%> (-0.02%) ⬇️
shard-2 41.76% <69.61%> (+0.05%) ⬆️
shard-3 37.55% <0.00%> (-0.02%) ⬇️
shard-4 42.90% <0.00%> (-0.03%) ⬇️
shard-5 34.74% <0.00%> (-0.02%) ⬇️
shard-6 25.04% <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 97.17% <97.17%> (ø)

... 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:34:59 UTC

11 files · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

  • AI review already in progress for this PR head: Another LoopOver pass is already running the AI review for this exact PR head. This pass is skipping to avoid a duplicate LLM call.

Review summary
AI review is already running for this PR head in another LoopOver pass. LoopOver is holding this PR for manual review until that pass completes.

Nits — 1 non-blocking
  • AI review already in progress for this PR head — The gate is held for a human reviewer rather than passed automatically; it re-evaluates once the in-flight review completes or on the next update.

CI checks failing

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

Decision drivers

  • ✅ Code review — No blockers (No AI review summary)
  • ⚠️ Gate result — Not blocking (Advisory; not blocking this PR.)
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: 81 registered-repo PR(s), 64 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor oktofeesh1; Gittensor profile; 81 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The PR adds packages/loopover-mcp/lib/local-branch.ts as a full TypeScript rewrite with typed interfaces and converts the build to emit local-branch.js from it, directly fulfilling the issue's core ask; the description also confirms tests pass unmodified and CLI/build validation was run.

Review context
  • Author: oktofeesh1
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: JavaScript, MDX, Python, TypeScript
  • Official Gittensor activity: 81 PR(s), 0 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.

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