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,353 @@
1
+ ---
2
+ mustflow_doc: skill.interpreter-engineering-review
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: interpreter-engineering-review
9
+ description: Apply this skill when an AST interpreter, bytecode compiler or VM, evaluator, rule engine, scripting runtime, template expression engine, REPL, typed executable IR, runtime value or operator model, closure and scope resolver, nonlocal control flow, structured guest diagnostic, garbage collector or VM object lifetime, native-function boundary, deterministic execution service, semantic oracle, sandbox budget, bytecode cache, inline cache, interpreter performance path, or interpreter-semantics claim is created, changed, reviewed, debugged, or reported.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.interpreter-engineering-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
+ # Interpreter Engineering Review
29
+
30
+ <!-- mustflow-section: purpose -->
31
+ ## Purpose
32
+
33
+ Review an interpreter as an explicit language-semantics and runtime system, not as a parser plus a
34
+ recursive visitor. Prevent host-language behavior, object representation, exception handling,
35
+ environment lookup, iteration order, time, randomness, native calls, or resource exhaustion from
36
+ silently becoming the guest-language specification.
37
+
38
+ Keep syntax, semantic types, runtime kinds, storage representations, name resolution, executable
39
+ representation, operator dispatch, runtime values, control completion, frames and closures, source
40
+ provenance, structured guest diagnostics, engine defects, object reachability, host capabilities,
41
+ deterministic services, budgets, test oracles, caching, and performance evidence as separate contracts.
42
+
43
+ <!-- mustflow-section: use-when -->
44
+ ## Use When
45
+
46
+ - An AST evaluator, bytecode compiler, stack or register VM, rule engine, expression evaluator,
47
+ embedded scripting language, REPL, template expression engine, or policy runtime changes.
48
+ - Guest-language value, equality, identity, coercion, hashing, iteration, numeric, overflow,
49
+ evaluation-order, scope, closure, module, exception, or control-flow semantics are implemented.
50
+ - Name resolution, local or global slots, upvalues, environment chains, captured cells, module
51
+ bindings, frame layout, generators, coroutines, suspension, or resumption is in scope.
52
+ - Source locations, stack traces, breakpoints, stepping, coverage, profiling, hot reload, diagnostic
53
+ origin, or bytecode source maps need review.
54
+ - Native functions, host objects, reentrancy, threads, asynchronous completion, cancellation,
55
+ capabilities, sandboxing, or guest-to-host value conversion cross the runtime boundary.
56
+ - Determinism, instruction or allocation budgets, recursion limits, output limits, runtime caches,
57
+ dispatch, boxing, inline caches, superinstructions, specialization, GC pressure, or interpreter
58
+ performance claims need evidence.
59
+ - Root discovery, allocation safepoints, write barriers, moving handles, remembered sets, weak
60
+ containers, ephemerons, finalizers, reference-count reentrancy, heap verification, or GC stress is
61
+ part of an interpreter runtime change.
62
+ - Structured runtime diagnostics, taint from recovered syntax, safe value rendering, logical guest
63
+ stacks, fix-it validation, stable error codes, fingerprints, semantic properties, metamorphic
64
+ relations, reference evaluators, or canonical differential outcomes are in scope.
65
+
66
+ <!-- mustflow-section: do-not-use-when -->
67
+ ## Do Not Use When
68
+
69
+ - Only tokenization, grammar, CST or AST construction, parser recovery, incremental parsing, or
70
+ parser resource limits change; use `parser-engineering-review`.
71
+ - Only compiler optimization, IR or MIR passes, verifier, code generation, object format, ABI, or
72
+ linker behavior changes; use `compiler-engineering-review`.
73
+ - Only fuzz campaign, corpus, mutator, instrumentation, sanitizer, or CI lifecycle changes; use
74
+ `fuzz-harness-review`.
75
+ - Only general application, API, CLI, provider, queue, or validation error text changes without a
76
+ guest-language diagnostic pipeline; use `error-message-integrity-review`.
77
+ - Only generic application resource cleanup, listener, stream, task, cache, or retained-reference
78
+ lifetime changes without a VM heap or guest object model; use `memory-lifetime-review`.
79
+ - Only the host platform runtime, package runtime version, container, JVM, Python, or JavaScript
80
+ deployment environment changes without guest-language semantics; use the matching runtime skill.
81
+ - Only one application function interprets an ordinary data field with no language or execution
82
+ model; use the narrower domain skill.
83
+
84
+ <!-- mustflow-section: required-inputs -->
85
+ ## Required Inputs
86
+
87
+ - Guest-language semantic contract: value domains, numeric and overflow rules, equality and
88
+ identity, coercions, truthiness, hashing, collection and property order, missing-name behavior,
89
+ evaluation order, module and exception rules, and specified nondeterminism.
90
+ - Pipeline from source through tokens and syntax, name resolution, semantic validation, executable
91
+ AST or IR, bytecode compilation where applicable, execution, host calls, and observable results.
92
+ - Runtime `Value` representation, ownership and mutability, object identity, hashability, interning,
93
+ boxing, host conversion, GC roots, handles, and lifetime rules.
94
+ - Separation between semantic types, runtime value kinds, and storage tags; purpose-specific
95
+ conversion graph; operator evaluation and fallback algorithms; `Place` or assignment-target
96
+ model; typed executable annotations; internal sentinel taxonomy; and FFI or serialization form.
97
+ - Resolver output: binding kind, slot or cell index, declaration and initialization state,
98
+ shadowing, imports, free variables, captures, frame layout, upvalue reuse and closure lifetime.
99
+ - Completion model for normal value, return, break, continue, throw, yield, suspend, cancel, and
100
+ resource-limit termination plus handler and cleanup behavior.
101
+ - Source provenance across tokens, syntax, lowered nodes, bytecode instructions, frames, stack
102
+ traces, debugger locations, generated code, and cached artifacts.
103
+ - Guest exception, type or name failure, native failure, cancellation, policy denial, resource
104
+ exhaustion, and engine-defect classifications plus their host and guest stack policies.
105
+ - Diagnostic contract: stable code, phase, primary and related source ranges, causes, suppression,
106
+ notes, help, validated fixes, logical guest frames, safe value rendering, fingerprint, audience,
107
+ redaction, and recovered-node provenance.
108
+ - Heap contract: roots, safepoints, allocation and publication phases, open and closed upvalues,
109
+ write barriers, moving handles or pins, generations and remembered sets, weak or ephemeron
110
+ semantics, finalization, resurrection, external resources, shutdown, and verifier or stress modes.
111
+ - Native boundary: capability set, value marshalling, host handles, reentrancy, thread ownership,
112
+ async completion, cancellation, exception translation, lifetime, and accounting.
113
+ - Deterministic services for time, randomness, locale, paths, environment, iteration order, floating
114
+ point, I/O, scheduling, and externally visible host state.
115
+ - Execution budgets for instructions or nodes, calls, recursion, allocation, containers, strings,
116
+ output, regex or native work, wall time, cancellation, and cleanup reserve.
117
+ - Engine selection and performance evidence: semantic-change rate, execution frequency, startup and
118
+ cache behavior, instruction representation, dispatch counts, lookup counts, allocation and GC,
119
+ native-call cost, cache hit rates, profiles, and benchmark workload validity.
120
+ - Oracle contract: valid and invalid input lanes, semantic generator environment, canonical outcome,
121
+ independent reference or model, definedness filter, metamorphic relations, executable properties,
122
+ structure-aware reduction predicate, semantic coverage, replay capsule, and failure taxonomy.
123
+ - Configured command intents for the selected repository.
124
+
125
+ Read [Interpreter Semantics and Runtime Checklist](references/interpreter-semantics-runtime-checklist.md)
126
+ when guest values, evaluation, control flow, source provenance, failures, native calls, determinism,
127
+ or sandbox budgets are in scope.
128
+
129
+ Read [Interpreter Execution, Closures, and Performance Checklist](references/interpreter-execution-closure-performance-checklist.md)
130
+ when choosing AST execution or bytecode, compiling or caching bytecode, resolving bindings, laying
131
+ out frames, implementing upvalues or modules, debugging, profiling, or optimizing the runtime.
132
+
133
+ Read [Interpreter Diagnostics and Recovery Checklist](references/interpreter-diagnostics-recovery-checklist.md)
134
+ when structured guest diagnostics, recovered syntax provenance, safe value rendering, logical stack
135
+ traces, error codes, fingerprints, or fix-it behavior is in scope.
136
+
137
+ Read [Interpreter GC and Verification Checklist](references/interpreter-gc-verification-checklist.md)
138
+ when VM roots, safepoints, barriers, moving objects, weak containers, finalizers, external resources,
139
+ heap stress, semantic properties, differential or metamorphic oracles, or reduction is in scope.
140
+
141
+ <!-- mustflow-section: preconditions -->
142
+ ## Preconditions
143
+
144
+ - The task matches the Use When conditions and does not match the exclusions.
145
+ - The guest-language semantic authority is identified, or disputed cases are preserved as explicit
146
+ language-design decisions rather than inherited from the host implementation.
147
+ - The selected repository instructions and command contract have been checked.
148
+
149
+ <!-- mustflow-section: allowed-edits -->
150
+ ## Allowed Edits
151
+
152
+ - Update semantic definitions, resolver and binding metadata, executable AST or IR, bytecode,
153
+ runtime values, frames, closures, completion handling, source maps, structured guest diagnostics,
154
+ VM root and barrier APIs, native adapters, deterministic services, budgets, semantic oracles,
155
+ caches, debugger or profiler hooks, tests, and directly synchronized docs or templates.
156
+ - Add differential AST-versus-bytecode fixtures, meaning-preserving transformations, native-boundary
157
+ denial cases, deterministic replay, budget exhaustion, closure lifetime, debugger, cache
158
+ invalidation, and workload-based performance evidence.
159
+ - Do not make parser nodes mutate runtime environments directly, expose raw VM stacks or runtime
160
+ internals to native code, or use host behavior as an undocumented fallback for guest semantics.
161
+ - Do not optimize by weakening source provenance, guest-versus-engine fault separation, capability
162
+ checks, deterministic inputs, resource accounting, or observable evaluation order.
163
+
164
+ <!-- mustflow-section: procedure -->
165
+ ## Procedure
166
+
167
+ 1. Freeze semantics before implementation mechanics. Build an executable matrix for values,
168
+ operators, evaluation order, calls, assignment targets, collections, property access, missing
169
+ names, modules, exceptions, overflow, iteration, and host interaction. Mark unspecified behavior
170
+ deliberately; do not let host defaults decide it accidentally.
171
+ 2. Map the real execution pipeline. Separate parse output, resolver and semantic annotations,
172
+ executable representation, optional bytecode lowering, runtime execution, native adapters,
173
+ debugging and source maps, caches, and external observations. Do not execute a raw parser AST when
174
+ downstream tools need a stable normalized representation.
175
+ 3. Separate semantic type, runtime kind, and storage tag, then define one runtime value model.
176
+ Centralize payloads, mutability, value equality, object identity, numeric distinctions, hashing,
177
+ key eligibility, strings, functions, handles, sentinels, host conversion, and canonical
178
+ serialization. Compact tagging, NaN boxing, pointer tagging, and unboxing are replaceable storage
179
+ choices, not guest types or public ABI.
180
+ 4. Resolve names before hot execution where the language permits it. Annotate each reference and
181
+ assignment as local, captured, module, global, builtin, dynamic, or another explicit binding kind
182
+ with a slot, cell, or symbol identity. Keep declaration, initialization, and access states
183
+ separate.
184
+ 5. Keep lexical scope distinct from the call stack. A closure captures the environment of
185
+ definition, not the caller. Compute free variables, capture only required cells, deduplicate
186
+ captures of one binding, and preserve shared mutation semantics.
187
+ 6. Model frame and upvalue lifetime. Keep uncaptured locals in frame slots; when supported, let open
188
+ upvalues reference live slots and close them into heap cells when the frame exits. Close every
189
+ captured slot exactly once across return, throw, cancellation, generator suspension, and cleanup.
190
+ 7. Unify nonlocal completion. Represent normal, return, break, continue, throw, yield, suspend,
191
+ cancel, and budget termination through one explicit completion protocol. Lower it differently in
192
+ bytecode if needed, but keep handler search, `finally` or cleanup, and propagation semantics equal
193
+ across engines.
194
+ 8. Make conversion, operator dispatch, assignment places, and evaluation order visible. Use
195
+ purpose-specific directed conversions instead of one universal coercion. Define operator
196
+ algorithms with `Handled`, `Declined`, and `Thrown`-equivalent outcomes so fallback cannot swallow
197
+ user failures. Resolve compound assignment targets once as a `Place`, then load, operate, and
198
+ store. Carry selected conversions, operator, effects, span, and proof identity into typed or
199
+ executable IR instead of re-resolving semantics in each engine.
200
+ 9. Preserve source provenance from input to execution. Carry source snapshot identity and half-open
201
+ byte ranges through recovered or synthetic syntax, normalized nodes, typed IR, lowered
202
+ instructions, cached code, frames, guest stacks, debugger stepping, coverage, profiling, and hot
203
+ reload. Generated instructions need an explicit primary, related, synthetic, or origin-chain policy.
204
+ 10. Build diagnostics as structured data and separate fault domains. Preserve stable codes, phases,
205
+ primary and related spans, causes, suppression, help, validated fixes, logical frames, and safe
206
+ fingerprints independently from CLI, IDE, log, or test rendering. Guest throw, guest semantic
207
+ error, native failure, capability denial, cancellation, resource limit, and engine defect need
208
+ distinct representations. Diagnostic rendering must not call guest conversion, getters,
209
+ iterators, proxies, or representation hooks.
210
+ 11. Harden the native boundary. Define conversion, ownership, rooting or handle policy, capability,
211
+ reentrancy, thread affinity, asynchronous completion, cancellation, callback lifetime, error
212
+ translation, and cost accounting. Native code receives the smallest capability surface, not the
213
+ whole runtime or unrestricted host objects.
214
+ 12. Inject deterministic host services. Route time, randomness, locale, paths, environment, I/O,
215
+ map iteration, floating-point context, and scheduling through an execution context with a named
216
+ deterministic or explicitly nondeterministic policy. Record inputs needed for replay.
217
+ 13. Enforce multi-dimensional budgets. Charge instruction or node work, calls, recursion,
218
+ allocations, container growth, string output, regex or pattern work, native calls, I/O, and
219
+ diagnostics. Check before or during expensive work, preserve cleanup reserve, and distinguish
220
+ guest limit termination from host timeout or engine crash.
221
+ 14. Select AST execution or bytecode from workload and semantic maturity. Prefer AST execution for
222
+ rapidly changing semantics and low-reuse short programs. Prefer bytecode when stable semantics,
223
+ repeated execution, explicit suspension, debugger control, compact code, or predictable
224
+ accounting justify the compile and maintenance cost. Do not treat either as a religion.
225
+ 15. If both engines exist, keep one semantic test corpus and differentially execute them. Normalize
226
+ representation-only differences, compare values, mutations, completion, errors, source
227
+ locations, budgets, and host effects, and use the language contract rather than engine majority
228
+ as authority.
229
+ 16. Design bytecode as a runtime representation, not serialized AST objects. Resolve names to slots
230
+ or cells, use compact instructions and constant pools, define operand widths and verification,
231
+ keep source maps, and specify control, exception, suspension, and stack or register invariants.
232
+ 17. Version compiled artifacts. Bind caches to source content, language and semantic version,
233
+ compiler and bytecode schema, options, native API or symbol version, target/runtime assumptions,
234
+ and source-map format. Verify before loading and fall back safely on mismatch; do not execute
235
+ stale cached code because the path remained the same.
236
+ 18. Treat modules as live or copied bindings by specification. Resolve import and export cells,
237
+ initialization order, cycles, namespace identity, read-only rules, cache identity, unload or hot
238
+ reload behavior, and closure or native references that retain module state.
239
+ 19. Optimize from profiles, not folklore. Measure dispatch, binding lookup, property lookup,
240
+ allocation, GC, native crossing, source mapping, cache load, parse and resolve, and actual
241
+ workload time. Fix repeated name lookup, needless boxing and temporary allocation, poor data
242
+ locality, and chatty native boundaries before speculative JIT work.
243
+ 20. Add caches with explicit guards and invalidation. Inline caches bind operation sites to observed
244
+ value or object shapes, relevant metaobject epochs, native symbol generations, and fallback.
245
+ Compiled-code caches bind all semantic inputs. Intern only bounded domains such as identifiers or
246
+ selected constants; untrusted strings must not become immortal by default.
247
+ 21. Make object liveness and movement explicit. Expose roots and handle scopes as runtime APIs;
248
+ enumerate every allocating safepoint; construct objects as allocate, initialize, track, then
249
+ publish; and route every guest-reference store, bulk copy, resize, capture, native write, and
250
+ deserialization path through the collector's barrier. Raw addresses must not survive a moving
251
+ safepoint unless the object is correctly pinned.
252
+ 22. Define weak, finalization, reference-count, and external-resource semantics. Ephemerons may need
253
+ fixed-point marking; finalizers are adversarial callbacks that may throw or resurrect; releasing
254
+ the last reference may reenter guest code; and files, sockets, buffers, or thread-affine handles
255
+ need deterministic close independent of GC. Stage shutdown and make cleanup idempotent.
256
+ 23. Preserve control and budget semantics while optimizing. Superinstructions, specialization,
257
+ inline caches, unboxing, tail calls, or JIT tiers must not change evaluation order, guest stack
258
+ traces, completion, exception handlers, source stepping, capability checks, or work accounting.
259
+ 24. Build a semantic oracle matrix. Cover positive and negative values, numeric boundaries,
260
+ conversions, operator decline versus throw, assignment places, equality and hash laws,
261
+ structured diagnostics, shadowing, initialization,
262
+ recursion, capture and mutation, loop capture, nested completion, throw and cleanup, native
263
+ reentrancy, async resume, deterministic services, every budget dimension, cache invalidation,
264
+ AST versus bytecode differential behavior, GC schedule invariance, heap stress, and adversarial
265
+ resource shapes. Normalize outcomes before comparison, exclude unspecified semantics, prefer an
266
+ independent reference or executable law, and preserve the exact failure fingerprint during
267
+ structure-aware reduction.
268
+ 25. Apply `fuzz-harness-review` when harness determinism, coverage feedback, corpus, mutator,
269
+ sanitizer, minimization, or campaign lifecycle is in scope. Keep this skill as owner of guest
270
+ semantics, runtime invariants, and oracle design.
271
+
272
+ <!-- mustflow-section: postconditions -->
273
+ ## Postconditions
274
+
275
+ - Guest semantics, semantic types, runtime kinds, storage tags, conversions, operator dispatch,
276
+ assignment places, unspecified behavior, evaluation order, value model, binding model, completion,
277
+ source provenance, structured diagnostics, and fault classes are explicit.
278
+ - AST, resolver, executable representation, bytecode, runtime, native, cache, debugger, and host
279
+ service boundaries are separated or their current coupling is reported.
280
+ - Closures capture the declared lexical bindings with observable lifetime and shared-mutation
281
+ evidence; module and debugger retention is bounded or reported.
282
+ - Determinism and each resource budget have named injected inputs, charge points, terminal behavior,
283
+ and replay or test evidence.
284
+ - Root, safepoint, barrier, weak-container, finalization, external-resource, heap-verifier, and
285
+ semantic-oracle rules are explicit or their missing evidence is reported.
286
+ - Performance changes preserve semantics, security, source mapping, completion, and accounting and
287
+ are tied to profiles that include the real workload and native boundary.
288
+
289
+ <!-- mustflow-section: verification -->
290
+ ## Verification
291
+
292
+ Use configured oneshot command intents when available:
293
+
294
+ - `changes_status`
295
+ - `changes_diff_summary`
296
+ - `lint`
297
+ - `build`
298
+ - `test_related`
299
+ - `test`
300
+ - `test_audit`
301
+ - `docs_validate_fast`
302
+ - `test_release`
303
+ - `mustflow_check`
304
+
305
+ Prefer narrow configured semantic, resolver, bytecode-verifier, AST-versus-bytecode differential,
306
+ closure, native-boundary, deterministic replay, budget, cache, debugger, memory, and benchmark
307
+ intents when exposed by the selected repository. Do not invent raw runtime or long-running commands.
308
+
309
+ <!-- mustflow-section: failure-handling -->
310
+ ## Failure Handling
311
+
312
+ - If a semantic rule is unspecified, preserve it as an explicit design decision and avoid baking in
313
+ the current host behavior until authority is chosen.
314
+ - If AST and bytecode engines disagree, inspect normalized representation and the first semantic
315
+ divergence; do not select the majority or faster engine as correct.
316
+ - If guest and engine failures are conflated, restore fault classification before improving messages
317
+ or adding recovery.
318
+ - If diagnostic rendering can execute guest code, replace it with a bounded non-reentrant renderer
319
+ before trusting runtime error evidence.
320
+ - If a collector path lacks a root, handle, barrier, or weak-container invariant, stop at the first
321
+ missing liveness rule instead of tuning GC thresholds or adding finalizers.
322
+ - If a differential failure uses unspecified behavior or a reducer changes its failure identity,
323
+ reject that oracle result and repair the generator, normalization, or predicate.
324
+ - If native ownership, reentrancy, thread, cancellation, capability, or accounting is unknown, deny
325
+ or isolate the call path rather than exposing the full runtime.
326
+ - If a budget can be checked only after expensive work completes, report the sandbox gap and move
327
+ the charge or preflight boundary before claiming containment.
328
+ - If a performance change lacks a representative profile, preserve the simpler correct design and
329
+ report the unproven optimization opportunity.
330
+ - If interpreter execution is unconfigured or long-running, stop at code review, bounded fixtures,
331
+ and a manual evidence plan.
332
+
333
+ <!-- mustflow-section: output-format -->
334
+ ## Output Format
335
+
336
+ - Guest semantics, semantic/runtime/storage separation, conversion and operator protocol, assignment
337
+ places, sentinels, value model, and evaluation order
338
+ - Pipeline, resolver, binding, frame, closure, module, and completion decisions
339
+ - AST versus bytecode choice, differential evidence, bytecode invariants, and cache versioning
340
+ - Source mapping, guest stack, debugger, coverage, profiling, and hot-reload evidence
341
+ - Guest, native, cancellation, resource-limit, and engine fault classification
342
+ - Structured diagnostic, recovery provenance, safe rendering, logical stack, code, fingerprint, and
343
+ fix-it evidence
344
+ - Native capability, conversion, lifetime, reentrancy, thread, async, cancellation, and accounting
345
+ - Deterministic services and multi-dimensional budgets
346
+ - Lookup, dispatch, allocation, GC, cache, native-boundary, and workload profile evidence
347
+ - Root, safepoint, barrier, moving handle, weak or ephemeron, finalizer, external-resource, heap
348
+ stress, canonical outcome, property, metamorphic, differential, and reduction evidence
349
+ - Files changed
350
+ - Configured command intents run
351
+ - Missing or skipped runtime, differential, budget, fuzz, and performance evidence
352
+ - Remaining semantic, diagnostic, closure, native-boundary, sandbox, determinism, GC, oracle,
353
+ memory, or performance risk
@@ -0,0 +1,267 @@
1
+ # Interpreter Diagnostics and Recovery Checklist
2
+
3
+ Use this checklist when an interpreter owns guest-language diagnostics, recovered syntax reaches
4
+ semantic phases, runtime failures need source and logical-stack evidence, or automated fixes are
5
+ part of the public tooling contract.
6
+
7
+ ## Contents
8
+
9
+ 1. [Structured diagnostic envelope](#structured-diagnostic-envelope)
10
+ 2. [Source snapshot and range contract](#source-snapshot-and-range-contract)
11
+ 3. [Recovered-input provenance](#recovered-input-provenance)
12
+ 4. [Cause graph and suppression](#cause-graph-and-suppression)
13
+ 5. [Safe runtime value rendering](#safe-runtime-value-rendering)
14
+ 6. [Logical guest stacks](#logical-guest-stacks)
15
+ 7. [Dynamic dispatch evidence](#dynamic-dispatch-evidence)
16
+ 8. [Stable codes and fingerprints](#stable-codes-and-fingerprints)
17
+ 9. [Fix validation](#fix-validation)
18
+ 10. [Renderer and audience separation](#renderer-and-audience-separation)
19
+ 11. [Diagnostic contract tests](#diagnostic-contract-tests)
20
+ 12. [Failure matrix](#failure-matrix)
21
+ 13. [Invariants](#invariants)
22
+ 14. [Skill handoffs](#skill-handoffs)
23
+
24
+ ## Structured diagnostic envelope
25
+
26
+ Keep detection separate from presentation. The authoritative diagnostic should carry structured
27
+ fields such as:
28
+
29
+ - stable error code and guest-language phase;
30
+ - severity and terminal versus recoverable classification;
31
+ - primary source snapshot and half-open byte range;
32
+ - related ranges with roles or labels;
33
+ - cause, dependency, and suppression links;
34
+ - bounded notes and recovery-oriented help;
35
+ - zero or more validated edits with confidence or applicability;
36
+ - captured logical guest frames;
37
+ - safe runtime facts and dispatch evidence;
38
+ - resource-limit or cancellation facts where relevant;
39
+ - stable internal fingerprint inputs;
40
+ - public, IDE, support, operator, and maintainer disclosure policy.
41
+
42
+ CLI text, IDE protocol objects, JSON, logs, snapshots, and telemetry are consumers of this envelope.
43
+ Do not let ANSI styling, indentation, translated prose, or renderer-specific line wrapping become
44
+ the source of truth.
45
+
46
+ ## Source snapshot and range contract
47
+
48
+ Bind each range to an immutable source snapshot. Store source coordinates internally as half-open
49
+ byte ranges and compute line, display column, UTF-16 position, tab expansion, and excerpts only for
50
+ the selected renderer.
51
+
52
+ Preserve origin through:
53
+
54
+ - recovered and synthetic tokens;
55
+ - normalized or desugared syntax;
56
+ - typed or executable IR;
57
+ - bytecode instructions and handler tables;
58
+ - cached compiled artifacts;
59
+ - active and suspended frames;
60
+ - native-to-guest callbacks;
61
+ - generated code and hot-reload generations.
62
+
63
+ Choose one primary range that remains useful when an IDE shows no secondary context. Use related
64
+ ranges for declarations, conflicting values, conversion sites, operator candidates, or generated
65
+ origins. Do not attach a current line and column to stale source bytes after an edit.
66
+
67
+ ## Recovered-input provenance
68
+
69
+ Parser recovery belongs to `parser-engineering-review`, but interpreter diagnostics must preserve
70
+ its downstream provenance. A synthetic token, repaired node, poison type, unknown binding, or
71
+ suppressed executable node should identify the diagnostic that introduced it.
72
+
73
+ For every recovered value or node, define:
74
+
75
+ - original source snapshot and damaged range;
76
+ - recovery action and bounded cost;
77
+ - synthetic or replaced token identities;
78
+ - originating diagnostic ID;
79
+ - phases permitted to continue;
80
+ - semantic facts that remain trustworthy;
81
+ - downstream diagnostics to suppress, attach as notes, or emit independently;
82
+ - point where execution must be refused.
83
+
84
+ Do not turn every recovered subtree into one undifferentiated error node. Do not execute a program
85
+ whose semantic authority depends on guessed syntax unless the language explicitly defines a safe
86
+ partial-execution mode.
87
+
88
+ ## Cause graph and suppression
89
+
90
+ Model diagnostic candidates as a graph rather than an unordered list. Record at least:
91
+
92
+ - `causedBy`: this failure follows from a root failure;
93
+ - `dependsOn`: this check could not complete without another fact;
94
+ - `suppressedBy`: a stronger or earlier diagnostic makes this one noise;
95
+ - `relatedTo`: independent evidence helps explain the same defect.
96
+
97
+ Prefer independent root failures in default output. Preserve derived failures for IDE expansion,
98
+ debug evidence, or a note explaining why a check stopped. A missing binding that causes an unknown
99
+ type, unresolved operator, and return mismatch should not appear as four unrelated user mistakes.
100
+
101
+ Suppression must not hide an engine invariant, capability denial, security boundary, resource
102
+ limit, or a second independent root failure.
103
+
104
+ ## Safe runtime value rendering
105
+
106
+ Diagnostic generation must not execute guest behavior. The safe renderer must not call guest
107
+ string conversion, representation hooks, getters, iterators, proxy traps, equality, hashing,
108
+ destructors, finalizers, or arbitrary native callbacks.
109
+
110
+ Allow only bounded facts such as:
111
+
112
+ - semantic type and runtime kind;
113
+ - stable non-address object identity where permitted;
114
+ - primitive payloads after redaction;
115
+ - collection length without iteration when stored directly;
116
+ - selected immutable field names or summaries;
117
+ - explicit truncation, depth, byte, element, and time limits;
118
+ - cycle detection and already-rendering guard;
119
+ - safe placeholder when an object is partially initialized or corrupted.
120
+
121
+ If safe rendering itself fails, preserve the original diagnostic and attach a maintainer-only
122
+ renderer failure. Never replace the original guest failure with a second formatting exception.
123
+
124
+ ## Logical guest stacks
125
+
126
+ Capture stack evidence before destructive unwind. A logical frame may need:
127
+
128
+ - function display name and stable function identity;
129
+ - call-site range and definition range;
130
+ - module identity and semantic generation;
131
+ - executable code or bytecode identity;
132
+ - async, coroutine, generator, or scheduler parent;
133
+ - native boundary marker without unsafe host details;
134
+ - tail-call or inlined logical ancestry when promised;
135
+ - source-map generation and hot-reload compatibility.
136
+
137
+ Separate guest frames from host frames. Guest failures expose the language stack. Engine defects
138
+ retain host evidence for maintainers. Native adapters attach a bounded boundary cause without
139
+ leaking secrets, raw addresses, credentials, or unrelated host state.
140
+
141
+ ## Dynamic dispatch evidence
142
+
143
+ For an operator, conversion, property, or call dispatch failure, preserve the semantic candidate
144
+ trace without exposing implementation-only cache layout.
145
+
146
+ Record:
147
+
148
+ - operation and operand semantic types;
149
+ - directed conversions attempted;
150
+ - left, right, reflected, subtype-priority, or protocol candidates in specified order;
151
+ - candidate outcome: handled, declined, rejected by constraint, or thrown;
152
+ - selected candidate and proof identity on success;
153
+ - source range for a user implementation that threw;
154
+ - relevant metaobject generation when stale-cache diagnosis is needed.
155
+
156
+ `Declined` is a protocol result, not an exception. A user implementation that throws must remain a
157
+ guest failure and must not silently trigger a fallback candidate.
158
+
159
+ ## Stable codes and fingerprints
160
+
161
+ Use stable codes for public semantic categories. Keep translated prose, source path, line number,
162
+ object address, randomized hash, and renderer layout out of the code.
163
+
164
+ Use a separate internal fingerprint to group equivalent failures across source movement and message
165
+ changes. Candidate fingerprint inputs include:
166
+
167
+ - stable code and phase;
168
+ - executable node or opcode kind;
169
+ - operator or conversion identity;
170
+ - normalized semantic type tuple;
171
+ - root cause category;
172
+ - stable logical-frame prefix;
173
+ - invariant or property ID;
174
+ - budget kind or native capability where relevant.
175
+
176
+ Do not use a fingerprint as public identity or infer semantic equivalence solely from a matching
177
+ stack hash.
178
+
179
+ ## Fix validation
180
+
181
+ Treat an automated edit as executable behavior. Before advertising a fix as machine-applicable:
182
+
183
+ 1. bind edits to the exact source snapshot;
184
+ 2. reject overlapping or out-of-range edits;
185
+ 3. apply them transactionally in memory;
186
+ 4. re-run the required lexical, parse, resolve, semantic, and policy phases;
187
+ 5. prove the target diagnostic is removed or transformed as intended;
188
+ 6. reject fixes that introduce a stronger root failure;
189
+ 7. preserve observable semantics for warning-only fixes unless the contract says otherwise;
190
+ 8. downgrade low-confidence candidates to explanatory help.
191
+
192
+ A renderer showing plausible replacement text is not fix validation.
193
+
194
+ ## Renderer and audience separation
195
+
196
+ Define independent consumers for:
197
+
198
+ - concise interactive CLI output;
199
+ - rich terminal output with excerpts;
200
+ - IDE or editor structured output;
201
+ - deterministic test representation;
202
+ - support or operator correlation fields;
203
+ - maintainer-only engine evidence.
204
+
205
+ Each consumer needs its own redaction, truncation, locale, path, source-excerpt, and stack policy.
206
+ Keep stable machine fields available even when prose is shortened. Do not expose host paths, raw
207
+ source, secret-bearing values, native payloads, or engine stacks merely because the diagnostic is
208
+ structured.
209
+
210
+ ## Diagnostic contract tests
211
+
212
+ Test structure and rendering separately.
213
+
214
+ Structural assertions should cover:
215
+
216
+ - stable code, phase, severity, and terminal class;
217
+ - primary snapshot and exact half-open byte range;
218
+ - roles and ranges of related labels;
219
+ - root and derived cause relationships;
220
+ - absence of unexpected extra root failures;
221
+ - fix ranges, snapshot binding, and post-fix reanalysis;
222
+ - safe rendering under cycles, deep values, partial objects, and hostile hooks;
223
+ - logical frames across native callbacks, suspension, tail behavior, and unwind;
224
+ - public versus internal redaction;
225
+ - stable fingerprints across path, line, locale, and prose changes.
226
+
227
+ Rendered snapshots can still protect layout, but they should not be the only oracle. Include
228
+ multibyte text, tabs, CRLF, invalid bytes, truncated input, generated origins, stale snapshots, and
229
+ budget-limited diagnostic production.
230
+
231
+ ## Failure matrix
232
+
233
+ | Failure | Required behavior |
234
+ | --- | --- |
235
+ | Recovered token causes later type noise. | Preserve recovery origin and suppress only derived diagnostics. |
236
+ | Diagnostic value has a hostile representation hook. | Safe renderer never invokes it. |
237
+ | Error occurs during stack unwind. | Original logical frames were captured before destruction. |
238
+ | Operator candidate declines. | Continue only through the specified fallback order. |
239
+ | Operator implementation throws. | Preserve that guest failure; do not reinterpret it as decline. |
240
+ | Source changed after analysis. | Snapshot mismatch prevents misleading ranges or fixes. |
241
+ | Fix removes one error but adds a stronger root error. | Reject or downgrade the fix. |
242
+ | Renderer exceeds its budget. | Emit a bounded truncation while preserving stable machine fields. |
243
+ | Engine invariant fails while formatting a guest error. | Keep the engine defect separate from the guest diagnostic. |
244
+
245
+ ## Invariants
246
+
247
+ - Diagnostics are structured facts before they are prose.
248
+ - Every range is bound to one immutable source snapshot.
249
+ - Recovered syntax retains its originating diagnostic and trust boundary.
250
+ - Cause and suppression edges never erase independent root failures.
251
+ - Diagnostic rendering cannot execute guest code.
252
+ - Logical guest stacks are captured before unwind and remain separate from host stacks.
253
+ - Decline and throw are distinct dynamic-dispatch outcomes.
254
+ - Public codes and internal fingerprints serve different contracts.
255
+ - Machine-applicable fixes are reanalyzed against the exact edited snapshot.
256
+
257
+ ## Skill handoffs
258
+
259
+ - Use `interpreter-engineering-review` for guest diagnostic structure, runtime values, dispatch
260
+ traces, logical guest stacks, execution refusal, and engine fault separation.
261
+ - Use `parser-engineering-review` for token repair, recovery search, parser progress, and syntax-tree
262
+ construction.
263
+ - Use `error-message-integrity-review` for broader audience, actionability, stable code, redaction,
264
+ support, logging, API, and CLI message concerns outside the guest runtime.
265
+ - Use `compiler-engineering-review` when diagnostics originate in compiler IR, optimization,
266
+ code-generation, ABI, assembler, or linker stages.
267
+ - Use `security-privacy-review` for sensitive source, guest values, paths, stack, or tenant data.