Skip to content

chore(cloud): P0C3B reconcile D1 migration ledger and enforce disabled staging deploy - #7

Draft
Nardo021 wants to merge 11 commits into
feature/mote-cloud-p0c3-d1-staging-20261117from
feature/mote-cloud-p0c3b-staging-gates-20261117
Draft

Nardo021 wants to merge 11 commits into
feature/mote-cloud-p0c3-d1-staging-20261117from
feature/mote-cloud-p0c3b-staging-gates-20261117

Conversation

@Nardo021

@Nardo021 Nardo021 commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

P0C3B — real D1 migration ledger + staging fail-closed deployment gate

Stacked Draft PR on P0C3A #6. No production release, merge, DNS change, hosted Worker or DO deployment, Apple identity testing or physical lock is claimed.

Cloudflare actions VERIFIED

  • Confirmed isolated mote-cloud-staging D1 previously contained the three source-applied SQL migrations (5 tables, 8 named indexes, 3 pairing triggers; schema fields from auth migration present), with no d1_migrations ledger.
  • Using Cloudflare's documented Wrangler table schema, created d1_migrations and recorded only the three previously applied migration filenames: 0001_core.sql, 0002_auth.sql, 0003_pairing_claim.sql. Read back 3 accurate entries. This is reconciliation of actual REST-applied SQL, NOT a claim that Wrangler ran the original migrations.
  • Did not touch existing mote-rc or other Cloudflare projects.

Source changes

  • Staging Wrangler example now workers_dev:false, no custom routes, MOTE_CLOUD_STAGING_ENABLED:false, explicit migration table; ID/Apple client are still operator-only placeholders.
  • New cloud/scripts/check-staging-preflight.mjs validates disabled staging config and, opt-in with Cloudflare operator auth, remotely verifies EXACT D1 tables/indexes/triggers, critical fields and 3 recorded migrations using read-only API requests.
  • --render refuses a placeholder Apple Bundle ID, requires successful remote verification, and creates a disabled gitignored config only once, with no secrets written to disk.
  • CI adds no-credentials offline preflight/syntax check plus a local workerd smoke test that must return HTTP 503 even with attacker-provided staging headers on health/devices/pairings.
  • Documentation: docs/cloud-p0c3b-staging-gates.md.

Release blockers / no deployment

Real Apple Bundle ID, staging gate and DO internal secret are not provisioned; staged Cloud Worker is not deployed or exposed. No real WebSocket/hardware test or public access. Do not rerun already-applied migrations. Do not manually insert ledger rows into other databases without verified actual schema/operation evidence. Next: review CI and configure disabled staging deployment with verified app ID/operator secrets before real tenant E2E.

CI verification — complete (2026-11-17 Sydney)

CI #47 — all 9 jobs SUCCESS, final head b61a0ff0b218199862e99dabe39d4a787bbd6efe. Relay / Protocol, the personal Cloudflare Worker, Dashboard, Windows, macOS, Windows E2E, Windows test release artifact, repository consistency, and the Cloud staging bundle + local workerd disabled-route smoke all passed.

The first attempt (#44) exposed a pinned workerd compatibility-date mismatch, fixed only in the new Cloud CI/staging configuration: both are now set to 2026-09-28 (the newest date supported by the pinned local workerd). This does not change personal Relay compatibility settings.

Scope of proof: real Cloudflare D1 ledger readback separately verified 3 migration rows and 5 tables / 8 indexes / 3 triggers with no accounts/devices/pairings. GitHub CI proves the build and local fail-closed runtime behavior. The full hosted Mote Cloud Worker/DO still has not been deployed or tested live.

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