#
Writing Deploy-Safe Code
The planner makes the order safe. How you write code decides how often anything waits.
Clients (web app, CLI, extension, queue consumers)
- Identify your version: send
X-Client-Versionon every request and stamp the producer version on queued payloads. Only what can be seen can be drained. - Bound your own lifetime: the web app reloads for a new build at a safe moment; the CLI and extension refuse to run below the server's minimum version.
- Be a tolerant reader: ignore unknown fields and enum values, treat new optional fields as absent, never fail on an addition.
Providers (API, job handlers, schema)
- Add, never change. Optional fields may be added freely. Required fields, narrowed types and renames are new symbols (
@n+1). - Deprecate, then remove, and remove late. Stop using the old symbol, watch the live tail drain, then remove the symbol once nothing requires it.
- Keep a contraction in its own logical change. Later changes to that provider wait behind its drain, so unrelated work goes in separate PRs.
- Queue payloads are a contract with the past. Consumers accept every payload version still in the queue: bump the job symbol (
job:foo@2) and keep the@1handler until the queue drains. - Env and config: add a variable before code reads it. Never repurpose a name.
Schema
- Migrations only expand: add nullable columns or columns with defaults. Backfill in a separate data migration.
- Contract by removing the symbol, never with DROP or RENAME. Never reuse a contracted name.
- Name columns explicitly in INSERT and SELECT. No
SELECT *into fixed structs and no positional INSERT, so a soft-dropped column is invisible to old code.