feat(miner): add tenant-scoping columns to all four local ledger schemas - #6340
Conversation
…mas (#4939) Adds an additive tenant_id column to every local SQLite store the miner's ledger logic touches -- run-state, claim-ledger, portfolio-queue, event-ledger -- following each file's own established schema-migration convention (applySchemaMigrations + PRAGMA user_version, the same defensive column-presence guard as every prior additive migration in these files, e.g. portfolio-queue.js's leased_at/attempts_count additions). Schema-only, per #4783's tenancy spec informing this issue: nothing reads or writes tenant_id yet (no consumer exists until a future hosted deployment populates it), so self-host behavior is byte-identical -- every migrated row's tenant_id is NULL, exactly like every other optional column this file family already ships that way. Each store gets two new tests: a legacy-file migration test proving the column lands correctly with existing rows untouched, and a regression test proving a file that already has the column (a partial prior migration attempt) doesn't crash on re-open. Also updates miner-migrate-cli.test.ts's hardcoded target-version assertion, which was pinned to the pre-existing migration count.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-16 02:54:02 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver 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/loopover-commands 🧪 Experimental — new and may change. 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6340 +/- ##
=======================================
Coverage 95.60% 95.60%
=======================================
Files 596 596
Lines 47140 47152 +12
Branches 15008 15008
=======================================
+ Hits 45068 45080 +12
Misses 1290 1290
Partials 782 782
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Summary
tenant_id TEXTcolumn to every local SQLite store the miner's ledger logic touches: run-state, claim-ledger, portfolio-queue, event-ledger.applySchemaMigrations+PRAGMA user_version), including the same defensive column-presence guard used by every prior additive migration in these files (e.g. portfolio-queue.js'sleased_at/attempts_countadditions).tenant_idcolumn, not physical per-tenant sharding.Test plan
versionAfterfor portfolio-queue)npm run test:cigate greennpm audit --audit-level=moderatecleanCloses #4939