mustflow 2.116.1 → 2.116.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/package.json +1 -1
  2. package/templates/default/i18n.toml +72 -6
  3. package/templates/default/locales/en/.mustflow/skills/INDEX.md +37 -11
  4. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/SKILL.md +477 -0
  5. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-diagnostics-abi-linker-checklist.md +778 -0
  6. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-generators-properties-checklist.md +501 -0
  7. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-test-strategy-differential-checklist.md +498 -0
  8. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/debug-symbol-symbolication-checklist.md +412 -0
  9. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/ir-design-ssa-pass-pipeline-checklist.md +759 -0
  10. package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/miscompile-reduction-ir-checklist.md +434 -0
  11. package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/SKILL.md +55 -36
  12. package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/references/path-containment-handle-checklist.md +251 -0
  13. package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/SKILL.md +133 -32
  14. package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/references/file-upload-parser-ssrf-resource-checklist.md +306 -0
  15. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/SKILL.md +310 -0
  16. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-concurrency-model-checking-smt-checklist.md +457 -0
  17. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-contracts-modeling-checklist.md +434 -0
  18. package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-memory-bounds-ci-checklist.md +509 -0
  19. package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/SKILL.md +439 -0
  20. package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-harness-campaign-checklist.md +379 -0
  21. package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-oracle-triage-ci-checklist.md +307 -0
  22. package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/SKILL.md +48 -28
  23. package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/references/operation-ordering-stale-write-checklist.md +259 -0
  24. package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/SKILL.md +329 -0
  25. package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/references/input-boundary-security-checklist.md +319 -0
  26. package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/SKILL.md +306 -0
  27. package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/input-session-state-checklist.md +298 -0
  28. package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/remote-input-transport-interaction-checklist.md +328 -0
  29. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/SKILL.md +353 -0
  30. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-diagnostics-recovery-checklist.md +267 -0
  31. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-execution-closure-performance-checklist.md +428 -0
  32. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-gc-verification-checklist.md +457 -0
  33. package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-semantics-runtime-checklist.md +391 -0
  34. package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/SKILL.md +294 -0
  35. package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/modal-loop-reentrancy-checklist.md +290 -0
  36. package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/nested-modal-state-lifetime-checklist.md +297 -0
  37. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/SKILL.md +252 -0
  38. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/dns-network-resolution-checklist.md +394 -0
  39. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/language-symbol-resolution-checklist.md +282 -0
  40. package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/module-package-loader-resolution-checklist.md +352 -0
  41. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/SKILL.md +103 -17
  42. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/cst-ast-lowering-checklist.md +260 -0
  43. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/lexer-tokenization-checklist.md +397 -0
  44. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-serialization-compatibility-checklist.md +164 -0
  45. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-traversal-rewrite-checklist.md +209 -0
  46. package/templates/default/locales/en/.mustflow/skills/race-condition-review/SKILL.md +68 -11
  47. package/templates/default/locales/en/.mustflow/skills/race-condition-review/references/race-reproduction-memory-model-checklist.md +268 -0
  48. package/templates/default/locales/en/.mustflow/skills/routes.toml +151 -0
  49. package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/SKILL.md +343 -0
  50. package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-auth-stream-resume-checklist.md +413 -0
  51. package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-handoff-protocol-checklist.md +485 -0
  52. package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/SKILL.md +267 -0
  53. package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/admission-decision-recovery-checklist.md +308 -0
  54. package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/two-phase-transition-checklist.md +229 -0
  55. package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/SKILL.md +300 -0
  56. package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-affinity-event-loop-checklist.md +277 -0
  57. package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-dispatch-lifecycle-checklist.md +292 -0
  58. package/templates/default/manifest.toml +115 -1
