Skip to content

chore(miner): migrate batch 4.7 foundational lib modules to TypeScript (#7315) - #7319

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
andriypolanski:chore/miner-ts-batch-4.7-7315
Jul 19, 2026
Merged

chore(miner): migrate batch 4.7 foundational lib modules to TypeScript (#7315)#7319
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
andriypolanski:chore/miner-ts-batch-4.7-7315

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Closes #7315

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 (199 tests across the related suites). Codecov patch applies only to src/** — this PR only touches packages/loopover-miner/lib/**. Local cf-typegen:check drifts on this machine due to secret-vs-literal wrangler output and was not regenerated (unrelated to this PR); CI should validate against a clean env. test:coverage had 10 failures only in selfhost-ams-reporting.test.ts (sqlite3 CLI missing locally); unrelated to this migration. Pre-existing adm-zip advisories via github-actionlint remain (no fix available; not introduced here). Also ran: npm run build:miner, npm run test:miner-pack, npm run test:miner-deployment-docs-audit, drift checks, rees:test, and the remaining test:ci chain after the early lint/env checks.

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

Made with Cursor

JSONbored#7315)

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.

@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 16:22:35 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR converts eight loopover-miner lib modules (prediction-ledger, run-state, claim-ledger, forge-config, store-maintenance, schema-version, local-store, governor-state) from hand-maintained .js+.d.ts to real .ts source under the existing tsc emit pipeline, with the .js/.d.ts regenerated as build output. The new .ts files are essentially line-for-line ports of the existing .js logic (SQLite CRUD, migrations, purge/retention helpers) with added type annotations — I traced claim-ledger.ts and governor-state.ts against their .js counterparts and the runtime logic (UNIQUE constraints, BEGIN IMMEDIATE transactions, ON CONFLICT guards) is unchanged. Description claims zero behavior change and closes a linked open issue (#7315), and CI is green across typecheck/build/tests.

Nits — 6 non-blocking
  • packages/loopover-miner/lib/claim-ledger.ts and governor-state.ts are now 464/482 lines respectively, over this repo's apparent 400-line file-size convention — worth a follow-up split now that they're real .ts modules and easier to refactor.
  • No new test files are added; since this is purely a compile-target migration (source .js logic unchanged) that's reasonable, but confirm existing suites actually import the new .ts paths (not stale .js) so coverage isn't silently exercising dead files.
  • The regenerated .js output shows inconsistent indentation vs the hand-written original in the diff (e.g. claim-ledger.js hunk) — cosmetic since it's tsc-emitted, but worth confirming .gitignore/generated-file policy still excludes these from manual edits going forward.
  • Double check the build pipeline from chore(miner): add a real tsc build pipeline for loopover-miner (#7290) #7299 that these .js/.d.ts are marked generated (e.g. in .gitattributes or CI diff-check) so future contributors don't hand-edit the emitted output instead of the new .ts source.
  • Consider splitting claim-ledger.ts's transactional claim logic (claimIssue/claimIssueWithinCap) into a separate module given the file's now over the repo's 400-line convention.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

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 #7315
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: 162 registered-repo PR(s), 110 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 162 PR(s), 22 issue(s).
Improvement ℹ️ None detected risk: low · value: none · LLM: moderate
Linked issue satisfaction

Addressed
The diff adds real .ts files for all eight listed modules (governor-state.ts, claim-ledger.ts, prediction-ledger.ts shown, others presumably included given PR description) with typed exports, and modifies the corresponding .js files consistent with tsc-regenerated output rather than hand-maintained sources, matching the in-place-emit pattern from Phase 1.

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: Python, TypeScript, JavaScript, Rust, Cuda, Kotlin, MDX, Scala
  • Official Gittensor activity: 162 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.7 of 8 (Phase 4))

2 participants