Skip to content

feat(miner-foundation): local claim-ledger SQLite schema + CRUD in packages/gittensory-miner #2314

Description

@JSONbored

Phase 2's soft-claim adjudication (sibling issues) needs a place to persist "I'm working on issue #N in repo X" locally, 100% client-side (per the fixed architecture: all miner run-state/claim ledger is local SQLite, never required to phone home). This issue is pure foundation: schema + CRUD only, no adjudication logic and no network calls, so it's zero autonomous-write risk and independent of everything else in this phase.

Mirror the self-host infra patterns already in src/selfhost/ (e.g. migrate.ts's migration-runner shape) for the migration-file convention, but this is a NEW local SQLite file scoped to packages/gittensory-miner/, not the shared D1 migrations/ directory (that directory is for the hosted Worker's D1 schema — keep the miner's local store fully separate).

Deliverables

  • packages/gittensory-miner/src/claim-ledger/schema.sql (or equivalent inline schema) defining a claims table: id, repo_full_name, issue_number, claimed_at, status (active|released|expired), note
  • packages/gittensory-miner/src/claim-ledger/store.tsopenClaimLedger(dbPath), recordClaim(...), releaseClaim(...), listClaims(filter) — using node:sqlite or better-sqlite3 (pick whichever this package's dependency policy prefers; document the choice)
  • Every write path is idempotent (claiming an already-actively-claimed issue is a no-op, not a duplicate row)
  • Unit tests covering create/list/release/re-claim-after-release, using a temp SQLite file per test
  • No network calls anywhere in this module

References

  • src/selfhost/migrate.ts (self-host local migration-runner pattern to mirror for schema versioning)
  • migrations/0010_agent_orchestrator.sql (the shape of an existing agent_runs-style ledger table, for column-naming convention inspiration only — this is a SEPARATE local store, not a D1 migration)
  • Fixed architecture note in the phase brief: "All local miner state ... is 100% client-side (SQLite or similar) — never required to phone home for core operation"

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions