diff --git a/packages/gittensory-miner/lib/claim-ledger.js b/packages/gittensory-miner/lib/claim-ledger.js index 7e4a496da..c71560577 100644 --- a/packages/gittensory-miner/lib/claim-ledger.js +++ b/packages/gittensory-miner/lib/claim-ledger.js @@ -81,6 +81,14 @@ export function openClaimLedger(dbPath = resolveClaimLedgerDbPath()) { // LOCAL bookkeeping only: this table records which issues this miner instance has soft-claimed on this // machine. It does NOT adjudicate contested duplicates — sibling miners claiming the same issue are // resolved elsewhere via `isDuplicateClusterWinnerByClaim` from `@jsonbored/gittensory-engine` (#3355). + // + // miner_claims schema (#3352): + // repo_full_name TEXT NOT NULL, + // issue_number INTEGER NOT NULL, + // claimed_at TEXT NOT NULL, + // status TEXT NOT NULL CHECK(status IN ('active','released','expired')), + // UNIQUE (repo_full_name, issue_number) — one row per claimed issue (id is the surrogate primary key). + // Release/expire moments are recorded via status transitions, not a separate released_at column. db.exec(` CREATE TABLE IF NOT EXISTS miner_claims ( id INTEGER PRIMARY KEY AUTOINCREMENT, diff --git a/test/unit/miner-claim-ledger.test.ts b/test/unit/miner-claim-ledger.test.ts index 07bb9c645..b0cb62c73 100644 --- a/test/unit/miner-claim-ledger.test.ts +++ b/test/unit/miner-claim-ledger.test.ts @@ -141,6 +141,17 @@ describe("gittensory-miner claim ledger (#2314)", () => { expect(source).toContain("isDuplicateClusterWinnerByClaim"); }); + it("documents the miner_claims schema columns and uniqueness constraint (#3352)", () => { + const source = readFileSync("packages/gittensory-miner/lib/claim-ledger.js", "utf8"); + expect(source).toContain("miner_claims schema (#3352)"); + expect(source).toContain("repo_full_name TEXT NOT NULL"); + expect(source).toContain("issue_number INTEGER NOT NULL"); + expect(source).toContain("claimed_at TEXT NOT NULL"); + expect(source).toContain("status TEXT NOT NULL CHECK(status IN ('active','released','expired'))"); + expect(source).toContain("UNIQUE (repo_full_name, issue_number)"); + expect(source).toContain("not a separate released_at column"); + }); + it("claimIssue and listActiveClaims expose the foundation-phase API surface (#3351)", () => { const ledger = tempLedger(); const claim = ledger.claimIssue("o/a", 42, "via-alias");