From c6b16d6e8885afbea4a0d735f81ccc5b82bd37d5 Mon Sep 17 00:00:00 2001 From: Muse Sweep Date: Mon, 26 Oct 2026 15:33:33 -0500 Subject: [PATCH] =?UTF-8?q?docs(cold-store-reaper):=20D1=20already=20carri?= =?UTF-8?q?es=20the=20evicted/trash=20CHECKs=20=E2=80=94=20caveat=20text?= =?UTF-8?q?=20corrected=20(#984)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/cold-store-reaper/README.md | 19 ++++++++++--------- pkgs/cold-store-reaper/schema.sql | 11 ++++++----- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pkgs/cold-store-reaper/README.md b/pkgs/cold-store-reaper/README.md index 50cec23c6b..c56f910d42 100644 --- a/pkgs/cold-store-reaper/README.md +++ b/pkgs/cold-store-reaper/README.md @@ -156,11 +156,11 @@ deleted, so Drive's own trash grace applies — and one `transfer_ledger` row per file is written (`direction='trash'`, `kind='backup-prune'`, `ref=`). -One migration caveat: the `'trash'` ledger direction is a schema v1.1 +One migration note: the `'trash'` ledger direction is a schema v1.1 extension (see `schema.sql`). Local manifests are migrated in place on -first open, but the **D1 copy of the schema needs the same one-line -CHECK change** before prune rows can sync — until then `sync-manifest` -fails on the `transfer_ledger` statement with D1's own error text. +first open, and the **D1 copy of the schema already carries the same +CHECK change** (verified 2026-10-26, #984 — D1 already held real +'trash' ledger rows), so prune rows sync normally. ### Scripts @@ -288,11 +288,12 @@ manifest, and recorded in the ledger (`direction='trash'`, does not abort the rest. The `'evicted'` state is a schema v1.2 extension (see `schema.sql`): -local manifests are migrated in place on first open, but the **D1 -copy of the schema needs the same one-line CHECK change** before -evicted rows can sync — until then `sync-manifest` fails on the -`objects` statement with D1's own error text (the same caveat the -v1.1 `'trash'` direction had). +local manifests are migrated in place on first open, and the **D1 +copy of the schema already carries the same CHECK change** (verified +2026-10-26, #984: D1 `sqlite_master` read plus a probe `sync-manifest` +carrying an 'evicted' row succeeded; the probe rows were removed +afterwards), so evicted rows sync normally — the same applied state +the v1.1 `'trash'` direction was verified in. ## Manifest sync → D1 diff --git a/pkgs/cold-store-reaper/schema.sql b/pkgs/cold-store-reaper/schema.sql index ef61287e58..e92064a7a6 100644 --- a/pkgs/cold-store-reaper/schema.sql +++ b/pkgs/cold-store-reaper/schema.sql @@ -1,9 +1,10 @@ -- Cold-store manifest schema v1 (2026-10-25) -- Canonical index for the Drive cold store. Drive holds bundles; this DB is the system. -- v1.2 (reaper v4): objects.state gains 'evicted' — still cold in Drive, but --- deleted from R2 by `cold-store evict`. The D1 copy of this schema needs the --- same one-line CHECK change before evicted rows can sync; sync-manifest --- surfaces D1's own error text until then. +-- deleted from R2 by `cold-store evict`. The D1 copy of this schema already +-- carries the same CHECK change (verified 2026-10-26, #984: D1 sqlite_master +-- read plus a probe sync-manifest with an 'evicted' row succeeded; the probe +-- rows were removed afterwards). CREATE TABLE IF NOT EXISTS objects ( hash TEXT PRIMARY KEY, -- sha256 hex of object content size INTEGER NOT NULL, @@ -43,8 +44,8 @@ CREATE INDEX IF NOT EXISTS idx_members_hash ON members(object_hash); -- Reaper/rehydrator budget ledger: one row per action, 24h rolling window computed from ts. -- v1.1 (reaper v3): direction gains 'trash' for backup-prune rows (kind='backup-prune'). --- The D1 copy of this schema needs the same one-line CHECK change before prune --- rows can sync; sync-manifest surfaces D1's own error text until then. +-- The D1 copy of this schema already carries the same CHECK change +-- (verified 2026-10-26, #984 — D1 already held real 'trash' ledger rows). CREATE TABLE IF NOT EXISTS transfer_ledger ( id INTEGER PRIMARY KEY AUTOINCREMENT, ts TEXT NOT NULL DEFAULT (datetime('now')),