Skip to content

docs(EYT-142): das fehlende Deploy-/Rollback-Runbook - #86

Merged
DYAI2025 merged 1 commit into
masterfrom
evidence-check
Aug 20, 2026
Merged

docs(EYT-142): das fehlende Deploy-/Rollback-Runbook#86
DYAI2025 merged 1 commit into
masterfrom
evidence-check

Conversation

@DYAI2025

@DYAI2025 DYAI2025 commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Reines Dokument, kein Code, keine Migration.

Der Befund

EYT-142 führt „Runbook für Deploy, Testdaten, Diagnose und Rollback" ausdrücklich in-scope. Es existierte nicht: docs/runbooks/ trug vier Dateien (a11y-checklist, branch-protection, database-workflow, planning-publish), keine davon zu Deploy oder Rollback. Der einzige grep-Treffer auf „rollback" stand in branch-protection.md und meint das Zurücknehmen eines Rulesets.

Damit war das Akzeptanzkriterium „Health/Readiness, TLS/RLS, Request-Isolation, Secrets, Worker-Startup und Rollback sind belegt" in genau einem Punkt unerfüllt — und dieser Punkt braucht kein Staging, nur Aufschreiben.

Die fünf, die belegt sind

Gemessen am finalen Head b2d8dbf, Run 32418558407:

[cost-access] [cost-snapshot] [planning-invariants] [planning-publish]
[planning-published-reads] [planning-write] [rate-http-contract] [rate-succession]
[rate-timestamp] [snapshot-http] [snapshot-immutability] [tenant-isolation] [tenant-pooling]

13 Zeilen, je mode=required … skipped=0. Dazu smoke-api.sh (ready=200, /health, SIGTERM), smoke-worker.sh (öffnet keinen Port) und smoke-api-role-gate.sh (API startet nicht ohne RLS-gebundene Rolle).

Was das Runbook tut

Es beginnt mit dem Gate, das zuerst fallen muss, und sperrt alles darunter, solange BLOCKER_ENVIRONMENT_SEPARATION gilt — auch einen Healthcheck, auch „nur einmal zum Schauen". Die Prüfung ist auf eine Frage reduziert:

Ist der project_ref des Ziels von inypnrvpawvhgiyagxbd verschieden?

Danach: was deployt wird (beide Worker, Configs aus dem Repo), Secrets-Trennung über die sieben kanonischen Variablen, Deployreihenfolge (Schema zuerst, Cloudflare nie als zweite Migration-Authority), Testdaten, eine Diagnosetabelle vom Billigsten zum Teuersten, Rollback und das Deploy-Protokoll.

Alles abgeleitet, nicht erfunden — jeder genannte Pfad ist gegengeprüft: beide wrangler.jsonc, ENV_VAR_META, pg-connection.ts, die drei Smoke-Skripte, deploy-authority.test.ts, planning-write.repository.ts, WRITE_CHANNEL_REJECTED, app.is_runtime_channel, 18 Migrationen.

Drei Stellen sind als NICHT gemessen markiert

Statt sie glattzuschreiben:

  1. scripts/ops/bootstrap-demo-tenant.mjs ist nie gegen eine Staging-Grenze gelaufen.
  2. Die Pooler-Vorhersage (Publish bricht, Snapshot bricht, Lesen läuft) ist aus session_user plus Policies abgeleitet und nicht gegen eine echte Poolerverbindung verifiziert — pgTAP läuft als postgres.
  3. Es gibt keine ausgeführte Restore-Evidenz. „Rollback belegt" wäre heute eine Tatsachenbehauptung ohne Tatsache; das Runbook beschreibt den Weg und schuldet den Nachweis beim ersten echten Deploy nach.

Die asymmetrische Hälfte

Steht ausdrücklich drin, weil sie sonst erst im Ernstfall auffällt:

Anwendung und Schema rollen nicht gemeinsam zurück. Migrationen sind append-only. Ein App-Rollback ist unkritisch, solange die Migration additiv war — genau deshalb sind additive Migrationen die Auflage. Ein Rollback auf eine Version, die eine entfernte Struktur braucht, ist kein Rollback, sondern ein Ausfall.

🤖 Generated with Claude Code

Summary by Sourcery

Document the guarded procedure for staging deployment, validation, diagnosis, and rollback before the first real staging deployment.

Documentation:

  • Add a staging deployment runbook covering environment separation, deployment scope, secrets, migration order, test data, diagnostics, rollback, and deployment records.
  • Document the current evidence boundaries explicitly, including unverified staging bootstrap, pooler behavior, and restore execution.
  • Define fail-closed deployment gates and the separation between application rollback and append-only schema evolution.

…h nie ausgefuehrt markiert

