Skip to content

Prepare keeper runtime and durable storage for Cloudflare - #147

Closed
lalalune wants to merge 14 commits into
mainfrom
codex/cloudflare-keeper
Closed

lalalune wants to merge 14 commits into
mainfrom
codex/cloudflare-keeper

Conversation

@lalalune

@lalalune lalalune commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

The live keeper combines runtime and contract-registry files from three commits. Rebuilding current main would change its behavior and contract addresses. Pin all 24 observed files by commit and SHA-256, then derive Cloudflare database operations from the verified source without changing their bodies or SQL.

Add a synchronous authenticated HTTPS transport, collection-preserving wire format, validation for all 20 database operations, and a Durable Object SQL adapter. Unconfirmed requests permanently stop that client from issuing later calls; writes are never retried automatically. SQL changes and write receipts commit together, so duplicate request IDs return the original result and conflicting reuse is rejected.

The importer requires a quiesced, manifest-matched snapshot containing all 15 source tables and their schema. It verifies every row, preserves sequence counters, rejects unexpected schemas or nonempty targets, and rolls back partial failures. A successful import stays inactive; the application cannot write until a separate verified activation.

Validation: all 24 prepared files match the captured runtime; all 20 generated function bodies are byte-for-byte unchanged. HTTPS, codec, request validation, receipt, and importer tests pass on the deployed Linux Bun 1.3.8 and Bun 1.4.2; applicable transport/API tests also pass on Node 24.15.0. Type declarations and generated operations pass TypeScript checks. Workerd fixtures exercise all 20 operations against native SQLite, verify nested transaction rollback, 12 concurrent identical requests applying once, receipts surviving restart, and all 15 imported tables matching exactly, including sequence counters.

The host build now wires all 20 database exports to HTTPS while retaining the original service, bot, and contract registry. A Linux supervisor isolates the service and bot together; an uncertain storage result records the request ID and stops both. Durable owner IDs fence stale requests, delayed stop events cannot freeze replacement owners, and historical owner IDs cannot be reused. The pinned linux/amd64 Bun 1.3.8 image passed all 20 exports over HTTPS, booted the original service with bot and chain parsers disabled, and stopped both fixture processes after an applied write lost its successful response. Exactly one durable receipt remained. The image reported the dependency’s pure-JavaScript bigint fallback; live performance is not certified.

The container lifecycle controller now requires explicit activation and freezes storage on every exit, interrupted start, or failed recovery. It checks the owner label when adopting a running container after a Durable Object restart and requires an operator reconciliation digest before replacement. Administrative handlers use a separate credential, enforce disabled activation, and preserve inactive imports. Controller tests pass on the pinned Linux Bun image; admin tests also pass on Node 24.15.0. Import/executor regressions and declaration checks pass. The singleton Worker and inactive Wrangler configuration now wire these modules together. Strict Worker typechecking and the Wrangler image/bundle dry run pass. Local Workerd imports all 15 fixture tables, preserves them through reloads, accepts identical import replay, rejects unauthorized administration, and refuses disabled runtime traffic and activation. The production Worker is deployed inactive with empty storage, separate credentials, and public traffic returning 503. A disposable hosted fixture imported all 15 tables and exercised activation/freeze/stop; application readiness failed. The latest change preserves the first failure cause and uses HTTP for the container port. Strict Worker typechecking and controller regression tests pass. A fresh hosted retest passed after explicitly reconciling an initial startup failure: the original service hydrated the imported fixture bet, returned healthy status with bot/parsers disabled, rejected duplicate activation, and stopped with storage frozen. The disposable Worker, container application, and namespace were removed. This verifies credential-free hosted operation, not live chain behavior.

This remains draft migration preparation. The inactive production Worker now has 28 application settings transferred exactly from a fresh 57-key Railway runtime capture with zero drift; 29 platform settings are excluded, including host paths. Production storage remains empty and inactive. The configured Railway stream-state source returns 404 and the deployed frontend overrides still point to Railway. Source defaults in the Solana app, BSC app, and shared UI now target the Cloudflare Worker; both built apps contain zero old keeper-host references. App typechecks, lint, builds, shared UI typechecking, and all 95 shared UI tests pass. Live overrides remain unchanged until handoff. Upstream/consumer routing, final quiesced export, controlled activation, and live verification remain. The existing Railway keeper is still the only live owner.

@lalalune lalalune changed the title Prepare exact keeper runtime for Cloudflare migration Prepare keeper runtime and durable storage for Cloudflare Oct 22, 2026
@lalalune lalalune closed this Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant