Skip to content

chore(miner): migrate batch 2.1 utility modules to TypeScript - #7320

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
joaovictor91123:chore/miner-ts-migration-batch-2.1-7300
Jul 19, 2026
Merged

chore(miner): migrate batch 2.1 utility modules to TypeScript#7320
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
joaovictor91123:chore/miner-ts-migration-batch-2.1-7300

Conversation

@joaovictor91123

Copy link
Copy Markdown
Contributor

Closes #7300

Summary

  • Converts 8 leaf-most, lowest-fan-in packages/loopover-miner/lib modules from plain .js to real, compiler-verified TypeScript: env-file-indirection, deny-check, cli, chat-action-dispatch, ams-health-server, replay-task-bridge, chat-governor-actions, chat-portfolio-actions.
  • Follows the in-place-emit pattern the Phase 1 build pipeline (chore(miner): add a real tsc build pipeline for loopover-miner (#7290) #7299) already wired up (lib/foo.ts compiles to lib/foo.js next to it; no import-path changes for any consumer).
  • Each file's previously hand-maintained .d.ts sibling is now tsc-generated instead of hand-written.
  • No behavior change. Two latent quirks surfaced and preserved exactly during conversion (verified against existing tests): buildLeakageContextFromSnapshot's knownCommitShas array keeps undefined entries for malformed commits (never filtered), and buildReplayCandidateFromSnapshot nulls out non-string identity fields rather than leaving them undefined.

Scope checklist

Validation checklist

  • npm run build --workspace @loopover/miner (tsc + node --check on every compiled output) passes clean
  • npm run typecheck (repo-wide) passes clean
  • All 8 modules' existing test files pass unmodified: miner-env-file-indirection, miner-cli-deny-check, miner-cli, miner-chat-action-dispatch, miner-ams-health-server, miner-replay-task-bridge, miner-chat-governor-actions, miner-chat-portfolio-actions (107 tests total)

Safety checklist

  • No secrets, tokens, wallets, hotkeys/coldkeys, trust scores, or reward/payout values touched
  • No changes to site/, CNAME, or **/lovable/**

Converts env-file-indirection, deny-check, cli, chat-action-dispatch,
ams-health-server, replay-task-bridge, chat-governor-actions, and
chat-portfolio-actions from plain .js to real, compiler-verified
TypeScript, following the in-place-emit pattern the Phase 1 build
pipeline (JSONbored#7299) already wired up. Each file's hand-maintained .d.ts
sibling is now tsc-generated instead. No behavior change; existing
tests pass unmodified.

Closes JSONbored#7300
@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:25:22 UTC

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

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a mechanical, in-place .js→.ts conversion of 8 leaf-most lib modules for the miner package (batch 2.1 of the phased TS migration), closing #7300. The compiled .js/.d.ts outputs I can see (chat-governor-actions, chat-portfolio-actions, ams-health-server, chat-action-dispatch, cli.js, deny-check.js) match the pre-existing runtime logic line-for-line modulo formatting and JSDoc→native-type removal, and the PR explicitly documents two preserved quirks (unfiltered undefined SHAs, null-coercion of non-string identity fields) rather than silently changing them. CI is green across build/typecheck/tests and the diff is scoped to the 8 files plus their generated siblings as claimed.

Nits — 6 non-blocking
  • packages/loopover-miner/lib/replay-task-bridge.ts:79-96 — buildLeakageContextFromSnapshot/buildReplayCandidateFromSnapshot use `as ForwardRefContext`/`as FreezePointCandidate` casts instead of letting the compiler verify the returned object structurally matches; if replay-task-generation.js's exported types ever add a required field, this cast will silently hide the mismatch instead of failing the build.
  • packages/loopover-miner/lib/deny-check.ts (parseDenyCheckArgs) carries pre-existing branch density (~13) over the threshold — not introduced by this PR, but worth a follow-up split now that it's type-checked and easier to refactor safely.
  • No new test files were added, which is expected for a pure type migration, but it's worth confirming in the PR description (already partially done) that the 107 existing tests actually exercise the regenerated .js output and not stale cached artifacts.
  • Consider replacing the `as X` casts in replay-task-bridge.ts with object literals whose properties are individually typed, so tsc catches drift in the upstream ForwardRefContext/FreezePointCandidate shapes instead of relying on the cast.
  • If a future batch touches deny-check.ts's parseDenyCheckArgs again, extract the per-flag parsing into small helper functions to bring cyclomatic complexity under the repo's own threshold.
  • 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 #7300
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: 111 registered-repo PR(s), 53 merged, 4 issue(s).
Contributor context ✅ Confirmed Gittensor contributor joaovictor91123; Gittensor profile; 111 PR(s), 4 issue(s).
Improvement ℹ️ None detected risk: low · value: none · LLM: moderate
Linked issue satisfaction

Addressed
The diff converts all 8 files named in the issue (env-file-indirection, deny-check, cli, chat-action-dispatch, ams-health-server, replay-task-bridge, chat-governor-actions, chat-portfolio-actions) to real .ts sources with compiled .js/.d.ts output via the existing tsc pipeline, matching the batch 2.1 scope and no-behavior-change requirement.

Review context
  • Author: joaovictor91123
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, C++, CSS, Rust, TypeScript
  • Official Gittensor activity: 111 PR(s), 4 issue(s).
  • Related work: Titles/paths share 7 meaningful terms. (issue #7301)
  • Related work: Titles/paths share 7 meaningful terms. (issue #7302)
  • Related work: Titles/paths share 6 meaningful terms. (PR #7319)
  • 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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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 leaf-most, lowest-fan-in utility packages/loopover-miner/lib modules to TypeScript (batch 2.1 of 5 (Phase 2))

1 participant