EYT-142 fuehrt "Runbook fuer Deploy, Testdaten, Diagnose und Rollback"
ausdruecklich in-scope. Es existierte nicht: `docs/runbooks/` trug vier Dateien,
keine davon zu Deploy oder Rollback; der einzige Treffer auf "rollback" stand in
`branch-protection.md` und meint etwas anderes. Damit war das Akzeptanzkriterium
"Health/Readiness, TLS/RLS, Request-Isolation, Secrets, Worker-Startup und
Rollback sind belegt" in genau einem Punkt unerfuellt — und dieser Punkt braucht
kein Staging, sondern nur Aufschreiben.

Fuenf der sechs Belege sind am finalen Head `b2d8dbf` gemessen (Run 32418558407):
13 db-gates-Zeilen `mode=required … skipped=0`, dazu `smoke-api.sh` (`ready=200`),
`smoke-worker.sh` und `smoke-api-role-gate.sh`. Der sechste — Rollback — ist
jetzt beschrieben, aber ausdruecklich NICHT als vollzogen behauptet.

Das Runbook beginnt mit dem Gate, das zuerst fallen muss, und sperrt alles
darunter, solange `BLOCKER_ENVIRONMENT_SEPARATION` gilt — auch einen Healthcheck.
Die Pruefung ist auf eine Frage reduziert: ist der `project_ref` des Ziels von
`inypnrvpawvhgiyagxbd` verschieden?

Inhaltlich abgeleitet, nicht erfunden: beide `wrangler.jsonc`, `ENV_VAR_META`,
`pg-connection.ts`, die drei Smoke-Skripte, `deploy-authority.test.ts`, der
EYT-142-Plan und die Phase-A-Messungen. Jeder genannte Pfad ist gegengeprueft.

Drei Stellen sind als **nicht gemessen** markiert statt geglaettet:

- `scripts/ops/bootstrap-demo-tenant.mjs` ist nie gegen eine Staging-Grenze
  gelaufen,
- die Pooler-Vorhersage ist aus `session_user` plus Policies ABGELEITET und
  nicht gegen eine echte Poolerverbindung verifiziert (pgTAP laeuft als
  `postgres`),
- es gibt keine ausgefuehrte Restore-Evidenz; "Rollback belegt" waere heute eine
  Tatsachenbehauptung ohne Tatsache.

Die asymmetrische Haelfte steht ausdruecklich drin, weil sie sonst erst im
Ernstfall auffaellt: Anwendung und Schema rollen NICHT gemeinsam zurueck.
Migrationen sind append-only; ein Rollback auf eine Version, die eine entfernte
Struktur braucht, ist kein Rollback, sondern ein Ausfall.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @DYAI2025, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adds a detailed, repository-grounded runbook for staging deploys, test data, diagnostics, and rollback, explicitly documenting gates, configuration, smoke checks, and rollback constraints, including what is and is not yet empirically verified.

Flow diagram for staging deploy and rollback runbook

flowchart TD
  A[Check Gate A_to_B: A1_A9_green, non_production_project_ref, owner_approval] -->|Gate satisfied| B[Apply_supabase_migrations_to_staging]
  A -->|Gate not satisfied| X[Abort_deploy]

  B --> C[Verify_migration_count_matches_repository]
  C -->|Mismatch| X
  C -->|Matches| D[Set_secrets_and_worker_config]

  D --> E[wrangler_deploy_easytree_api_and_easytree_web]
  E --> F[Run_smoke_api_smoke_worker_smoke_api_role_gate]
  F -->|Any_smoke_fails| X
  F -->|All_smokes_green| G[Record_deploy_metadata_commit_SHA_worker_versions_migration_state_project_ref_smoke_results]

  G --> H[If_issue_after_deploy_consider_app_rollback_via_Cloudflare_or_Railway]
  H --> I[Schema_is_append_only_use_forward_migration_to_fix_additive_error]
  I --> J[Ensure_app_rollback_does_not_depend_on_removed_schema_structures]
Loading

File-Level Changes

Change Details Files
Introduce a comprehensive staging deploy, diagnostics, and rollback runbook grounded in existing tooling and measurements.
  • Add a new runbook documenting the A→B gate and environment separation requirement before any staging deploy is allowed.
  • Describe worker deployment paths for API and web, including Cloudflare configuration, Railway compatibility, and build artifacts.
  • Define canonical configuration and secret variables, their separation, and enforced SSL/RLS constraints around DATABASE_URL and pg connection handling.
  • Specify deploy order (migrations first, then application), including tests preventing Cloudflare from becoming a schema migration authority.
  • Document allowed test data, demo tenant bootstrap script usage, and its current unverified status against a real staging boundary.
  • Lay out a structured diagnostic flow from cheapest checks to more expensive, including expected pooler behavior and mandatory smoke scripts.
  • Clarify rollback behavior, including asymmetric app vs schema rollback rules and the lack of executed restore evidence so far.
  • Define mandatory deploy protocol information (commit, worker version IDs, migration state, project_ref, smoke results) and the current non-executed status of this runbook.
docs/runbooks/staging-deploy.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@DYAI2025
DYAI2025 merged commit 25682ba into master Aug 20, 2026
13 checks passed
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.

2 participants