Skip to content
Merged
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
19 changes: 10 additions & 9 deletions pkgs/cold-store-reaper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<filename>`).

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

Expand Down Expand Up @@ -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

Expand Down
11 changes: 6 additions & 5 deletions pkgs/cold-store-reaper/schema.sql
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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')),
Expand Down
Loading