Skip to content

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

Merged
JSONbored merged 3 commits into
JSONbored:mainfrom
oktofeesh1:claude/issue-7329-mcp-phase2
Jul 20, 2026
Merged

chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291)#7419
JSONbored merged 3 commits 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 100% lines, 163 tests total across test/unit/local-branch.test.ts, test/unit/local-scorer-adapter.test.ts, and test/unit/coding-agent-miner.test.ts. Test coverage includes defaultBaseRef's origin/HEAD -> origin/main -> origin/master precedence (via git update-ref-faked remote-tracking refs), 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, 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: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.
  • This supersedes a first attempt (PR chore(mcp): convert lib/local-branch.js to TypeScript (Phase 2 of #7291) #7417) that was auto-closed on a genuine 97.17% codecov/patch shortfall (8 lines); the coverage gaps identified there are now closed or documented as accepted residuals per the Validation section above.
  • 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
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).
@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner July 20, 2026 08:47
@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

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.34%. Comparing base (fe3a344) to head (2dc251f).

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     
Flag Coverage Δ
shard-1 32.63% <54.71%> (-0.01%) ⬇️
shard-2 36.11% <67.39%> (+0.04%) ⬆️
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 100.00% <100.00%> (ø)

... 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
JSONbored
JSONbored previously approved these changes Jul 20, 2026
@oktofeesh1
oktofeesh1 marked this pull request as draft July 20, 2026 08:58
@loopover-orb

loopover-orb Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-20 09:19:46 UTC

13 files · no blockers · CI pending · blocked

⏸️ Suggested Action - Manual Review

Decision drivers

  • ✅ Code review — No blockers (No AI review summary)
  • ✅ 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 (draft PR; 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
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 9 meaningful terms. (issue #7328)
  • Related work: Titles/paths share 8 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 3 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

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).
@oktofeesh1
oktofeesh1 marked this pull request as ready for review July 20, 2026 09:19
@JSONbored
JSONbored merged commit 93fc7b1 into JSONbored:main Jul 20, 2026
21 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
12 tasks
@JSONbored

Copy link
Copy Markdown
Owner

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.

@JSONbored JSONbored added mod:warning Gittensor contributor context gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. labels 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. gittensor:priority Maintainer-selected Gittensor priority — scores a 1.5x multiplier. mod:warning Gittensor contributor context

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)

2 participants