Skip to content

chore(miner): migrate batch 4.6 foundational lib modules to TypeScript (#7314) - #7336

Merged
loopover-orb[bot] merged 4 commits into
JSONbored:mainfrom
andriypolanski:chore/miner-ts-batch-4.6-7314-v4
Jul 19, 2026
Merged

chore(miner): migrate batch 4.6 foundational lib modules to TypeScript (#7314)#7336
loopover-orb[bot] merged 4 commits into
JSONbored:mainfrom
andriypolanski:chore/miner-ts-batch-4.6-7314-v4

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Closes #7314

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • 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 (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • 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:

  • No behavior change; existing miner unit tests for these eight modules continue to pass unmodified (243 related tests across the listed suites). Codecov patch applies only to src/** — this PR only touches packages/loopover-miner/lib/**. Ran npm run build:miner, npm run test:miner-pack, git diff --check, and npm run actionlint. Full test:ci / UI / workers / coverage chain was exercised on the sibling batch 4.7 PR (chore(miner): migrate batch 4.7 foundational lib modules to TypeScript (#7315) #7319) against the same pipeline; this migration is the same class of change.

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.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

UI Evidence

N/A — no visible UI/frontend/docs change.

Notes

andriy-polanski and others added 4 commits July 19, 2026 16:29
JSONbored#7314)

Convert eight foundational loopover-miner lib modules from plain .js +
hand-maintained .d.ts to real TypeScript under the existing in-place
tsc emit pipeline, with zero behavior change.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.04%. Comparing base (4bcac8c) to head (7c127b2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7336      +/-   ##
==========================================
+ Coverage   91.03%   91.04%   +0.01%     
==========================================
  Files         714      714              
  Lines       72102    72121      +19     
  Branches    19163    19322     +159     
==========================================
+ Hits        65635    65662      +27     
+ Misses       5427     5419       -8     
  Partials     1040     1040              
Flag Coverage Δ
shard-1 41.32% <33.77%> (-0.42%) ⬇️
shard-2 35.61% <37.52%> (-0.12%) ⬇️
shard-3 31.61% <56.07%> (-0.02%) ⬇️
shard-4 31.06% <39.95%> (-1.54%) ⬇️
shard-5 31.09% <28.25%> (+0.52%) ⬆️
shard-6 43.74% <45.47%> (+0.18%) ⬆️

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

Files with missing lines Coverage Δ
...ackages/loopover-miner/lib/chat-action-registry.ts 100.00% <100.00%> (ø)
...ackages/loopover-miner/lib/contribution-profile.ts 100.00% <100.00%> (ø)
...ages/loopover-miner/lib/github-token-resolution.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/http-retry.ts 100.00% <100.00%> (ø)
...ackages/loopover-miner/lib/policy-verdict-cache.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/repo-clone.ts 100.00% <100.00%> (ø)
...s/loopover-miner/lib/submission-freshness-check.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/worktree-allocator.ts 100.00% <100.00%> (ø)

... and 8 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 19, 2026
@loopover-orb

loopover-orb Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-19 18:16:25 UTC

29 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a straightforward .js+.d.ts → .ts migration for eight foundational miner lib modules, regenerated through the existing tsc emit pipeline so the compiled .js/.d.ts output is byte-equivalent in shape to before. The .ts sources faithfully preserve the runtime logic (worktree-allocator's SQLite orphan-reclaim, repo-clone's in-process/cross-process locking, chat-action-registry's governor-gated handler contract) and CI (typecheck, tests, coverage) is green on this exact commit, so the 'zero behavior change' claim is credible from the diff. The one thing worth double-checking is that this migration batch doesn't quietly change any exported type signatures consumers outside this package rely on, since the .d.ts files are now generated rather than hand-maintained.

Nits — 5 non-blocking
  • The external brief flags several magic numbers (429/403/500 in http-retry, 9/63 in github-token-resolution's profile-name regex) that predate this PR as plain JS constants — now that they're real TS, consider naming them (e.g. `HTTP_TOO_MANY_REQUESTS`, `HTTP_FORBIDDEN`) for readability, though this is pre-existing style, not new.
  • packages/loopover-miner/lib/worktree-allocator.ts:243-256 and repo-clone.ts's acquire/lock paths sit at control-flow depth 5 per the brief; worth a follow-up extraction if these functions grow further, but not blocking for a pure migration.
  • Test additions are thin relative to source lines added (129 vs 2627), but that's expected for a mechanical .js→.ts port where the 243 existing miner unit tests already cover behavior — flagging only so the coverage numbers in CI are the real signal here, not line counts.
  • If not already tracked, consider a short note in the PR description confirming no `.d.ts` public export was narrowed/widened unintentionally during the tsc regen, since that's the main risk class for this kind of migration.
  • packages/loopover-miner/lib/github-token-resolution.ts:122 (`fetchLiveGitHubTokenFromSession`) swallows all fetch errors into `null` — confirm callers (resolveGitHubToken) are fine treating a transient network blip identically to 'no token configured', which the code comment does address for the caching behavior but is worth calling out explicitly in the module doc if not already.

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 #7314
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: 166 registered-repo PR(s), 111 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 166 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR converts the batch's files to real .ts under the existing in-place tsc emit pipeline, and the visible diff shows worktree-allocator.ts and repo-clone.ts as properly typed conversions with the corresponding regenerated .js output, matching the issue's conversion pattern and stated scope of all eight files.

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 166 PR(s), 22 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #7300)
  • Related work: Titles/paths share 7 meaningful terms. (issue #7301)
  • Related work: Titles/paths share 7 meaningful terms. (issue #7302)
  • 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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

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(miner): migrate foundational, most-depended-on packages/loopover-miner/lib modules to TypeScript (batch 4.6 of 8 (Phase 4))

2 participants