GeezerVison is showing github.com — CF-5e (#14945): move the push registry tables from fleet-platform Turso to D1 fleet-platform · Issue #15561 · developing-today/code
CF-5e (#14945): move the push registry tables from fleet-platform Turso to D1 fleet-platform #15561DescriptionWhat this is
A follow-on slice of CF-5 (#14945) under the #14866 Cloudflare-first programme, filed by the programme coordinator on the evidence of the CF-5 ledgers lane.
Owner ruling 2026-11-26 (#14866 comment 7189808145): everything moves to Cloudflare with D1 as the database. The four CF-5 ledger tables have been copied into D1 fleet-platform and hash-verified (record on #14968; read path in PR #15544, merged; flip in PR #15559). The ledgers lane found that the push registry tables (push_endpoints and its sibling registry tables in the fleet-platform Turso store, owned by the #14084 push unification) are still Turso-only and absent from D1 fleet-platform. Under the ruling they need their own D1 move — this issue is that move.
Scope
- Enumerate the exact push registry table set in the fleet-platform Turso store (start from
push_endpoints; include every table the push registry/sender reads or writes, and record the list on this issue before copying anything).
- Create the tables in D1
fleet-platform with matching schema and indexes.
- Copy the data and hash-verify it, following the procedure the ledgers lane recorded on CF-5b (#14945): M4 ledger surfaces hosted — /alerts, /notifications, /dns, /comments #14968 (comment 7190724486) — counts plus hashes, evidence recorded on this issue.
- Retarget the push registry read/write path (registry readers and the one sender, per PM push unification: one registry, one sender, the Android app as a first-class endpoint #14084) to D1 behind the same store-switch pattern the ledger move used, so the flip is a config change with a recorded rollback.
- Record a rollback note on this issue BEFORE the flip. At flip time, re-run the refresh once (any Turso writes since the copy drift D1 until writers retarget), then flip and verify live: a real registration lookup and a test send through the D1-backed registry.
- The Turso copy is retired only after the D1 side is verified live. Laptop sync for these tables is turned off only after that verification, per the ruling's order of operations.
Acceptance
Coordination
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-26T11:30:36Z",
"session_id": null,
"lane": null,
"host": "htch-runtime",
"worktree": "/home/hatch",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/hatch",
"repo": "developing-today/code",
"branch": "main",
"sha": "4291c7d25d6699e6d0378dcce687f1935ec39c09"
},
"auth_subject": "felix",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Activitydezren39 commented on Nov 26, 2026 Triage — CF-5e push registry Turso → D1 (#15561)
Verdict: validated, real work — not a small fix. This is a production data migration + writer retarget + live flip, well beyond a triage-sized edit. Returning it to the queue for a dedicated implementation lane; step 1 (enumeration) is done below from current main so that lane can start at the copy.
Claim check (2026-11-26, xaltha lane): no comments on this issue, no open PR references #15561, and no lane claim found. Sibling ledger work: PR #15544 (merged, D1 read path for the hosted ledger surfaces) and PR #15559 (ledger flip config) — neither touches the push registry.
Step 1 — push registry table set (enumerated from pm-stack/aggregator/src/push-registry.ts on current main)
The registry is exactly the five tables in PUSH_REGISTRY_TABLES / PUSH_REGISTRY_DDL:
| Table |
Key |
Indexes |
push_endpoints |
id |
push_endpoints_transport_client (transport, client); UNIQUE on endpoint |
push_preferences |
endpoint_id |
— |
push_item_stages |
item_ref |
push_item_stages_stage (stage, priority, blocked_by_count) |
push_item_stage_events |
id |
push_item_stage_events_item (item_ref, id) |
push_registry_meta |
key |
— |
Adjacent, not in the move set: alerts_push_subscriptions (legacy seed source only — read once by ensurePushRegistry behind the push_registry_meta marker; it is not a registry table) and alerts_notification_sends (the sender's send ledger in alerts.ts — a CF-5 ledger table, not registry; the implementation lane should confirm with the CF-5 coordinator whether its aggregator writes stay on Turso).
Readers/writers to retarget (step 4): push-registry.ts (all registry CRUD + stage pipeline) and alerts.ts (subscription upsert/delete, gone_count updates, the endpoint+preferences lookup at the sender path, and the one sender in push.ts/alerts.ts).
Key implementation fact the next lane needs
The ledger move's store-switch pattern does not transfer directly: the ledger D1 read path (PR #15544) lives in the pm-console edge Worker, where D1 is a native binding (LEDGER_DB). The push registry lives in the aggregator, a non-Worker service whose store client is the Turso transport in turso-stores.ts. Retargeting the aggregator therefore needs a D1-over-HTTP-API SqlClient (Cloudflare API) or an equivalent bridge — that client is the first build item, before the copy/flip steps 2–5 can run. The DDL is already SQLite-shaped and literal-free, so the schema copy itself should be mechanical once the client exists.
Remaining scope (unchanged from the body)
Steps 2–6: create tables in D1 fleet-platform, copy + hash-verify per the #14968 procedure (comment 7190724486), retarget behind a store switch with the rollback note recorded before the flip, refresh-at-flip, live verification (real registration lookup + test send), and only then retire the Turso copy / turn off laptop sync.
Refs #14945, #14866, #14084. developing-today-fleet commented on Nov 26, 2026 ContributorAuthor More actions agent-note:v1 — graph hygiene audit slice N2 under #14863 (queue-lane-SC, 2026-11-26)
State correction (comment-only): no status/ and no effort/ label.** A triage verdict was already recorded on this issue (2026-11-26T11:44Z: validated, real work, returned to the queue for a dedicated implementation lane), but the label set (priority/high, meta/enriched, kind/infrastructure, app/pm-stack) has no status label and no effort label, so the issue is invisible to status-driven triage/queue views — the same class as #9378 (slice 10) and #15022 (slice N1). Flagged for the owning lane; the audit made no label change. Refs #14863 developing-today-fleet commented on Nov 27, 2026 ContributorAuthor More actions
Triage — CF-5e push registry Turso → D1 (2026-11-27)
Verdict: confirmed real migration work, not a small fix; returned to the queue as feature slice 1 (task 26001). The prior triage comment #7191106693 already completed table enumeration and identified the D1 HTTP SqlClient as a prerequisite. Fresh check against origin/main shows that prerequisite now exists (pm-stack/aggregator/src/d1-stores.ts and tests), but the push-registry path still uses getTursoStoreClient; no D1 wiring exists there. The issue remains OPEN and has no hold labels. No linked open PR or other live #15561 implementation task was found.
Queued follow-up: task 26001 — “CF-5e #15561 slice 1: wire push registry to D1 behind a Turso rollback switch.” It routes the five enumerated registry tables and sender lookups to the existing D1 client behind explicit opt-in, keeps Turso as the default, and tests fail-closed behavior. It excludes production data copy, live flip, Turso retirement and laptop-sync changes; those require a later task with recorded rollback and live verification.
This supersedes the earlier stale prerequisite note that a D1 HTTP client must first be built. No production data or backend was changed.
developing-today-fleet commented on Nov 27, 2026 ContributorAuthor More actions
Slice 1 PR open: #16147 — push registry switchable to D1 behind Turso default
After this PR: PM_PUSH_REGISTRY_BACKEND=d1 routes the five registry tables (push_endpoints, push_preferences, push_item_stages, push_item_stage_events, push_registry_meta) and the stage pipeline to the D1 client; unset keeps Turso for both registry and ledger. Verified: new test fails pre-change / passes post-change, 68 registry+alerts tests green, typecheck clean.
Rollback note (recorded BEFORE any flip, per the issue): rollback is unsetting PM_PUSH_REGISTRY_BACKEND. The flag is not set in any deployment by this PR, so production is unchanged. No copy/flip has happened — do not set the flag in production until the copy + hash-verify, refresh-at-flip and live verification slices land.
Next slice (same "after this PR" form): after #16147 merges, create the five tables in D1 fleet-platform and copy + hash-verify per the #14968 procedure, evidence recorded here. developing-today-fleet commented on Nov 27, 2026 ContributorAuthor More actions
Slice 1 landed: #16147 merged — push registry switchable to D1 behind Turso default
After this PR: PM_PUSH_REGISTRY_BACKEND=d1 routes the five registry tables (push_endpoints, push_preferences, push_item_stages, push_item_stage_events, push_registry_meta) and the stage pipeline to the D1 client; unset keeps Turso. Fail-closed: D1 requested but unavailable rejects instead of silent Turso fallback. Merge e19d30b (2026-11-27).
Evidence (lane any-o verification on PR head 1fabce0, before merge): new push-registry-d1-15561.test.ts fails on origin/main (0 pass / 2 fail — silent single-connection fallback) and passes with the fix (2 pass); focused set of 6 push/alerts/registry files green (76 pass / 0 fail); bunx tsc --noEmit clean. Production unchanged: the flag is set nowhere, so no copy/flip has happened.
Rollback note (before any flip, per the issue): rollback is unsetting PM_PUSH_REGISTRY_BACKEND. Do not set it in production until the copy + hash-verify, refresh-at-flip and live verification slices land.
Next slice (same "after this PR" form): after this merge, create the five tables in D1 fleet-platform and copy + hash-verify per the #14968 procedure, with counts + hashes recorded on this issue. developing-today-fleet commented on Nov 28, 2026 ContributorAuthor More actions
Slice 2 PR open: #16444 — push registry copy + hash-verify tooling
After this PR: the five registry tables (push_endpoints, push_preferences, push_item_stages, push_item_stage_events, push_registry_meta) have scripted copy + verify: copyPushRegistry (DDL-apply + delete+insert refresh), hashPushRegistry (canonical SHA-256), verifyPushRegistryCopy (fail-closed compare), and the scripts/copy-push-registry-to-d1.ts operator command (--copy / --verify-only) for the refresh-at-flip.
Live evidence (2026-11-28): D1 fleet-platform holds all five tables with byte-identical table DDL; --verify-only Turso → D1 reports MATCH on all five (four tables 0 rows, push_registry_meta 1 row with the identical seed-marker row); --copy re-ran clean with VERIFY MATCH.
Rollback note (unchanged, before any flip): rollback is unsetting PM_PUSH_REGISTRY_BACKEND; the flag is set nowhere, so production is unchanged. Do not flip until the refresh-at-flip re-run + live verification slices land.
Next slice (same 'after this PR' form): after this merges, flip PM_PUSH_REGISTRY_BACKEND=d1 in production with a refresh-at-flip re-run, then verify live with a real registration lookup and a test send; retire the Turso copy and turn off laptop sync only after that verification. developing-today-fleet commented on Nov 28, 2026 ContributorAuthor More actions
Slice 2 landed: PR #16444 merged — push registry copy + hash-verify tooling
Merge commit 1f8c11849493072607c81439bd42573fa4f69889 (2026-11-28T06:19:45Z), head 51fd6a82c9e7c5cd0efd4f799edb0447356ef9cc.
After this merge: the five registry tables have scripted copy + verify on main: copyPushRegistry (DDL-apply + delete+insert refresh), hashPushRegistry (canonical SHA-256), verifyPushRegistryCopy (fail-closed compare), and the scripts/copy-push-registry-to-d1.ts operator command (--copy / --verify-only) for the refresh-at-flip. Verification (lane 2352-E): fleet-command run 46114510525 on the exact head — bun test on the two 15561 test files, 7 pass / 0 fail, Target HEAD exact; PR CLEAN/MERGEABLE pre-merge. The author's live D1 evidence stands as recorded on the PR (all five tables MATCH Turso → D1; --copy re-ran clean).
Rollback note (unchanged): rollback is unsetting PM_PUSH_REGISTRY_BACKEND; the flag is set nowhere, so production is unchanged.
Next slice (unchanged from the slice-2 note): flip PM_PUSH_REGISTRY_BACKEND=d1 in production with a refresh-at-flip re-run, then verify live with a real registration lookup and a test send; retire the Turso copy and turn off laptop sync only after that verification.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|