GeezerVison is showing github.com — CF-11 (#14951): bridge state backup — whole-store export/restore to R2, daily cron by developing-today-fleet[bot] · Pull Request #15033 · developing-today/code
Conversation
CF-11 (#14951), part 2: the message bridge's state backup. (Part 1 — BRIDGE_PM_TOKEN on fleet-hosted — was a deployment action, recorded on #14951; the caller-auth remainder split to #14978.)
The MessageStore Durable Object holds every bridge message, credential hash, enroll token, note and OAuth record, and had no export at all. This PR adds the whole backup story:
- src/backup.js —
exportBridgeState: a portable JSON dump of every DO table (column order from PRAGMA, rows verbatim, AUTOINCREMENT high-water marks from sqlite_sequence, and a hard refusal on any value JSON cannot carry faithfully). importBridgeState: empties and refills each exported table row for row, restores the sequence marks, and refuses the whole restore if the payload names a table the store does not have. runBackup: dump → R2 exports/<stamp>.json + exports/latest.json with the summary in object metadata.
- Worker wiring — DO
backupExport/backupImport methods + storeFor passthroughs; a scheduled handler for the cron; owner routes POST /api//backup-export, GET /api//backup-latest, POST /api//backup-import (the restore verb — the drill runs it on a scratch namespace, never against production).
- Config — BRIDGE_BACKUP binding to the new
message-bridge-backup bucket (created 2026-11-25) and the daily cron 17 8 * * * UTC in both wrangler.jsonc and cloudflare.config.ts; the Surface 7 schedule-registry row lands in the same PR per the registry rule.
- Tests — test/backup.test.mjs drives the real worker fetch + real DO (node:sqlite harness): export/import round trip into a fresh namespace with stats/identity/read-back equality and id continuity, the scheduled handler writing the export, fail-closed 503 without the binding, owner-only posture, and the unknown-table refusal.
Verification (remote only): fleet-command run 45589134734 — 133 tests, 133 pass, 0 fail. (Run 45583939287 caught a write-path mangling of one fixture line in the new test file — a literal placeholder in the committed blob; fixed in the second commit and byte-verified.)
Open item for the rollout, recorded on #14951: confirm bindings.r2 exists in cf 1.0.0-beta.20's config DSL before the next bridge deploy (deploy.mjs --dry-run answers it); the evaluation run's result could not be read back from the lane seat (fleet gh route outage).
Refs #14951
{
"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-25T10:48:51Z",
"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": "8826be7a94faf495a143e45eab53db6f11c96eab"
},
"auth_subject": "felix",
"stamped_by": "fleet 0.1.0 (native)"
}
}
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
The MessageStore DO held every bridge message, credential hash and
enroll token with no export at all. Add backup.js: a portable JSON
dump of every DO table (plus AUTOINCREMENT high-water marks), a
restore that refills a namespace row for row, and runBackup landing
exports in the new message-bridge-backup R2 bucket. The Worker gains
a daily cron (17 8 * * * UTC), owner backup-export / backup-latest /
backup-import routes, BRIDGE_BACKUP bindings in both configs, a
round-trip test over the real DO, and the schedule-registry row.
Refs #14951
The committed test file carried a literal placeholder where the
harness env's ACCESS_TOKEN value belongs (a write-path redaction
artifact) — a SyntaxError on the runner: 129 pass / 1 fail (the whole
backup file). Restores the intended line; verified by byte counts.
Important
Review skipped
Bot user detected.
To trigger a single review, invoke the @coderabbitai review command.
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
e74640a8-270a-4cc2-bb16-f2cb67a59ede
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dezren39
added a commit
that referenced
this pull request
Nov 26, 2026
…15033 deploy (#14951)
Exports confirmed live 2026-11-25/26 via owner backup-latest; scratch-namespace backup-import drill recorded on the issue.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|