feat(miner): wire the batch claimer and telemetry exporter into the CLI - #5242
Conversation
Two fully-built, fully-tested modules had zero callers outside their own tests. This wires each into a real CLI command (per JSONbored#4833), without changing either module's logic: - WIP-cap-aware batch claimer (portfolio-queue-manager.claimNextBatch) -> `gittensory-miner queue claim-batch [--global-wip <n>] [--per-repo-wip <n>]`, which also reclaims leases orphaned by a crashed process before selecting. - Anonymized telemetry batch-builder (orb-export.collectOrbExportBatch) -> `gittensory-miner orb export [--enable]`, opt-in (builds nothing unless --enable) and never performs the network POST — it only assembles the HMAC-anonymized batch. The inter-miner claim-conflict adjudicator is deliberately left unwired (maintainer-only per the scope note). No new files, so the package build manifest is untouched. Closes JSONbored#4833
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5242 +/- ##
=======================================
Coverage 94.34% 94.34%
=======================================
Files 473 473
Lines 39982 39982
Branches 14576 14576
=======================================
Hits 37722 37722
Misses 1585 1585
Partials 675 675
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-12 11:13:00 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 5 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
Three modules were fully built and unit-tested but had zero callers outside their own tests. Per #4833, this wires the two in-scope ones into real CLI commands — without changing either module's logic (the third, the inter-miner claim-conflict adjudicator, is deliberately left unwired: connecting it would let the loop act on race-resolution with no human review, which stays maintainer-only per the issue's scope note).
portfolio-queue-manager.claimNextBatch) →gittensory-miner queue claim-batch [--global-wip <n>] [--per-repo-wip <n>] [--json]. Uses the caps-aware diversified selector, and (via the manager) reclaims any lease orphaned by a crashed process before selecting.orb-export.collectOrbExportBatch) →gittensory-miner orb export [--enable] [--json]. Opt-in — builds nothing unless--enable— and never performs the network POST; it only assembles the HMAC-anonymized batch from the localpr_outcomeledger.Both CLI handlers open their stores inside the try/catch (per maintainer review on the prior attempt), so a bad config path / SQLite open failure returns exit code 2 instead of crashing — with
?.-guarded closes infinally; covered by new failure-path tests.Wired at the natural dispatch points:
queue claim-batchslots into the existingrunQueueCli(no bin change), andorb exportgets a one-line route inbin/gittensory-miner.js. No new files, so the package build manifest (package.json) is untouched.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #4833.Validation
git diff --checknpm run build:miner(node --check across the package)npm run test:miner-pack(tarball hygiene)npx vitest run test/unit/miner-*.test.ts— newminer-wire-cli-modulessuite (8) + existing queue/CLI/manager suites pass; the only failure is a pre-existing, environment-specific PID-liveness test (miner-worktree-allocator-collisions) that fails identically on cleanmainand is untouched by this difftypecheckclean on the changed filesIf any required check was skipped, explain why:
packages/gittensory-miner/lib/**+bin/**(hand-written ESM.js+.d.ts, validated bynode --check, nottsc) andtest/unit/**. Nosrc/**, UI, migration, or dependency changes — Codecov ignores this path and the backend/UI/MCP CI jobs are path-skipped.Safety
orb exportbatch HMAC-anonymizes repo/PR identifiers and emits only a low-cardinality reason bucket + decision — never raw names — and stays opt-in and local (no network POST here).Notes
orb exportbuilds the batch but does not send it (matching the module's stated contract — the network POST is the caller's job); this PR just gives the exporter a real invocation surface.Closes #4833