# Safe Rollout Lab

By Chason Arthur
Revision 142.069
Published/updated 2026-11-04

## Start without installing dependencies

Extract this complete ZIP into a new folder. With Python 3 installed, run `python preview.py` from the extracted root. Open http://127.0.0.1:4210/. Stop with Ctrl+C. The prebuilt site is self-contained and makes no automatic external requests. Written reference links are optional. Do not open the files directly with file:// because workers and Wasm need HTTP.

## Run the native exercise

```sh
npm ci
npm test
node src/rollout/local-release.mjs
```

The local-release script opens an ephemeral loopback HTTP port, checks v1, expands and backfills the schema, checks v2, injects a readiness failure and checks v1 after rollback. It then closes its listener and database. Optional Terraform 1.17.1+: cd src/rollout; terraform init -backend=false; terraform test. The test contains three plan-only cases with a built-in local resource. It needs no cloud provider, credential or remote backend.

## Expected result

All safeguarded data reads return 200 across mixed versions and application rollback. The destructive path produces missing-column errors. The contract gate refuses to remove a column while an old reader remains.

## Scope

Actual PostgreSQL executes the migration and client reads. Traffic and readiness phases are an explicit browser model. The download includes a real loopback HTTP switch and a local-only Terraform plan exercise; no cloud deployment is started from this page.

## Change and rebuild

Node/browser packages: `npm ci`, `npm run rebuild`, then `python preview.py`. Go: edit src/go, run its tests and `python rebuild_wasm.py` before refreshing source. Python: edit src/python/engine.py and run `python refresh_source.py`. Rebuild keeps the local preview and source viewer aligned. FILE_MANIFEST.json describes the initial extracted package, not later edits. The source-map and source viewer manifest record the exact teaching files. Update edition/date metadata before publishing an edited version.

## Extension

Add an old writer that changes full_name after the backfill. Demonstrate the divergence, then implement a compatibility writer or another explicit synchronization policy. Do not retire the old field until old writes are gone.

Original teaching code and lessons are MIT-licensed. See THIRD_PARTY_NOTICES.md and licenses/. The package starts no production API, model, payment, email or cloud service.
