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.
- package/package.json +1 -1
- package/templates/default/i18n.toml +72 -6
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +37 -11
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/SKILL.md +477 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-diagnostics-abi-linker-checklist.md +778 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-generators-properties-checklist.md +501 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/compiler-test-strategy-differential-checklist.md +498 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/debug-symbol-symbolication-checklist.md +412 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/ir-design-ssa-pass-pipeline-checklist.md +759 -0
- package/templates/default/locales/en/.mustflow/skills/compiler-engineering-review/references/miscompile-reduction-ir-checklist.md +434 -0
- package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/SKILL.md +55 -36
- package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/references/path-containment-handle-checklist.md +251 -0
- package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/SKILL.md +133 -32
- package/templates/default/locales/en/.mustflow/skills/file-upload-security-review/references/file-upload-parser-ssrf-resource-checklist.md +306 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/SKILL.md +310 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-concurrency-model-checking-smt-checklist.md +457 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-contracts-modeling-checklist.md +434 -0
- package/templates/default/locales/en/.mustflow/skills/formal-verification-review/references/formal-memory-bounds-ci-checklist.md +509 -0
- package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/SKILL.md +439 -0
- package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-harness-campaign-checklist.md +379 -0
- package/templates/default/locales/en/.mustflow/skills/fuzz-harness-review/references/fuzz-oracle-triage-ci-checklist.md +307 -0
- package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/SKILL.md +48 -28
- package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/references/operation-ordering-stale-write-checklist.md +259 -0
- package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/SKILL.md +329 -0
- package/templates/default/locales/en/.mustflow/skills/input-boundary-validation-review/references/input-boundary-security-checklist.md +319 -0
- package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/SKILL.md +306 -0
- package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/input-session-state-checklist.md +298 -0
- package/templates/default/locales/en/.mustflow/skills/input-event-synchronization-review/references/remote-input-transport-interaction-checklist.md +328 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/SKILL.md +353 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-diagnostics-recovery-checklist.md +267 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-execution-closure-performance-checklist.md +428 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-gc-verification-checklist.md +457 -0
- package/templates/default/locales/en/.mustflow/skills/interpreter-engineering-review/references/interpreter-semantics-runtime-checklist.md +391 -0
- package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/SKILL.md +294 -0
- package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/modal-loop-reentrancy-checklist.md +290 -0
- package/templates/default/locales/en/.mustflow/skills/modal-loop-reentrancy-review/references/nested-modal-state-lifetime-checklist.md +297 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/SKILL.md +252 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/dns-network-resolution-checklist.md +394 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/language-symbol-resolution-checklist.md +282 -0
- package/templates/default/locales/en/.mustflow/skills/name-resolution-integrity-review/references/module-package-loader-resolution-checklist.md +352 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/SKILL.md +103 -17
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/cst-ast-lowering-checklist.md +260 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/lexer-tokenization-checklist.md +397 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-serialization-compatibility-checklist.md +164 -0
- package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/references/tree-traversal-rewrite-checklist.md +209 -0
- package/templates/default/locales/en/.mustflow/skills/race-condition-review/SKILL.md +68 -11
- package/templates/default/locales/en/.mustflow/skills/race-condition-review/references/race-reproduction-memory-model-checklist.md +268 -0
- package/templates/default/locales/en/.mustflow/skills/routes.toml +151 -0
- package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/SKILL.md +343 -0
- package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-auth-stream-resume-checklist.md +413 -0
- package/templates/default/locales/en/.mustflow/skills/session-handoff-integrity-review/references/session-handoff-protocol-checklist.md +485 -0
- package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/SKILL.md +267 -0
- package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/admission-decision-recovery-checklist.md +308 -0
- package/templates/default/locales/en/.mustflow/skills/two-phase-transition-integrity-review/references/two-phase-transition-checklist.md +229 -0
- package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/SKILL.md +300 -0
- package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-affinity-event-loop-checklist.md +277 -0
- package/templates/default/locales/en/.mustflow/skills/ui-dispatch-lifecycle-review/references/ui-dispatch-lifecycle-checklist.md +292 -0
- package/templates/default/manifest.toml +115 -1
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# Fuzz Oracle, Triage, and CI Checklist
|
|
2
|
+
|
|
3
|
+
Use this reference when coverage-guided fuzzing is combined with property-based generation,
|
|
4
|
+
differential or metamorphic checking, crash minimization, sanitizer lanes, or CI corpus management.
|
|
5
|
+
Coverage finds unfamiliar execution. The oracle decides whether the behavior is wrong.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
1. [Evidence model](#1-evidence-model)
|
|
10
|
+
2. [Property-based entropy and abstract inputs](#2-property-based-entropy-and-abstract-inputs)
|
|
11
|
+
3. [Semantic result envelopes](#3-semantic-result-envelopes)
|
|
12
|
+
4. [Differential and metamorphic oracle ledger](#4-differential-and-metamorphic-oracle-ledger)
|
|
13
|
+
5. [Stable property and crash identities](#5-stable-property-and-crash-identities)
|
|
14
|
+
6. [Reproduction capsule and flaky classification](#6-reproduction-capsule-and-flaky-classification)
|
|
15
|
+
7. [Exact minimization and shrinking](#7-exact-minimization-and-shrinking)
|
|
16
|
+
8. [Trigger, detection, and root cause](#8-trigger-detection-and-root-cause)
|
|
17
|
+
9. [Sanitizer and assertion lanes](#9-sanitizer-and-assertion-lanes)
|
|
18
|
+
10. [CI cadence and asset classes](#10-ci-cadence-and-asset-classes)
|
|
19
|
+
11. [Regression promotion and negative controls](#11-regression-promotion-and-negative-controls)
|
|
20
|
+
12. [Primary reference anchors](#12-primary-reference-anchors)
|
|
21
|
+
|
|
22
|
+
## 1. Evidence model
|
|
23
|
+
|
|
24
|
+
Keep these roles separate:
|
|
25
|
+
|
|
26
|
+
| Surface | Role | Does not prove |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Edge or feature coverage | Search guidance | Correct result |
|
|
29
|
+
| Value, comparison, or distance signal | Proximity guidance | Failure |
|
|
30
|
+
| Corpus | Search cache and replay input | Permanent regression coverage |
|
|
31
|
+
| Sanitizer | Named runtime defect class | Semantic correctness |
|
|
32
|
+
| Property or invariant | Contract violation | Root cause by itself |
|
|
33
|
+
| Differential mismatch | Candidate disagreement | Which implementation is wrong |
|
|
34
|
+
| Crash artifact | Trigger evidence | Reproducibility or uniqueness |
|
|
35
|
+
| Explicit regression | Durable fixed contract | Current campaign breadth |
|
|
36
|
+
|
|
37
|
+
Do not fail an input because its semantic distance score is large. Distance may guide mutation, but
|
|
38
|
+
only a named oracle changes the outcome to failure.
|
|
39
|
+
|
|
40
|
+
## 2. Property-based entropy and abstract inputs
|
|
41
|
+
|
|
42
|
+
When a fuzzer drives a property-based generator:
|
|
43
|
+
|
|
44
|
+
- consume artifact bytes through one deterministic entropy provider;
|
|
45
|
+
- remove secondary calls to random APIs, current time, process-specific hash seeds, locale, or
|
|
46
|
+
scheduler choices unless those facts are encoded in the artifact;
|
|
47
|
+
- make byte exhaustion deterministic and bounded;
|
|
48
|
+
- decode lengths from remaining capacity instead of allocating from untrusted declarations;
|
|
49
|
+
- select generated references from the current object or handle pool;
|
|
50
|
+
- bias reducible values toward zero, one, empty, singleton, and named boundaries; and
|
|
51
|
+
- reject only inputs outside the declared property domain, not inputs that are merely inconvenient.
|
|
52
|
+
|
|
53
|
+
Generate one abstract object or command sequence and derive compared representations from it.
|
|
54
|
+
Examples include old and new wire formats, JSON and binary encodings, or two backend inputs. State
|
|
55
|
+
whether the parser is under test: a shared parser or shared AST can intentionally remove parser
|
|
56
|
+
differences from the comparison.
|
|
57
|
+
|
|
58
|
+
Assign an `origin_id` to the abstract input and retain it on every metamorphic follow-up, result,
|
|
59
|
+
artifact, and minimized regression.
|
|
60
|
+
|
|
61
|
+
## 3. Semantic result envelopes
|
|
62
|
+
|
|
63
|
+
Normalize results into a versioned envelope before comparing implementations or builds:
|
|
64
|
+
|
|
65
|
+
| Field | Example meaning |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `outcome` | accepted, rejected, property failure, runtime failure |
|
|
68
|
+
| `failure_class` | stable domain category, not renderer text |
|
|
69
|
+
| `value` | canonical semantic value or digest |
|
|
70
|
+
| `consumed` | input units consumed or trailing-data policy |
|
|
71
|
+
| `state_delta` | durable or in-memory state transition |
|
|
72
|
+
| `effects` | writes, events, messages, external calls, cleanup |
|
|
73
|
+
| `checkpoint` | earliest normalized stage reached or diverged |
|
|
74
|
+
| `property_id` | stable violated property or invariant |
|
|
75
|
+
|
|
76
|
+
Preserve raw stdout, stderr, exceptions, and values separately for triage. Normalize only declared
|
|
77
|
+
differences such as temporary paths, addresses, timestamps, map ordering, platform messages, locale,
|
|
78
|
+
NaN spelling, or generated identifiers. Over-normalization can erase the defect.
|
|
79
|
+
|
|
80
|
+
Use checkpoint digests for hot comparison only when the minimized artifact is later checked against
|
|
81
|
+
the full canonical checkpoint state.
|
|
82
|
+
|
|
83
|
+
## 4. Differential and metamorphic oracle ledger
|
|
84
|
+
|
|
85
|
+
For every differential comparison, record:
|
|
86
|
+
|
|
87
|
+
- the shared specified domain and excluded undefined or implementation-defined behavior;
|
|
88
|
+
- implementation independence, including shared parsers, libraries, generators, and helpers;
|
|
89
|
+
- compared envelope fields and explicitly ignored differences;
|
|
90
|
+
- reference model, third implementation, specification rule, or metamorphic relation used to
|
|
91
|
+
assign fault; and
|
|
92
|
+
- version, optimization, feature-flag, integer-width, architecture, or compatibility axes.
|
|
93
|
+
|
|
94
|
+
Two implementations can share one bug. A mismatch is a candidate until independent evidence names
|
|
95
|
+
the violated contract.
|
|
96
|
+
|
|
97
|
+
For metamorphic testing, derive follow-ups from one origin and encode the relation's precondition.
|
|
98
|
+
Useful relations include:
|
|
99
|
+
|
|
100
|
+
- parse and canonical serialize round trip;
|
|
101
|
+
- normalization idempotence;
|
|
102
|
+
- equivalent chunk partitions;
|
|
103
|
+
- permutation of fields whose order is declared irrelevant;
|
|
104
|
+
- compression followed by decompression;
|
|
105
|
+
- failed transaction leaves the prior state unchanged; and
|
|
106
|
+
- monotonic or commutative behavior within a bounded declared domain.
|
|
107
|
+
|
|
108
|
+
Do not compare independently generated inputs and call the relation metamorphic.
|
|
109
|
+
|
|
110
|
+
## 5. Stable property and crash identities
|
|
111
|
+
|
|
112
|
+
Give every property a durable identifier such as `P037_ROUNDTRIP_LENGTH`. Include domain or tolerance
|
|
113
|
+
versions when they change meaning.
|
|
114
|
+
|
|
115
|
+
Construct a canonical failure key from applicable stable fields:
|
|
116
|
+
|
|
117
|
+
- runtime or sanitizer kind;
|
|
118
|
+
- access or operation type;
|
|
119
|
+
- property identifier;
|
|
120
|
+
- earliest divergence checkpoint;
|
|
121
|
+
- stable application frames after symbolization and runtime-frame removal; and
|
|
122
|
+
- target, build, architecture, or decoder-schema identity when required.
|
|
123
|
+
|
|
124
|
+
Do not route every property through one indistinguishable assertion site. Do not deduplicate by raw
|
|
125
|
+
program counter, complete stack text, allocator frames, temporary paths, or rendered messages.
|
|
126
|
+
|
|
127
|
+
## 6. Reproduction capsule and flaky classification
|
|
128
|
+
|
|
129
|
+
Bind each artifact to a reproduction capsule:
|
|
130
|
+
|
|
131
|
+
- binary and debug-symbol hashes;
|
|
132
|
+
- compiler, linker, runtime, and dependency versions;
|
|
133
|
+
- source revision and complete build flags;
|
|
134
|
+
- sanitizer, fuzzer, seed, timeout, memory, and campaign options;
|
|
135
|
+
- environment variables, locale, timezone, working directory, and filesystem fixture;
|
|
136
|
+
- dynamic libraries, operating system, kernel-relevant behavior, CPU, and architecture;
|
|
137
|
+
- thread count, scheduling or fault seed, forced yield points, and repetition count;
|
|
138
|
+
- network response ordering, delays, and close points when applicable; and
|
|
139
|
+
- raw artifact, decoder schema, canonical form, and expected failure key.
|
|
140
|
+
|
|
141
|
+
Before minimizing, replay the capsule several times and record every observed failure key. Classify:
|
|
142
|
+
|
|
143
|
+
- `deterministic`: the expected failure is stable;
|
|
144
|
+
- `probabilistic`: the expected failure appears with a measured frequency; or
|
|
145
|
+
- `multimodal`: multiple failure classes or checkpoints appear.
|
|
146
|
+
|
|
147
|
+
A mix of use-after-free, timeout, and success is not one ordinary crash. Preserve the distribution
|
|
148
|
+
and investigate state, scheduling, or undefined behavior before shrinking.
|
|
149
|
+
|
|
150
|
+
Do not derive a gate such as “N failures in M attempts” from one observed sample. Repetition count,
|
|
151
|
+
confidence rule, acceptable failure rate, and promotion threshold belong to a repository-owned,
|
|
152
|
+
versioned flaky-test policy. Without that policy, report the measured distribution, retain the
|
|
153
|
+
artifact in triage, and do not promote it to a deterministic regression gate.
|
|
154
|
+
|
|
155
|
+
## 7. Exact minimization and shrinking
|
|
156
|
+
|
|
157
|
+
The minimizer predicate must require the same failure, not merely a non-zero exit. Use the canonical
|
|
158
|
+
failure key or a documented subset that remains stable across reduction.
|
|
159
|
+
|
|
160
|
+
Alternate these reducers to a fixed point when both representations matter:
|
|
161
|
+
|
|
162
|
+
1. byte reduction removes padding, duplicate fragments, or irrelevant fields;
|
|
163
|
+
2. decode under the versioned harness schema;
|
|
164
|
+
3. semantic shrinking removes nodes, operations, branches, and references while preserving
|
|
165
|
+
structural validity;
|
|
166
|
+
4. deterministic serialization rebuilds dependent lengths, checksums, or offsets; and
|
|
167
|
+
5. byte reduction runs again under the exact predicate.
|
|
168
|
+
|
|
169
|
+
Shrink every causal dimension. For concurrency, reduce thread count, schedule seed, yields, and
|
|
170
|
+
repetitions. For fault injection, reduce failing call index and one-shot or persistent mode. For
|
|
171
|
+
network behavior, reduce response order, delay, chunking, and close point.
|
|
172
|
+
|
|
173
|
+
Reject a reduction if it changes use-after-free into stack overflow, property failure into timeout,
|
|
174
|
+
or one divergence checkpoint into another.
|
|
175
|
+
|
|
176
|
+
## 8. Trigger, detection, and root cause
|
|
177
|
+
|
|
178
|
+
Record three different coordinates:
|
|
179
|
+
|
|
180
|
+
| Coordinate | Meaning |
|
|
181
|
+
| --- | --- |
|
|
182
|
+
| Trigger | Input and environment tuple that exposes the event |
|
|
183
|
+
| Detection point | Sanitizer, assertion, property, or timeout observation |
|
|
184
|
+
| Root cause | Earliest violated contract that created the invalid state |
|
|
185
|
+
|
|
186
|
+
Use state checkpoints, allocation and free histories, uninitialized-value origins, and per-command
|
|
187
|
+
invariants to move from detection toward creation. The top sanitizer frame is not automatically the
|
|
188
|
+
fix location.
|
|
189
|
+
|
|
190
|
+
For long sequences, find the last valid and first invalid checkpoint before bisecting source
|
|
191
|
+
history. Otherwise allocator or optimization changes can identify the first visible symptom rather
|
|
192
|
+
than the change that introduced the cause.
|
|
193
|
+
|
|
194
|
+
Separate timeout, OOM, stack overflow, leak, and infinite progress failure. Compare multiple limits
|
|
195
|
+
and input sizes, operation counts, CPU, maximum RSS, retained resources, and work counters to
|
|
196
|
+
distinguish a fixed threshold from quadratic, exponential, or cumulative behavior.
|
|
197
|
+
|
|
198
|
+
## 9. Sanitizer and assertion lanes
|
|
199
|
+
|
|
200
|
+
Use purpose-specific builds when compatibility or cost differs:
|
|
201
|
+
|
|
202
|
+
| Lane | Primary role |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| Fast coverage | Search volume and reachability |
|
|
205
|
+
| Address and leak | Bounds, lifetime, double free, retained allocations |
|
|
206
|
+
| Undefined and integer | UB, truncation, sign change, unintended overflow |
|
|
207
|
+
| Uninitialized read | Uninitialized data; origin tracking during focused triage |
|
|
208
|
+
| Race | Stateful sequence and replay under measured scheduling |
|
|
209
|
+
| Assertion-heavy | Internal preconditions, postconditions, ownership, locks, invariants |
|
|
210
|
+
| Production-equivalent replay | Confirm fuzz-friendly gates did not create a test-only result |
|
|
211
|
+
|
|
212
|
+
Terminate on undefined behavior in triage so corrupted-state follow-on symptoms do not become new
|
|
213
|
+
bugs. Scope integer checks explicitly; a generic undefined bundle is not proof against every
|
|
214
|
+
conversion or unsigned arithmetic defect.
|
|
215
|
+
|
|
216
|
+
Assertions should monitor internal contracts after external validation. Malformed input that is
|
|
217
|
+
supposed to be rejected should not be converted into a harness assertion crash.
|
|
218
|
+
|
|
219
|
+
Run invariants after each state transition, not only at the end. Prefer independent shadow checks:
|
|
220
|
+
stored count versus traversal count, index result versus full scan, free versus used set, parent
|
|
221
|
+
list versus child backlink, or actual resources versus tracked totals.
|
|
222
|
+
|
|
223
|
+
## 10. CI cadence and asset classes
|
|
224
|
+
|
|
225
|
+
Run bounded CI in this order:
|
|
226
|
+
|
|
227
|
+
1. explicit semantic regressions;
|
|
228
|
+
2. reviewed seed and minimized regression corpus replay; and
|
|
229
|
+
3. new mutation with the remaining budget.
|
|
230
|
+
|
|
231
|
+
Use separate time horizons:
|
|
232
|
+
|
|
233
|
+
- PR: changed-code targets, explicit regressions, bounded replay, short mutation;
|
|
234
|
+
- batch: periodic corpus growth and merge;
|
|
235
|
+
- deep: slower sanitizer, stateful, cross-build, and cross-platform campaigns.
|
|
236
|
+
|
|
237
|
+
Keep these asset classes separate:
|
|
238
|
+
|
|
239
|
+
| Asset | Owner and lifecycle |
|
|
240
|
+
| --- | --- |
|
|
241
|
+
| Seed set | Small, reviewed, mostly stable, checked in when appropriate |
|
|
242
|
+
| Coverage corpus | Evolving instrumentation-dependent search cache |
|
|
243
|
+
| Crash artifacts | Original untriaged evidence, immutable until classified |
|
|
244
|
+
| Semantic regressions | Minimized, explained, property-bound durable tests |
|
|
245
|
+
|
|
246
|
+
Version every corpus bundle with target, harness schema, engine and options, build and instrumentation
|
|
247
|
+
identity, sanitizer, creation time, parent corpus, and coverage fingerprint. On schema change, choose
|
|
248
|
+
`migrate`, `replay-only`, or `invalidate` explicitly.
|
|
249
|
+
|
|
250
|
+
Merge candidate corpora in staging, validate under the target decoder and instrumentation, then
|
|
251
|
+
promote atomically while preserving the previous snapshot. Do not let multiple engines write one
|
|
252
|
+
directory concurrently. Coverage pruning cannot delete semantic regressions it cannot observe.
|
|
253
|
+
|
|
254
|
+
Track executions per second, calibration or load time, valid-input ratio, feature yield, stable
|
|
255
|
+
unique failures, flaky rate, minimization success, and regression replay time. Line coverage alone
|
|
256
|
+
cannot distinguish deep semantic exploration from shallow early rejection.
|
|
257
|
+
|
|
258
|
+
## 11. Regression promotion and negative controls
|
|
259
|
+
|
|
260
|
+
Promote a discovery only when it:
|
|
261
|
+
|
|
262
|
+
- reproduces under its capsule;
|
|
263
|
+
- has an exact minimized failure predicate;
|
|
264
|
+
- represents a distinct contract or entry path rather than a duplicate symptom;
|
|
265
|
+
- has a canonical human-readable structure when the byte encoding is opaque;
|
|
266
|
+
- names the stable property or invariant; and
|
|
267
|
+
- can run in a bounded ordinary regression path.
|
|
268
|
+
|
|
269
|
+
Retain three related assets when valuable: original artifact bytes, canonical structured input, and
|
|
270
|
+
an explicit property-bound regression. A coverage corpus or property-based example database remains
|
|
271
|
+
a search cache, not the only permanent correctness record.
|
|
272
|
+
|
|
273
|
+
Prove the fix with the original, minimized, and nearby inputs plus applicable sanitizer lanes. Then
|
|
274
|
+
use a bounded negative control when practical: reintroduce the repaired violation or mutate the
|
|
275
|
+
guarded condition and require the regression to fail. If the negative control passes, the test may
|
|
276
|
+
only be hiding the detection point or avoiding the path.
|
|
277
|
+
|
|
278
|
+
Delete an old regression only when a stronger property demonstrably covers it and catches a
|
|
279
|
+
negative-control reintroduction of the historical defect.
|
|
280
|
+
|
|
281
|
+
Keep flaky artifacts in a measured reproduction lane with owner and deadline. Do not silently
|
|
282
|
+
delete them, and do not make an unstable artifact an endlessly ignored main-gate failure.
|
|
283
|
+
|
|
284
|
+
## 12. Primary reference anchors
|
|
285
|
+
|
|
286
|
+
Refresh tool-specific behavior from current primary documentation:
|
|
287
|
+
|
|
288
|
+
- [LLVM libFuzzer](https://llvm.org/docs/LibFuzzer.html) for deterministic narrow targets, corpus,
|
|
289
|
+
replay, merge, minimization, value profiles, limits, artifacts, and fuzz-friendly builds.
|
|
290
|
+
- [Hypothesis external fuzzers](https://hypothesis.readthedocs.io/en/latest/how-to/external-fuzzers.html)
|
|
291
|
+
for mapping external fuzzer bytes into one generated example.
|
|
292
|
+
- [Hypothesis stateful testing](https://hypothesis.readthedocs.io/en/latest/stateful.html) for
|
|
293
|
+
command sequences, bundles, rules, and invariants.
|
|
294
|
+
- [Clang AddressSanitizer](https://clang.llvm.org/docs/AddressSanitizer.html),
|
|
295
|
+
[UndefinedBehaviorSanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html),
|
|
296
|
+
[MemorySanitizer](https://clang.llvm.org/docs/MemorySanitizer.html), and
|
|
297
|
+
[ThreadSanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) for current detector scope,
|
|
298
|
+
options, compatibility, symbolization, and runtime cost guidance.
|
|
299
|
+
- [AFL++ fuzzing in depth](https://aflplus.plus/docs/fuzzing_in_depth/) for campaign setup,
|
|
300
|
+
instrumentation, sanitizer instances, corpus minimization, dictionaries, analysis, and triage.
|
|
301
|
+
- [ClusterFuzzLite running guide](https://google.github.io/clusterfuzzlite/running-clusterfuzzlite/)
|
|
302
|
+
for pull-request, batch, coverage, corpus pruning, and scheduled workflow roles.
|
|
303
|
+
- [SQLite testing](https://sqlite.org/testing.html) for independent harnesses, fault injection,
|
|
304
|
+
assertions, multiple builds, regression tests, and mutation-based test validation.
|
|
305
|
+
|
|
306
|
+
Tool flags and cost ratios drift. Keep the skill's invariant stable and confirm exact options against
|
|
307
|
+
the repository's pinned engine, compiler, sanitizer, and CI version.
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
mustflow_doc: skill.idempotency-integrity-review
|
|
3
3
|
locale: en
|
|
4
4
|
canonical: true
|
|
5
|
-
revision:
|
|
5
|
+
revision: 3
|
|
6
6
|
lifecycle: mustflow-owned
|
|
7
7
|
authority: procedure
|
|
8
8
|
name: idempotency-integrity-review
|
|
9
|
-
description: Apply this skill when code is created, changed, reviewed, or reported and repeated requests, retries, webhooks, queue
|
|
9
|
+
description: Apply this skill when code is created, changed, reviewed, or reported and repeated or out-of-order requests, retries, webhooks, queue delivery, schedulers, batch replays, callbacks, timeouts, or stale asynchronous completions could apply one logical business operation more than once, regress aggregate state, or let an old decision overwrite newer authority.
|
|
10
10
|
metadata:
|
|
11
11
|
mustflow_schema: "1"
|
|
12
12
|
mustflow_kind: procedure
|
|
@@ -29,16 +29,19 @@ metadata:
|
|
|
29
29
|
<!-- mustflow-section: purpose -->
|
|
30
30
|
## Purpose
|
|
31
31
|
|
|
32
|
-
Review idempotency as
|
|
32
|
+
Review idempotency as operation identity plus state-validity integrity, not as an HTTP method
|
|
33
|
+
checklist.
|
|
33
34
|
|
|
34
|
-
The review question is not "is this POST protected?" It is "if the same business intent is
|
|
35
|
+
The review question is not only "is this POST protected?" It is "if the same business intent is
|
|
36
|
+
delivered twice, completes out of order, or acts on authority that has changed, which durable gate
|
|
37
|
+
deduplicates the operation or rejects the stale result?"
|
|
35
38
|
|
|
36
39
|
<!-- mustflow-section: use-when -->
|
|
37
40
|
## Use When
|
|
38
41
|
|
|
39
|
-
- Code creates, changes, reviews, or reports POST, PATCH, DELETE, webhook, callback, queue consumer, scheduler, batch, retry, timeout recovery, mobile app retry, browser refresh, double-click, provider callback, external API call,
|
|
42
|
+
- Code creates, changes, reviews, or reports POST, PATCH, DELETE, webhook, callback, queue consumer, scheduler, batch, retry, timeout recovery, mobile app retry, browser refresh, double-click, provider callback, external API call, background job, or late asynchronous completion behavior.
|
|
40
43
|
- The operation can charge, capture, refund, withdraw, grant points, deduct credits, deduct stock, issue coupons, send email, create shipments, grant entitlements, change status, publish events, acknowledge messages, or call providers.
|
|
41
|
-
- Idempotency keys, event IDs, message IDs, request IDs, operation IDs, provider object IDs, inbox or outbox records, dedupe tables, processing states, retry libraries, locks, or duplicate request responses are introduced, changed, reviewed, or claimed safe.
|
|
44
|
+
- Idempotency keys, event IDs, message IDs, request IDs, operation or attempt IDs, provider object IDs, aggregate versions, generation or fencing tokens, inbox or outbox records, dedupe tables, processing states, retry libraries, locks, ordering groups, or duplicate request responses are introduced, changed, reviewed, or claimed safe.
|
|
42
45
|
- A review or final report claims an operation is idempotent, retry-safe, duplicate-safe, exactly-once, safe to replay, safe to reprocess, safe after timeout, protected by frontend disabling, protected by Redis, protected by a lock, or protected by provider idempotency.
|
|
43
46
|
|
|
44
47
|
<!-- mustflow-section: do-not-use-when -->
|
|
@@ -56,12 +59,13 @@ The review question is not "is this POST protected?" It is "if the same business
|
|
|
56
59
|
<!-- mustflow-section: required-inputs -->
|
|
57
60
|
## Required Inputs
|
|
58
61
|
|
|
59
|
-
- Operation identity ledger: logical operation, actor, tenant, target resource, business operation type,
|
|
62
|
+
- Operation identity ledger: logical operation, attempt, effect, actor, tenant, target resource, business operation type, canonical payload hash, idempotency key, event ID, message ID, provider object ID, batch key, scheduler run key, and retry source.
|
|
63
|
+
- Ordering and authority ledger: aggregate key, ordering scope, observed state, expected state, aggregate version, sequence, generation, fencing token, gap policy, stale-result decision, and authoritative conditional write.
|
|
60
64
|
- Side-effect ledger: every charge, refund, balance change, stock change, coupon issue, shipment, email, notification, entitlement, status transition, file write, queue publish, cache change, provider call, and audit entry.
|
|
61
65
|
- Durable dedupe evidence: unique constraints, idempotency table, inbox table, outbox table, applied event table, ledger source key, conditional update, state guard, provider idempotency key, and response record.
|
|
62
66
|
- Duplicate response policy: cached success response, duplicate conflict response, in-progress response, payload mismatch response, failed validation response, unknown outcome recovery, and caller-visible retry contract.
|
|
63
67
|
- Concurrency and recovery evidence: simultaneous duplicate requests, process restart, TTL expiry, `PROCESSING` stuck state, lease, heartbeat, retry budget, timeout classification, provider lookup, reconciliation, and lock fallback.
|
|
64
|
-
- Queue, webhook, scheduler, and batch evidence: ack timing, redelivery semantics, event ordering, signature checks, event storage, per-aggregate ordering, reprocessing rules, and run-level uniqueness.
|
|
68
|
+
- Queue, webhook, scheduler, and batch evidence: ack timing, redelivery semantics, event ordering scope, partition or group key derivation, missing-sequence handling, signature checks, event storage, per-aggregate ordering, reprocessing rules, and run-level uniqueness.
|
|
65
69
|
- Test evidence: duplicate request tests, concurrent duplicate tests, timeout-then-retry tests, external-success-internal-failure tests, DB-success-response-failure tests, duplicate webhook tests, stale event tests, ack-failure tests, and configured command intents.
|
|
66
70
|
|
|
67
71
|
<!-- mustflow-section: preconditions -->
|
|
@@ -76,10 +80,11 @@ The review question is not "is this POST protected?" It is "if the same business
|
|
|
76
80
|
<!-- mustflow-section: allowed-edits -->
|
|
77
81
|
## Allowed Edits
|
|
78
82
|
|
|
79
|
-
- Add or tighten durable idempotency records,
|
|
83
|
+
- Add or tighten durable idempotency records, canonical payload hash comparison, user and tenant binding, operation-type binding, target-resource binding, unique non-null constraints, atomic insert-or-return behavior, aggregate versions, generation or fencing tokens, gap handling, conditional state guards, affected-row checks, inbox records, outbox records, applied-event ledgers, provider result lookup, response replay, processing lease recovery, and focused duplicate or stale-order tests.
|
|
80
84
|
- Move external side effects behind durable operation records or outbox records when local style supports it.
|
|
81
85
|
- Make retry classification explicit for validation failure, transient failure, timeout with unknown outcome, provider success with local failure, local success with missing response, duplicate in progress, and duplicate completed.
|
|
82
86
|
- Do not treat frontend button disabling, debounce, in-memory flags, Redis TTL alone, provider idempotency alone, or distributed locks alone as final proof of idempotency.
|
|
87
|
+
- Do not treat cancellation, process-local single-flight, FIFO naming, timestamps, arrival order, or auto-increment identifiers as durable proof that a late result is current.
|
|
83
88
|
- Do not make duplicate protection by returning a different success shape unless the caller contract can safely reconcile it.
|
|
84
89
|
|
|
85
90
|
<!-- mustflow-section: procedure -->
|
|
@@ -88,6 +93,7 @@ The review question is not "is this POST protected?" It is "if the same business
|
|
|
88
93
|
1. Name the logical operation, not only the endpoint.
|
|
89
94
|
- POST, PATCH, DELETE, webhook, queue consumer, scheduler, batch replay, retry wrapper, and callback handlers can all carry the same duplicate-intent risk.
|
|
90
95
|
- Ask what "same intent" means in business terms: same order payment attempt, same refund, same point grant, same coupon redemption, same shipment, same notification, same state transition, same imported row, or same provider event.
|
|
96
|
+
- Separate the stable operation ID from attempt, message, event, effect, trace, worker, and provider IDs. Generate a new attempt ID for a retry without generating a new business operation.
|
|
91
97
|
2. Start at the side effect.
|
|
92
98
|
- Find calls and writes named like `charge`, `capture`, `refund`, `withdraw`, `grantPoint`, `deductStock`, `issueCoupon`, `sendEmail`, `createShipment`, `publish`, `ack`, `markPaid`, `fulfill`, and local equivalents.
|
|
93
99
|
- For each side effect, ask what happens if the exact surrounding handler runs twice, runs concurrently, or runs after the first response is lost.
|
|
@@ -95,9 +101,11 @@ The review question is not "is this POST protected?" It is "if the same business
|
|
|
95
101
|
- A key is not enough unless it is bound to actor, tenant, operation type, target resource, and request body hash or equivalent semantic fingerprint.
|
|
96
102
|
- Duplicate key plus changed amount, resource, user, tenant, product, operation, or payload should become a stable mismatch response, not a new operation or silent old response.
|
|
97
103
|
- Do not accept memory-only stores, process-local maps, or Redis TTL alone for operations that can be retried after restart, failover, delayed callback, or TTL expiry.
|
|
104
|
+
- Keep the operation key stable across request, durable operation record, inbox or outbox, external effect, result lookup, and response replay.
|
|
98
105
|
4. Require durable uniqueness at the operation boundary.
|
|
99
106
|
- App-only `if exists return` followed by `insert` is a race. Use a unique constraint, atomic insert, upsert, conditional write, or durable ledger key.
|
|
100
107
|
- Review migrations or schema definitions, not just service code, for keys such as `order_id`, `payment_id`, `refund_id`, `event_id`, `message_id`, `idempotency_key`, `campaign_id + user_id`, and `settlement_date + merchant_id`.
|
|
108
|
+
- Where the key is required, verify that the authoritative uniqueness field cannot be null and that a matching key with a different canonical payload or binding is rejected.
|
|
101
109
|
5. Check response replay.
|
|
102
110
|
- Idempotency is often needed because the caller did not receive the first response.
|
|
103
111
|
- A duplicate completed request should usually return the original response or an equivalent stable result the caller can reconcile.
|
|
@@ -111,52 +119,64 @@ The review question is not "is this POST protected?" It is "if the same business
|
|
|
111
119
|
8. Check external API ordering.
|
|
112
120
|
- External API call before durable local operation record creates duplicate risk when the local process times out or crashes before saving success.
|
|
113
121
|
- Provider idempotency can protect the provider call while internal follow-up work still duplicates. Internal idempotency remains required.
|
|
114
|
-
9.
|
|
122
|
+
9. Define the ordering scope and authority token.
|
|
123
|
+
- Name the smallest aggregate whose operations require order. Transport grouping or partitioning proves order only inside its documented scope and does not prove that application or external effects complete in that order.
|
|
124
|
+
- Prefer an aggregate version, store revision, generation, or fencing token created for authority. Do not infer causality from wall-clock time, retry time, arrival time, or auto-increment identifiers.
|
|
125
|
+
- Define older-or-equal, exactly-next, and ahead-with-a-gap branches. Bound buffering or retry, name the resynchronization owner, and keep stuck gaps observable.
|
|
126
|
+
10. Review state transitions as conditional operations.
|
|
115
127
|
- `UPDATE ... SET status = PAID WHERE id = ?` is weaker than `WHERE id = ? AND status = PENDING` or an equivalent state-machine guard.
|
|
116
|
-
-
|
|
117
|
-
|
|
128
|
+
- Carry expected state, version, generation, or fence to the authoritative write. Treat zero affected rows or a failed compare-and-swap as a stale decision that requires re-reading authority, not blind replay of the old calculation.
|
|
129
|
+
- Late duplicate events should not overwrite terminal, newer, or higher-order states. Event time alone is not an authority token.
|
|
130
|
+
11. Separate cancellation and request coalescing from correctness.
|
|
131
|
+
- Cancellation requests cleanup; it does not revoke callbacks, cache writes, durable commits, or external effects that already completed.
|
|
132
|
+
- Process-local single-flight reduces duplicate load but loses authority across instances, restart, failover, and leader change. Keep durable operation identity and storage guards behind it.
|
|
133
|
+
12. Prefer order-insensitive mutations when the domain permits them.
|
|
134
|
+
- An immutable operation or ledger entry with a stable operation ID can be safer than replacing a full snapshot.
|
|
135
|
+
- Commutative application does not remove duplicate risk. Deduplicate operation identity and model reversal or compensation as another identified operation.
|
|
136
|
+
13. Review increments and ledger entries.
|
|
118
137
|
- `+=`, balance increases, point grants, stock deductions, usage counters, retry counters, and mutable totals duplicate naturally.
|
|
119
138
|
- Require an applied-event table, source ledger key, unique entry identity, conditional update, or state transition that records the event already moved the number.
|
|
120
|
-
|
|
139
|
+
14. Review deletion and "read" endpoints for hidden side effects.
|
|
121
140
|
- DELETE may be final-state idempotent while refund, notification, inventory restoration, audit, or permission side effects still duplicate.
|
|
122
141
|
- GET endpoints that mark read, accept invites, decrement quota, create download usage, or mutate analytics are not harmless reads under crawler, preview, refresh, or retry behavior.
|
|
123
|
-
|
|
142
|
+
15. Review queues and consumers as at-least-once by default.
|
|
124
143
|
- Consumer code should assume duplicate messages, delayed redelivery, concurrent workers, ack failure after commit, and process death after side effects.
|
|
125
144
|
- Store message ID, event ID, business key, or source ledger key in an inbox or applied-event table before applying irreversible effects.
|
|
126
|
-
|
|
145
|
+
16. Review ack timing.
|
|
127
146
|
- Ack before durable commit can lose work.
|
|
128
147
|
- Ack after durable commit can redeliver work.
|
|
129
148
|
- Prefer accepting redelivery and making the handler idempotent, with dead-letter and retry evidence for poison messages.
|
|
130
|
-
|
|
149
|
+
17. Review webhook handlers as replay surfaces.
|
|
131
150
|
- External providers resend callbacks when they miss acceptable responses.
|
|
132
151
|
- Store event IDs or provider object/type pairs, verify signatures, bind the event to the expected business object, and guard state transitions against duplicates and stale event order.
|
|
133
|
-
|
|
152
|
+
18. Review schedulers and batches.
|
|
134
153
|
- Jobs are rerun after deploys, crashes, partial failures, and manual operator actions.
|
|
135
154
|
- Use business keys such as `settlement_date + merchant_id`, `campaign_id + user_id`, import file row identity, period key, or run source ID instead of loose "already processed yesterday" checks.
|
|
136
|
-
|
|
155
|
+
19. Review outbox and inbox pairing.
|
|
137
156
|
- DB change plus message publish can split when either side succeeds alone.
|
|
138
157
|
- Route the convergence protocol for independently committed effects to `dual-write-consistency`. Keep inbox, applied-event, and duplicate-delivery handling in this skill.
|
|
139
|
-
|
|
158
|
+
20. Review saga compensation.
|
|
140
159
|
- Route compensation order and resumable saga state to `durable-workflow-orchestration`. Compensation actions such as cancel, refund, release stock, revoke entitlement, or restore credits still need idempotency keys tied to the original action here.
|
|
141
160
|
- Double compensation can be worse than the original failure.
|
|
142
|
-
|
|
161
|
+
21. Review `PROCESSING` and lease recovery.
|
|
143
162
|
- A `PROCESSING` row without lease, heartbeat, timeout, owner, or reconciliation can permanently block retries after a crash.
|
|
144
163
|
- A stale processing record should recover by verifying side effects and either completing, failing safely, or allowing one fenced owner to continue.
|
|
145
|
-
|
|
164
|
+
22. Review locks as helpers, not proof.
|
|
146
165
|
- Distributed locks can expire, split ownership, or pause through stop-the-world events.
|
|
147
166
|
- Keep durable uniqueness, conditional writes, state guards, idempotency records, or fencing tokens as the final defense.
|
|
148
|
-
|
|
149
|
-
|
|
167
|
+
23. Read [Operation Identity, Ordering, and Stale-Write Checklist](references/operation-ordering-stale-write-checklist.md) when duplicate delivery, out-of-order completion, aggregate sequencing, or stale writes intersect.
|
|
168
|
+
24. Check grep bait near the operation.
|
|
169
|
+
- Review code around `Idempotency-Key`, `request_id`, `event_id`, `message_id`, `operation_id`, `attempt_id`, `effect_id`, `aggregate_version`, `generation`, `fencing`, `dedupe`, `inbox`, `outbox`, `retry`, `timeout`, `Promise.all`, `ack`, `nack`, `visibility timeout`, `webhook`, `scheduler`, `batch`, `cron`, `PROCESSING`, `SUCCEEDED`, `FAILED`, `lock`, `singleflight`, `Redis`, `send`, `publish`, `charge`, `refund`, `grant`, `deduct`, `createShipment`, and `cache`.
|
|
150
170
|
- These terms are anchors, not automatic bugs.
|
|
151
|
-
|
|
152
|
-
- Good tests include same request twice, concurrent duplicate requests, first response lost, external success followed by DB failure, DB success followed by response failure, webhook replay,
|
|
171
|
+
25. Require duplicate, ordering, and stale-write evidence.
|
|
172
|
+
- Good tests include same request twice, concurrent duplicate requests, duplicate key with changed payload, later aggregate version before an earlier version, a missing-version gap, two attempts reading one authority, stale completion after a new generation or owner, first response lost, external success followed by DB failure, DB success followed by response failure, webhook replay, consumer commit followed by ack failure, batch rerun, and processing-stuck recovery.
|
|
153
173
|
- If deterministic proof is not configured, report static risk and missing manual or integration evidence instead of approving the path.
|
|
154
174
|
|
|
155
175
|
<!-- mustflow-section: postconditions -->
|
|
156
176
|
## Postconditions
|
|
157
177
|
|
|
158
|
-
- The logical operation, duplicate sources, side effects, durable operation key, payload binding, response replay contract, timeout recovery, processing recovery, queue or webhook dedupe, scheduler or batch dedupe, outbox or inbox boundary, and
|
|
159
|
-
- Duplicate business requests, changed-payload key reuse, concurrent `exists` then `insert`, duplicate increments, stale state overwrites, provider timeout retries, pre-record external calls, duplicate webhook delivery, queue redelivery, scheduler reruns, double compensation, stuck processing rows, weak locks, and frontend-only guards are fixed or reported.
|
|
178
|
+
- The logical operation and attempt identities, duplicate sources, ordering aggregate, authority token, gap policy, stale-result decision, side effects, durable operation key, payload binding, response replay contract, timeout recovery, processing recovery, queue or webhook dedupe, scheduler or batch dedupe, outbox or inbox boundary, and adversarial tests are explicit.
|
|
179
|
+
- Duplicate business requests, changed-payload key reuse, concurrent `exists` then `insert`, per-retry operation IDs, duplicate increments, timestamp ordering, sequence gaps, stale state overwrites, cancellation-as-rollback, single-flight-as-proof, provider timeout retries, pre-record external calls, duplicate webhook delivery, queue redelivery, scheduler reruns, double compensation, stuck processing rows, weak locks, and frontend-only guards are fixed or reported.
|
|
160
180
|
- Duplicate safety claims are backed by configured tests, schema evidence, framework evidence, provider documentation matched to current code, or labeled as static review risk.
|
|
161
181
|
|
|
162
182
|
<!-- mustflow-section: verification -->
|
|
@@ -189,7 +209,7 @@ Prefer the narrowest configured test, build, docs, release, or mustflow intent t
|
|
|
189
209
|
## Output Format
|
|
190
210
|
|
|
191
211
|
- Idempotency boundary reviewed
|
|
192
|
-
- Logical operation, duplicate sources,
|
|
212
|
+
- Logical operation and attempt identity, duplicate sources, ordering aggregate, authority token, gap policy, stale-result decision, side effects, durable dedupe, payload binding, response replay, failure caching, timeout recovery, external provider, state-transition, increment or ledger, DELETE or hidden-read side-effect, queue, webhook, scheduler or batch, outbox/inbox, compensation, processing lease, lock, and test evidence findings
|
|
193
213
|
- Idempotency fixes made or recommended
|
|
194
214
|
- Evidence level: configured-test evidence, schema evidence, provider or framework evidence, static review risk, manual-only, missing, or not applicable
|
|
195
215
|
- Command intents run
|