@@ -0,0 +1,267 @@
1
+ ---
2
+ mustflow_doc: skill.two-phase-transition-integrity-review
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: two-phase-transition-integrity-review
9
+ description: Apply this skill when a state, session, resource, writer, leader, configuration, file set, payment, or other authority moves through admission or prepare and then commit or activate, especially when correctness depends on one durable commit decision, immutable admitted inputs and participants, ambiguous-outcome recovery, separate authority and execution states, leases and fencing epochs, stale-owner rejection, roll-forward effects, reconciliation, or post-commit cleanup.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.two-phase-transition-integrity-review
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - test_audit
23
+ - docs_validate_fast
24
+ - test_release
25
+ - mustflow_check
26
+ ---
27
+
28
+ # Two-Phase Transition Integrity Review
29
+
30
+ <!-- mustflow-section: purpose -->
31
+ ## Purpose
32
+
33
+ Review generalized prepare-and-commit transitions without confusing them with database distributed
34
+ two-phase commit. Preserve the old committed authority during preparation, move authority and its
35
+ generation at one atomic conditional commit, reject stale writers at the effect boundary, and keep
36
+ post-commit cleanup outside the correctness-critical cutover.
37
+
38
+ Treat admission as a durable promise that commit prerequisites and reversible resources are bound.
39
+ Treat commit as the one durable decision after which the protocol rolls forward even when later
40
+ effects, publication, cleanup, or the client response remain incomplete. Keep an observer's
41
+ `UNKNOWN` outcome separate from server authority.
42
+
43
+ <!-- mustflow-section: use-when -->
44
+ ## Use When
45
+
46
+ - A session, shard, leader, writer, resource, configuration, file tree, payment state, or service
47
+ ownership moves from one authority to another.
48
+ - A workflow has `prepare`, `ready`, `commit`, `activate`, `cutover`, `handoff`, `promote`, or
49
+ equivalent phases even when those names are implicit.
50
+ - Correctness claims include one active owner, zero-gap cutover, no split brain, stale-owner
51
+ rejection, immutable prepared state, live-input continuity, or safe delayed cleanup.
52
+ - Leases, epochs, generations, fencing tokens, snapshot offsets, input cutoffs, shadow execution,
53
+ or authority pointers participate in the transition.
54
+ - A timeout, lost response, half-open connection, retry, recovery worker, manual force decision,
55
+ protocol upgrade, or stuck admitted or committed operation can make the result ambiguous.
56
+
57
+ <!-- mustflow-section: do-not-use-when -->
58
+ ## Do Not Use When
59
+
60
+ - One entity changes ordinary local lifecycle state without transferring authority; use
61
+ `state-machine-pattern`.
62
+ - A business outcome spans independently persisted steps, callbacks, timers, retries, and
63
+ compensation; use `durable-workflow-orchestration` as the primary skill and this skill only when
64
+ an authority cutover is one of its steps.
65
+ - Local commit and independently committed publication or projection are the main gap; use
66
+ `dual-write-consistency` for delivery convergence and this skill only for the authority swap.
67
+ - Duplicate logical requests are the only risk; use `idempotency-integrity-review`.
68
+ - The change is only an ordinary transaction boundary with no old-to-new authority handoff; use
69
+ `transaction-boundary-integrity-review`.
70
+
71
+ <!-- mustflow-section: required-inputs -->
72
+ ## Required Inputs
73
+
74
+ - Authoritative object and currently committed owner, state, version, epoch, or generation.
75
+ - Transition identity, request identity, immutable request hash, source version, target state or
76
+ owner, phase, lease expiry, fencing token, and timestamps.
77
+ - Prepare-time reservations, copied state, readiness evidence, and externally visible read rules.
78
+ - Commit predicate, linearization point, atomic writes, outbox records, and conflict responses.
79
+ - Every mutation or effect sink that must enforce the current fence.
80
+ - Live-input cutoff, drain, durable buffer or log, snapshot and last-processed sequence pairing, and
81
+ shadow-mode effect policy when applicable.
82
+ - Abort, expiry, cleanup, observation-window, and reverse-transition behavior.
83
+ - Deterministic crash, retry, stale-owner, response-loss, and event-reordering evidence.
84
+ - Authority state, execution state, and observer knowledge state, including which one each timeout,
85
+ retry, cancellation, expiry, and operator action may change.
86
+ - Operation, attempt, idempotency, participant, effect, decision-sequence, resource-version, and
87
+ protocol-version identities plus their retention policy.
88
+ - Recovery ownership, retry budget, progress timestamps, in-doubt admission gate, transition
89
+ journal, invariant checker, and safety and liveness evidence.
90
+ - Configured command intents for the selected repository.
91
+
92
+ Read [references/two-phase-transition-checklist.md](references/two-phase-transition-checklist.md)
93
+ when the transition crosses processes, accepts live input, allocates resources during prepare, or
94
+ claims race-safe cutover.
95
+
96
+ Read [references/admission-decision-recovery-checklist.md](references/admission-decision-recovery-checklist.md)
97
+ when admission survives a request, commit effects can finish later, an external participant can
98
+ return an ambiguous result, or a reconciler, operator action, protocol upgrade, or fault-injection
99
+ plan is part of the design.
100
+
101
+ <!-- mustflow-section: preconditions -->
102
+ ## Preconditions
103
+
104
+ - The task matches the Use When conditions and does not match the Do Not Use When exclusions.
105
+ - The committed authority and the storage or effect boundary able to reject stale generations can
106
+ be identified, or their absence is reported as the primary gap.
107
+ - Higher-priority instructions and the selected repository command contract have been checked.
108
+
109
+ <!-- mustflow-section: allowed-edits -->
110
+ ## Allowed Edits
111
+
112
+ - Update transition records, conditional state changes, owner or generation checks, admission
113
+ snapshots, decision records, durable input handoff, outbox or inbox records, recovery workers,
114
+ cleanup workers, conflict mappings, invariant journals, deterministic fixtures, tests, and
115
+ directly synchronized docs or templates.
116
+ - Do not broaden a local transition into distributed orchestration, introduce network calls inside
117
+ the commit critical section, or claim exactly-once execution from retries or fencing alone.
118
+ - Do not delete the old resource merely because commit succeeded; first revoke its authority and
119
+ preserve any required observation or recovery window.
120
+
121
+ <!-- mustflow-section: procedure -->
122
+ ## Procedure
123
+
124
+ 1. Name the single externally authoritative fact: owner, active version, leader epoch, payment
125
+ state, active file generation, or equivalent. Separately name what the client currently knows;
126
+ a timeout may make observer knowledge `UNKNOWN` without changing authority.
127
+ 2. Model authority and execution on separate axes. Use one durable authority decision such as
128
+ `PENDING`, `ADMITTED`, `COMMITTED`, or `ABORTED`, and a separate progress state such as `IDLE`,
129
+ `RUNNING`, `RETRY_WAIT`, `BLOCKED`, or `DONE`. Keep operation, request, transition, and attempt
130
+ identities distinct.
131
+ 3. Acquire at most one active transition slot per object with a conditional write against the
132
+ committed source version. Return a typed conflict when another incompatible transition owns it.
133
+ 4. Freeze the admitted request and participant snapshot. Bind tenant, subject, target, permissions,
134
+ amount, configuration, policy version, participant set, source version, protocol version, and
135
+ canonical input hash so commit and recovery cannot silently change what admission approved.
136
+ 5. Keep the old committed owner authoritative while preparation copies state, reserves resources,
137
+ warms caches, or proves readiness. Admission may acquire only reversible resources. Persist the
138
+ operation before returning its identity, and do not expose admitted state as committed truth by
139
+ default.
140
+ 6. Make readiness evidence specific to the target operation. A process health response alone does
141
+ not prove that state, permissions, capacity, dependencies, or input continuity are ready.
142
+ 7. Bound preparation with a lease or expiry. Separate client wait timeout, admission lease, external
143
+ call timeout, convergence objective, and operator-escalation age. Define who stops waiting and
144
+ which state change, if any, each deadline permits. If lease renewal has an ambiguous result, stop
145
+ writes and reread the authoritative fence before resuming.
146
+ 8. Issue a monotonically increasing epoch, generation, or fencing token and enforce it at every
147
+ authoritative storage or external-effect boundary. Notifications to old owners are an
148
+ optimization, not the rejection mechanism.
149
+ 9. Define live-input behavior before cutover: select a cutoff sequence, drain pre-cutoff work,
150
+ durably buffer or log post-cutoff input, and bind the snapshot to its last processed sequence in
151
+ one consistent record.
152
+ 10. Keep shadow execution read-only or effect-suppressed. Include session, epoch, input sequence,
153
+ and request identity in commands so late or duplicate input can be rejected deterministically.
154
+ 11. Immediately before commit, revalidate the source version, active transition ID, immutable
155
+ request hash, lease, readiness evidence, and target generation.
156
+ 12. Use one short atomic conditional commit as the linearization point. Persist the irreversible
157
+ commit decision and decision sequence, change committed owner or state, increment the
158
+ generation, clear or close `active_transition_id`, record the canonical result, and persist
159
+ required outbox records in the same atomic boundary. Effects incomplete after this point change
160
+ only execution progress and must roll forward; they do not turn authority into `ABORTED`.
161
+ 13. Keep network calls, target probes, drains, data copies, and cleanup outside the commit lock or
162
+ transaction. Revalidate any fact that may have changed while those operations ran.
163
+ 14. Make admission and commit idempotent. Scope keys by tenant and command, bind them to a canonical
164
+ payload hash, atomically claim the operation, and replay the recorded status and canonical
165
+ result. A reused key with different immutable inputs must conflict. Keep business uniqueness and
166
+ deterministic per-effect identity separate from transport idempotency.
167
+ 15. Acknowledge input or commit only after the authoritative state, log entry, or result needed for
168
+ recovery is durable. A lost response produces an unknown observer outcome, not a server failure.
169
+ Before retrying an external effect with an ambiguous response, query by its stable effect or
170
+ provider reference when possible; otherwise require an adapter ledger or serialized authority.
171
+ 16. Publish post-commit events through the committed outbox and carry object version plus epoch in
172
+ events and cache entries. Consumers must reject or ignore older generations and deduplicate
173
+ application through an inbox or equivalent durable effect record when delivery can repeat.
174
+ 17. Define command-by-phase outcomes for prepare, commit, abort, expiry, retry, and reverse. Map
175
+ stale version, lease expiry, immutable-input mismatch, and competing transition to explicit
176
+ conflicts rather than generic server failures.
177
+ 18. Tag prepare-time resources with the transition ID and make release an idempotent durable action.
178
+ Abort, expiry, or cleanup must verify decision and generation so repeated recovery cannot
179
+ over-release or delete resources belonging to a newer transition.
180
+ 19. Treat reconciliation and cleanup as protocol components, not operator folklore. Persist recovery
181
+ owner, generation, next retry, last progress, and blocked reason; reuse the same state-transition
182
+ functions as the online path. Cleanup failure must not roll back committed authority. When
183
+ in-doubt count or age exceeds its bounded policy, close admission for the affected resource or
184
+ participant while recovery continues.
185
+ 20. Model rollback or compensation after commit as a new operation with a higher generation and
186
+ stable effect identities. Preserve the original committed decision and audit history.
187
+ 21. Delay destructive deletion until the observation or recovery window closes, while revoking old
188
+ authority immediately at commit.
189
+ 22. Test every durable boundary before and after its write: operation creation, admission response,
190
+ participant preparation, commit decision, external effect, outbox, inbox, and acknowledgement.
191
+ Include response loss, asymmetric network failure, half-open connections, duplicate and reordered
192
+ messages, lease-edge pauses, stale reads, recovery takeover, cleanup failure, and reverse or
193
+ compensation transitions with deterministic interleavings or bounded failure injection.
194
+ 23. Append a transition journal with operation, attempt, participant, effect, generation, decision,
195
+ actor, reason, and sequence identities. Monitor state age, in-doubt count, recovery progress,
196
+ stale-fence rejection, and admission backpressure. Check both safety and liveness: no conflicting
197
+ authority or duplicate effect, and every nonterminal operation either converges or enters an
198
+ explicit bounded quarantine with an owner.
199
+
200
+ <!-- mustflow-section: postconditions -->
201
+ ## Postconditions
202
+
203
+ - Preparation leaves the old committed authority intact and binds an immutable target snapshot.
204
+ - One named atomic conditional boundary moves authority, generation, transition state, and required
205
+ outbox evidence together.
206
+ - Stale owners are rejected by authoritative storage or effect sinks rather than best-effort
207
+ notifications.
208
+ - Abort, expiry, cleanup, and reverse transitions have terminating, observable behavior.
209
+ - Authority, execution progress, and observer knowledge cannot contradict each other through one
210
+ overloaded status field.
211
+ - Ambiguous outcomes remain queryable and recoverable through stable identities, durable decisions,
212
+ reconciliation ownership, and versioned protocol evidence.
213
+ - The stated invariants are backed by deterministic tests or named evidence gaps.
214
+
215
+ <!-- mustflow-section: verification -->
216
+ ## Verification
217
+
218
+ Use the narrowest configured oneshot intents that cover the changed surface:
219
+
220
+ - `changes_status`
221
+ - `changes_diff_summary`
222
+ - `lint`
223
+ - `build`
224
+ - `test_related`
225
+ - `test`
226
+ - `test_audit`
227
+ - `docs_validate_fast`
228
+ - `test_release`
229
+ - `mustflow_check`
230
+
231
+ Do not infer missing commands. Prefer deterministic interleaving tests over timing sleeps.
232
+
233
+ <!-- mustflow-section: failure-handling -->
234
+ ## Failure Handling
235
+
236
+ - If no authoritative fence can reject a stale writer, report split-brain exposure instead of
237
+ treating lease expiry or owner notification as sufficient.
238
+ - If prepare mutates externally visible truth, either move that mutation into the atomic commit or
239
+ classify it as a separately compensatable workflow effect.
240
+ - If commit spans network calls or multiple independent commit authorities, narrow the claimed
241
+ linearization point and route delivery gaps through `dual-write-consistency` or multi-step recovery
242
+ through `durable-workflow-orchestration`.
243
+ - If lease ownership or commit outcome is ambiguous, stop new effects and reread durable authority;
244
+ do not guess, retry blindly, or clean up until identity and generation are known.
245
+ - If a manual force decision lacks durable coordinator evidence, participant observations, payload
246
+ hash, generation, and protocol version, reject the action rather than inventing certainty.
247
+ - If in-doubt work exceeds the configured age or count policy, stop affected admissions and keep
248
+ recovery running instead of allowing reservation and retry debt to grow without bound.
249
+ - If deterministic concurrency coverage is unavailable, report the untested interleavings and do
250
+ not claim race-safe cutover.
251
+
252
+ <!-- mustflow-section: output-format -->
253
+ ## Output Format
254
+
255
+ - Transition and authoritative fact reviewed
256
+ - Prepared snapshot and visibility rules
257
+ - Commit predicate and atomic linearization point
258
+ - Lease, epoch, and fencing enforcement sites
259
+ - Live-input cutoff, snapshot, sequence, buffer, and shadow behavior
260
+ - Idempotency, conflicts, outbox, caches, and events
261
+ - Authority, execution, and observer-knowledge states
262
+ - Operation, attempt, participant, effect, decision, and protocol identities
263
+ - Reconciler ownership, ambiguity handling, admission backpressure, journal, and invariant checks
264
+ - Abort, expiry, cleanup, observation window, and reverse transition
265
+ - Failure-injection and invariant evidence
266
+ - Command intents run and skipped
267
+ - Remaining authority-transition risk
@@ -0,0 +1,308 @@
1
+ # Admission, Decision, and Recovery Checklist
2
+
3
+ Use this reference when admission outlives a request, commit effects complete asynchronously, an
4
+ external participant may return an ambiguous result, or recovery and operator intervention are part
5
+ of the protocol.
6
+
7
+ ## Contents
8
+
9
+ 1. [Three state axes](#three-state-axes)
10
+ 2. [Operation record](#operation-record)
11
+ 3. [Admission contract](#admission-contract)
12
+ 4. [Commit decision and roll-forward](#commit-decision-and-roll-forward)
13
+ 5. [Unknown outcomes](#unknown-outcomes)
14
+ 6. [Recovery ownership and backpressure](#recovery-ownership-and-backpressure)
15
+ 7. [Identity and idempotency](#identity-and-idempotency)
16
+ 8. [External effects, release, and compensation](#external-effects-release-and-compensation)
17
+ 9. [Timeout matrix](#timeout-matrix)
18
+ 10. [Operator decisions](#operator-decisions)
19
+ 11. [Journal and telemetry](#journal-and-telemetry)
20
+ 12. [Fault-injection matrix](#fault-injection-matrix)
21
+ 13. [Safety and liveness](#safety-and-liveness)
22
+ 14. [Skill handoffs](#skill-handoffs)
23
+
24
+ ## Three state axes
25
+
26
+ Do not flatten different facts into one status string:
27
+
28
+ | Axis | Example states | Authority |
29
+ | --- | --- | --- |
30
+ | authority decision | `PENDING`, `ADMITTED`, `COMMITTED`, `ABORTED` | durable protocol truth |
31
+ | execution progress | `IDLE`, `RUNNING`, `RETRY_WAIT`, `BLOCKED`, `DONE` | work still required to realize the decision |
32
+ | observer knowledge | `KNOWN_PENDING`, `KNOWN_COMMITTED`, `KNOWN_ABORTED`, `UNKNOWN` | what one client or caller can prove |
33
+
34
+ A lost response may move the caller to `UNKNOWN` while the durable authority is already
35
+ `COMMITTED`. An effect failure after the commit decision may move execution to `RETRY_WAIT`
36
+ without changing authority. A timer must not convert observer uncertainty or slow progress into an
37
+ abort.
38
+
39
+ ## Operation record
40
+
41
+ Keep the record sufficient for a different process and code version to recover it:
42
+
43
+ | Group | Fields |
44
+ | --- | --- |
45
+ | logical identity | `operation_id`, tenant, resource, command type, idempotency-key hash |
46
+ | execution identity | `attempt_id`, recovery owner, recovery generation |
47
+ | immutable contract | canonical payload hash, subject, permissions, policy version, participant-set hash |
48
+ | resource contract | expected resource version, reservations, target generation, admission expiry |
49
+ | protocol | protocol version, authority state, execution state, state version |
50
+ | decision | decision sequence, decision timestamp, canonical result |
51
+ | effects | stable participant and effect IDs, effect sequence, observed external references |
52
+ | recovery | next retry, last progress, blocked reason, retry budget, quarantine owner |
53
+ | evidence | journal sequence, last error class, created, admitted, committed, and terminal timestamps |
54
+
55
+ Store the operation before returning its identity. Keep a thin terminal tombstone beyond the longest
56
+ queue, dead-letter, backup restore, manual replay, and audit window even when detailed response data
57
+ must expire.
58
+
59
+ ## Admission contract
60
+
61
+ Admission is not merely successful validation. It should establish a durable, reviewable promise:
62
+
63
+ - the operation identity and immutable payload are stored;
64
+ - the subject, tenant, target resource, policy version, and expected resource version are bound;
65
+ - the participant set and deterministic effect identities are frozen;
66
+ - commit prerequisites are satisfied or represented by durable reservations;
67
+ - every acquired resource is reversible before the decision;
68
+ - one active admission policy per resource is enforced through a conditional or unique durable rule;
69
+ - the protocol version and recovery compatibility are recorded;
70
+ - normal reads continue to expose committed truth.
71
+
72
+ If admission conditions may legitimately change before commit, name exactly which conditions are
73
+ revalidated and which transition follows a failed revalidation. Rechecking arbitrary current policy,
74
+ price, participant configuration, or resource selection makes the admission promise meaningless.
75
+
76
+ An admission token or server record must bind the immutable contract. Possession of an operation ID
77
+ alone must not let another tenant, subject, or changed payload commit the operation.
78
+
79
+ ## Commit decision and roll-forward
80
+
81
+ The linearization point is the durable decision, not an RPC response or the last participant reply.
82
+ The local atomic boundary should include the facts that must never disagree:
83
+
84
+ - `decision=COMMIT` and monotonic decision sequence;
85
+ - authority state, resource owner or active version, and generation;
86
+ - operation state version and canonical result;
87
+ - closure of the active-admission slot;
88
+ - outbox entries required to drive or announce effects.
89
+
90
+ Before this write, the protocol may abort and release admitted resources. After this write, it must
91
+ roll forward. Failed provider calls, delayed messages, cleanup errors, or a missing response change
92
+ execution progress only. Do not create hybrid authority states such as `COMMIT_FAILED` or rewrite
93
+ the committed decision into `ABORTED`.
94
+
95
+ Prepared data may remain private or staged. Prefer swapping a small committed pointer or generation
96
+ over copying a large body of data inside the decision transaction.
97
+
98
+ ## Unknown outcomes
99
+
100
+ Treat timeout and connection loss as loss of knowledge unless durable evidence proves an outcome:
101
+
102
+ 1. return or preserve the stable operation identity;
103
+ 2. expose a status query that reads durable authority;
104
+ 3. let a retry with the same scoped idempotency identity observe the existing operation;
105
+ 4. replay the recorded canonical result when terminal;
106
+ 5. keep a duplicate caller as an observer rather than a second executor.
107
+
108
+ Do not start a new operation merely because the caller timed out. Do not mark the server operation
109
+ failed to make the response easier.
110
+
111
+ For an ambiguous external effect, query the participant by deterministic effect ID, provider
112
+ reference, or resource ID before retrying. If the participant provides neither idempotent execution
113
+ nor outcome lookup, place a durable adapter ledger or single-writer serialization boundary in front
114
+ of it and report the residual ambiguity.
115
+
116
+ ## Recovery ownership and backpressure
117
+
118
+ The reconciler is part of the protocol:
119
+
120
+ - scan admitted, aborting, committed-but-incomplete, retry-wait, and blocked work;
121
+ - claim recovery with a conditional generation or fencing token;
122
+ - invoke the same transition functions used by the online path;
123
+ - record next retry, last progress, attempt identity, and categorized failure;
124
+ - stop on protocol violation or unknown immutable input rather than guessing;
125
+ - retain an explicit quarantine owner and operator deadline for work that cannot auto-converge.
126
+
127
+ Use bounded backoff and jitter as load control, not correctness. Keep one retry owner across SDK,
128
+ service, queue, and reconciler layers so retry multiplication cannot explode.
129
+
130
+ Define admission backpressure by resource or participant. When in-doubt count, oldest age, locked
131
+ capacity, or recovery load crosses its reviewed threshold, reject new admissions for that path while
132
+ allowing status queries and recovery to continue.
133
+
134
+ ## Identity and idempotency
135
+
136
+ Separate identities by purpose:
137
+
138
+ | Identity | Purpose |
139
+ | --- | --- |
140
+ | operation ID | one logical user or business intent |
141
+ | attempt ID | one execution or recovery attempt |
142
+ | scoped idempotency key | duplicate admission lookup within tenant and command namespace |
143
+ | payload hash | rejects key reuse with changed immutable meaning |
144
+ | participant ID | one frozen commit participant |
145
+ | effect ID | one deterministic materialized effect |
146
+ | event ID | one outbox delivery unit |
147
+ | generation | rejects stale owners and recovery workers |
148
+ | protocol version | selects compatible state-transition semantics |
149
+
150
+ Claim the operation through a unique durable rule rather than select-then-insert. Persist the first
151
+ local effect and operation claim in one transaction when they must not diverge. Replay the original
152
+ meaningful response, including deterministic rejection when the contract requires it.
153
+
154
+ Transport idempotency does not replace business uniqueness. Enforce facts such as one active
155
+ migration per account or one authorization per order independently of whether callers reuse keys.
156
+
157
+ Route detailed key scope, duplicate-in-progress responses, payload canonicalization, result replay,
158
+ retention, and provider idempotency through `idempotency-integrity-review`.
159
+
160
+ ## External effects, release, and compensation
161
+
162
+ Derive stable effect identity from operation, participant, effect type, and step sequence. Record
163
+ effect intent before or with the durable handoff. Apply an inbox, participant lookup, or idempotent
164
+ sink so redelivery cannot rematerialize the same effect.
165
+
166
+ A reservation release is an effect too. Give it a stable release identity and a durable applied
167
+ record. Verify decision and generation so an expiry worker cannot release a reservation after commit
168
+ and repeated recovery cannot restore capacity twice.
169
+
170
+ After commit, reversal is a new operation:
171
+
172
+ - preserve the original commit;
173
+ - allocate a new operation and higher generation;
174
+ - freeze new participants and current reverse intent;
175
+ - record new effect identities;
176
+ - classify irreversible or partially compensable effects explicitly.
177
+
178
+ Route commit-to-publication gaps through `dual-write-consistency` and multi-step compensation
179
+ ownership through `durable-workflow-orchestration`.
180
+
181
+ ## Timeout matrix
182
+
183
+ | Deadline | Who stops waiting | Permitted state effect |
184
+ | --- | --- | --- |
185
+ | client response timeout | caller | observer knowledge may become `UNKNOWN`; authority unchanged |
186
+ | admission lease | admission owner | blocks new commit attempt after expiry; abort remains conditional |
187
+ | participant call timeout | current attempt | outcome becomes retryable or ambiguous; durable decision unchanged |
188
+ | retry backoff | recovery worker | schedules next attempt; grants no correctness guarantee |
189
+ | convergence objective | operations owner | alert, quarantine, or admission backpressure |
190
+ | operator escalation age | support or control plane | permits reviewed evidence gathering, not blind force |
191
+ | retention horizon | storage owner | may compact detail while preserving required identity and terminal truth |
192
+
193
+ Expiry is a predicate, not a background right to overwrite state. Cancel is a command. Both must
194
+ check current authority, state version, decision absence, and generation before leading to abort.
195
+
196
+ ## Operator decisions
197
+
198
+ A force-commit or force-abort path should require an evidence packet:
199
+
200
+ - operation and protocol version;
201
+ - immutable payload and participant-set hashes;
202
+ - durable coordinator decision or proof that none exists;
203
+ - participant observations and their freshness;
204
+ - current resource version and generation;
205
+ - effect and reservation records;
206
+ - requested action, actor, reason, and approval evidence;
207
+ - predicted invariant impact and recovery plan.
208
+
209
+ Reject a force-abort after a durable commit decision. Reject a force decision when evidence is
210
+ contradictory or stale. Preserve operator action in the append-only transition journal rather than
211
+ rewriting the prior history.
212
+
213
+ ## Journal and telemetry
214
+
215
+ Record transition facts in append-only order:
216
+
217
+ - journal sequence and operation ID;
218
+ - from and to authority state;
219
+ - execution-state change;
220
+ - decision and decision sequence;
221
+ - actor, attempt, participant, effect, resource, and generation;
222
+ - stable reason and error class;
223
+ - durable timestamp.
224
+
225
+ Emit success language only after the authoritative write. Distinguish requested, decision persisted,
226
+ effect applied, convergence complete, and cleanup complete.
227
+
228
+ Keep high-cardinality operation and attempt identities in logs and traces rather than metric labels.
229
+ Separate operation correlation from attempt spans; link attempts to the shared operation when a
230
+ single parent trace would become misleading or unbounded.
231
+
232
+ Measure:
233
+
234
+ - count and oldest age by authority and execution state;
235
+ - admission, decision persistence, effect application, and full convergence latency separately;
236
+ - in-doubt and blocked counts;
237
+ - stale-generation rejection;
238
+ - recovery attempts, progress age, and participant load;
239
+ - admission backpressure and quarantine count.
240
+
241
+ Run an invariant checker over the journal or durable state. Detect conflicting terminal decisions,
242
+ commit without matching admission contract, terminal-state regression, stale-generation effects,
243
+ missing recovery ownership, and silently abandoned nonterminal work.
244
+
245
+ ## Fault-injection matrix
246
+
247
+ | Injection point | Required observation |
248
+ | --- | --- |
249
+ | before operation record | no returned operation identity and no effect |
250
+ | after record before admission response | retry finds the same operation |
251
+ | before and after each participant admission | reversible reservations remain attributable |
252
+ | immediately before decision | either admitted authority remains or commit is visible |
253
+ | after decision before response | retry returns committed canonical result |
254
+ | after external effect before acknowledgement | lookup or inbox prevents rematerialization |
255
+ | before and after outbox or inbox write | local truth and delivery evidence do not split silently |
256
+ | one-way request loss | participant has no new effect or durable lookup proves it |
257
+ | one-way response loss | observer is unknown while durable authority remains queryable |
258
+ | half-open connection | bounded call stops waiting without inventing an outcome |
259
+ | duplicate or reordered delivery | effect identity, state version, and generation reject damage |
260
+ | pause across lease expiry | stale recovery owner cannot write |
261
+ | stale replica read | commit path revalidates against authoritative storage |
262
+ | recovery takeover | one generation owns progress and old attempts are fenced |
263
+ | cleanup or release replay | no over-release or deletion of newer resources |
264
+ | protocol upgrade with old work | only a compatible recovery implementation claims it |
265
+
266
+ Use configured failure-injection surfaces only. Production experiments require explicit scope,
267
+ abort conditions, impact limits, and automatic recovery owned by the relevant operational procedure.
268
+
269
+ ## Safety and liveness
270
+
271
+ Check safety and liveness separately.
272
+
273
+ Safety examples:
274
+
275
+ - commit and abort decisions do not coexist;
276
+ - commit uses the admitted immutable contract;
277
+ - no effect below the current fence is accepted;
278
+ - one business effect identity materializes at most once;
279
+ - ordinary reads never expose admitted private state as committed truth.
280
+
281
+ Liveness examples:
282
+
283
+ - every admitted operation eventually commits, aborts, or enters owned quarantine;
284
+ - every committed operation's required effects eventually converge or remain visibly blocked;
285
+ - reservations do not leak silently;
286
+ - recovery does not amplify load until normal traffic collapses;
287
+ - admission backpressure activates before limbo consumes the resource budget.
288
+
289
+ A system that prevents duplicate commit by never completing any operation is not correct.
290
+
291
+ ## Skill handoffs
292
+
293
+ - Use `idempotency-integrity-review` for duplicate logical intent, canonical payload binding,
294
+ replayed responses, retention, and provider idempotency.
295
+ - Use `dual-write-consistency` for local decision plus independently committed message,
296
+ projection, or provider convergence.
297
+ - Use `durable-workflow-orchestration` for long-running multi-step progress, compensation, timers,
298
+ approvals, and versioned resume.
299
+ - Use `execution-ledger-integrity-review` for append-only run, attempt, checkpoint, effect, and
300
+ receipt truth.
301
+ - Use `retry-policy-integrity-review` for retry ownership, classification, backoff, jitter, and
302
+ amplification budgets.
303
+ - Use `state-machine-pattern` for an entity's ordinary lifecycle table.
304
+ - Use `observability-debuggability-review` for wider trace, log, metric, and incident-diagnostic
305
+ design.
306
+ - Use `two-phase-transition-integrity-review` as the owner of the admission promise, irreversible
307
+ decision, authority cutover, fencing, and recovery semantics described here.
308
+