Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/gittensory-miner/lib/claim-ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions test/unit/miner-claim-ledger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading