Skip to content

feat(miner): add local claims ledger CLI#3314

Open
jony376 wants to merge 1 commit into
JSONbored:mainfrom
jony376:feat/miner-claims-ledger-cli
Open

feat(miner): add local claims ledger CLI#3314
jony376 wants to merge 1 commit into
JSONbored:mainfrom
jony376:feat/miner-claims-ledger-cli

Conversation

@jony376

@jony376 jony376 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an operator-facing gittensory-miner claims CLI for the existing local soft-claim ledger. The SQLite store (claim-ledger.js) and expiry helper (claim-ledger-expiry.js) already existed, but unlike ledger, governor, and plan there was no command-line surface to list, record, release, or sweep claims from a laptop.

New subcommands:

  • claims list [--repo <owner/repo>] [--status active|released|expired] [--json]
  • claims claim <owner/repo> <issue#> [--note <text>] [--json]
  • claims release <owner/repo> <issue#> [--json]
  • claims sweep [--max-age-days <n>] [--json]

Commands dispatch before the npm update check (offline/local, same as ledger/governor).

No upstream issue was filed: jony376 lacks CreateIssue permission on this repository. This PR is self-contained against that gap.

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 an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run typecheck
  • npx vitest run test/unit/miner-claim-ledger-cli.test.ts (9/9 passed)
  • npm --workspace @jsonbored/gittensory-miner run build
  • 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:

  • Remaining full-repo gate steps will run in CI on this PR.

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

Not applicable — miner CLI only.

Notes

  • release is idempotent for already-released rows; missing/non-active releases fail closed with claim_not_found_or_not_active.
  • Help text preserves the existing hooks check entry and all prior commands.

Made with Cursor

Expose list, claim, release, and sweep subcommands for the existing local
claim ledger so operators can manage soft claims without importing store
modules directly.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jony376 jony376 requested a review from JSONbored as a code owner July 5, 2026 01:43
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 5, 2026
@superagent-security

Copy link
Copy Markdown

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@superagent-security

Copy link
Copy Markdown

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

@gittensory-orb gittensory-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. label Jul 5, 2026
@gittensory-orb

gittensory-orb Bot commented Jul 5, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-05 06:51:10 UTC

6 files · 1 AI reviewer · no blockers · readiness 73/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): packages/gittensory-miner/package.json (matched **/package.json).

Review summary
This adds a coherent local `gittensory-miner claims` CLI over the existing claim ledger and wires it ahead of the opportunistic update check, matching the offline/local command contract. The argument parsing, ledger mutation paths, release idempotency, and sweep behavior are covered against the real SQLite-backed ledger path, and the build script now syntax-checks the new CLI module. I do not see a reachable correctness defect in the changed code.

Nits — 7 non-blocking
  • nit: packages/gittensory-miner/lib/claim-ledger-cli.js:173 hard-codes the table column widths inline, which makes the renderer harder to adjust consistently if the claim table grows; consider moving those widths to named constants near `MS_PER_DAY`.
  • nit: packages/gittensory-miner/lib/claim-ledger-cli.js:318 treats `gittensory-miner claims --help` as an unknown subcommand even though the usage text says to run `--help` for details; either support that path or change the message to point at the top-level help.
  • nit: test/unit/miner-claim-ledger-cli.test.ts:191 only verifies that some dispatches logged, so it would not catch a subcommand accidentally dispatching to the wrong handler; asserting the resulting ledger state after each dispatch would make the coverage more meaningful.
  • packages/gittensory-miner/lib/claim-ledger-cli.js:173: extract table widths, for example `const CLAIMS_TABLE_WIDTHS = { repo: 24, issue: 5, status: 10, claimedAt: 24, note: 16 };`, then use those in both the header and row formatting.
  • packages/gittensory-miner/lib/claim-ledger-cli.js:318: handle `undefined`, `--help`, and `-h` with the usage text instead of reporting them as unknown subcommands, or change `CLAIMS_USAGE` so it does not promise a claims-level help path.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 1013 registered-repo PR(s), 707 merged, 41 issue(s).
Contributor context ✅ Confirmed Gittensor contributor jony376; Gittensor profile; 1013 PR(s), 41 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: jony376
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 1013 PR(s), 41 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Explain no-issue PR.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
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.

🟩 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.

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.73%. Comparing base (1e9284b) to head (0dfa60a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3314   +/-   ##
=======================================
  Coverage   93.73%   93.73%           
=======================================
  Files         276      276           
  Lines       30381    30381           
  Branches    11073    11073           
=======================================
  Hits        28479    28479           
  Misses       1257     1257           
  Partials      645      645           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please link this to the corresponding issues/sub-issues, as there's an open issue/task for working on the claims ledger stuff:

#2291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 1.25x multiplier. manual-review Gittensor contributor context

Projects

Development

Successfully merging this pull request may close these issues.

2 participants