|
| 1 | +# Migration, canary, and rollback governance |
| 2 | + |
| 3 | +This policy governs #174 implementation work. It preserves Forkara's one server, SQLite event-log, and projection architecture; it does not authorize a second database, dual writes, or speculative compatibility machinery. |
| 4 | + |
| 5 | +## Compatibility rules |
| 6 | + |
| 7 | +- Contracts, RPC payloads, commands, events, provider runtime events, automations, and gateway inputs are additive first. New optional fields require safe decode defaults only when the default preserves prior meaning. |
| 8 | +- A changed meaning, identity, cardinality, or invariant requires a new field/event/command or explicit schema version. Never guess an old client's intent; reject unsupported client/server combinations with a typed, actionable compatibility error. |
| 9 | +- Orchestration events remain decodable for retained history. A new projector starts at a durable cursor, replays the authoritative journal, and records its own progress; snapshots are derived and sequence-fenced against live streams. |
| 10 | + |
| 11 | +## Persistence and repair |
| 12 | + |
| 13 | +- SQLite migrations are additive, transactional, idempotent where replay is possible, and tested with disposable fixtures only. Backup/restore and failed-migration recovery follow the existing migration path; development/test state must remain isolated from normal user state (#158). |
| 14 | +- Old/null/legacy rows are handled explicitly in migrations or decoders. Irreversible deletion requires a retained-state compatibility proof and an operator-visible backup/recovery plan. |
| 15 | +- Projection repair rebuilds only derived tables under an event high-water fence. It must never issue provider, Git, automation, or delivery side effects; interrupted repairs surface as degraded/recovery-required rather than silently continuing. |
| 16 | + |
| 17 | +## Upgrade dispositions |
| 18 | + |
| 19 | +| State | Upgrade disposition | |
| 20 | +| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | |
| 21 | +| Durable commands/events and projections | Safe to reconstruct from the event log. | |
| 22 | +| Provider process/native session | Resume only when adapter support and persisted binding allow it; otherwise interrupted/recovery-required. | |
| 23 | +| Automation run/claim, approval wait, worktree release | Reconcile from their owning durable service; never reconstruct from UI state. | |
| 24 | +| Future workflow or validation artifact | Must declare its disposition before shipping; no universal-resume assumption. | |
| 25 | + |
| 26 | +## Canary and rollback |
| 27 | + |
| 28 | +1. Add contracts and read-only diagnostics. |
| 29 | +2. Add persistence/projections without changing existing task behavior. |
| 30 | +3. Enable a registered flag or canary recipe in a disposable project. |
| 31 | +4. Validate replay, repair, in-flight behavior, and rollback. |
| 32 | +5. Enable for new tasks first; broaden only after recorded evidence. |
| 33 | +6. Retire a legacy path only after retained-state compatibility is proven. |
| 34 | + |
| 35 | +Code-only refactors roll back with code. Additive migrations, event types, and projections roll back by retaining and safely ignoring newer data, not by deleting or reinterpreting it. Provider/environment/handoff/workflow changes must preserve bindings and artifacts for recovery; newer durable records require an operator-visible recovery path. |
| 36 | + |
| 37 | +## Migration PR checklist |
| 38 | + |
| 39 | +- [ ] Contract version/additive-default decision is stated. |
| 40 | +- [ ] Migration, backup/restore, legacy-row, and rollback behavior is tested. |
| 41 | +- [ ] Event/projector replay and high-water compatibility is proven. |
| 42 | +- [ ] In-flight provider, automation, approval, and environment disposition is stated. |
| 43 | +- [ ] Canary uses disposable state; rollout is new-tasks-first. |
| 44 | +- [ ] Focused tests and unresolved limits are recorded. |
0 commit comments