mustflow 2.116.1 → 2.116.3
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,391 @@
|
|
|
1
|
+
# Interpreter Semantics and Runtime Checklist
|
|
2
|
+
|
|
3
|
+
Use this checklist when guest-language values, evaluation order, completion, source provenance,
|
|
4
|
+
guest failures, native calls, determinism, or sandbox budgets are in scope.
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
1. [Semantic matrix](#semantic-matrix)
|
|
9
|
+
2. [Executable representation](#executable-representation)
|
|
10
|
+
3. [Runtime value model](#runtime-value-model)
|
|
11
|
+
4. [Conversion and operator dispatch](#conversion-and-operator-dispatch)
|
|
12
|
+
5. [Equality, hashing, and ordering](#equality-hashing-and-ordering)
|
|
13
|
+
6. [Evaluation order](#evaluation-order)
|
|
14
|
+
7. [Completion and cleanup](#completion-and-cleanup)
|
|
15
|
+
8. [Source provenance](#source-provenance)
|
|
16
|
+
9. [Fault domains](#fault-domains)
|
|
17
|
+
10. [Native boundary](#native-boundary)
|
|
18
|
+
11. [Deterministic services](#deterministic-services)
|
|
19
|
+
12. [Resource budgets](#resource-budgets)
|
|
20
|
+
13. [Semantic differential tests](#semantic-differential-tests)
|
|
21
|
+
14. [Failure matrix](#failure-matrix)
|
|
22
|
+
15. [Invariants](#invariants)
|
|
23
|
+
16. [Skill handoffs](#skill-handoffs)
|
|
24
|
+
|
|
25
|
+
## Semantic matrix
|
|
26
|
+
|
|
27
|
+
Define these before implementation details choose them accidentally:
|
|
28
|
+
|
|
29
|
+
- evaluation order for operands, arguments, receivers, keys, values, literals, defaults, and
|
|
30
|
+
destructuring;
|
|
31
|
+
- truthiness and short-circuit result values;
|
|
32
|
+
- numeric domains, precision, division, remainder, overflow, shift, conversion, and negative zero;
|
|
33
|
+
- value equality, object identity, ordering, and comparison failure;
|
|
34
|
+
- implicit and explicit coercions;
|
|
35
|
+
- missing name, missing property, missing key, null-like value, and uninitialized binding behavior;
|
|
36
|
+
- string encoding, indexing, slicing, normalization, and comparison;
|
|
37
|
+
- collection mutation, iteration order, concurrent modification, and key eligibility;
|
|
38
|
+
- function arity, defaults, variadics, receiver binding, and tail behavior;
|
|
39
|
+
- assignment target evaluation and compound assignment;
|
|
40
|
+
- module initialization, import binding, cycle, and cache behavior;
|
|
41
|
+
- exception, cleanup, cancellation, and resource-limit semantics;
|
|
42
|
+
- time, randomness, locale, path, environment, floating-point, and I/O visibility;
|
|
43
|
+
- specified nondeterminism and what evidence permits replay.
|
|
44
|
+
|
|
45
|
+
For each rule, keep representative positive, boundary, failure, side-effect-order, and host-
|
|
46
|
+
difference examples. A host implementation matching one example does not make its broader behavior
|
|
47
|
+
the guest specification.
|
|
48
|
+
|
|
49
|
+
## Executable representation
|
|
50
|
+
|
|
51
|
+
Separate:
|
|
52
|
+
|
|
53
|
+
1. lossless or source-shaped syntax;
|
|
54
|
+
2. resolved and semantically annotated nodes;
|
|
55
|
+
3. normalized executable AST or IR;
|
|
56
|
+
4. optional bytecode and constant pools;
|
|
57
|
+
5. runtime frames and values;
|
|
58
|
+
6. host adapters and observations.
|
|
59
|
+
|
|
60
|
+
The executable representation should carry:
|
|
61
|
+
|
|
62
|
+
- normalized operation kind;
|
|
63
|
+
- resolved binding identity;
|
|
64
|
+
- source and related-origin identity;
|
|
65
|
+
- constant and literal semantics;
|
|
66
|
+
- evaluation-order edges;
|
|
67
|
+
- control and cleanup targets;
|
|
68
|
+
- type or dynamic-operation metadata where applicable;
|
|
69
|
+
- capability and budget category for host operations;
|
|
70
|
+
- debugger and coverage mapping.
|
|
71
|
+
|
|
72
|
+
Do not make raw parser nodes execute themselves while also owning name resolution, mutation,
|
|
73
|
+
diagnostics, and host effects. That coupling makes syntax changes alter runtime semantics and blocks
|
|
74
|
+
independent analysis or bytecode lowering.
|
|
75
|
+
|
|
76
|
+
## Runtime value model
|
|
77
|
+
|
|
78
|
+
Centralize the guest runtime's value contract.
|
|
79
|
+
|
|
80
|
+
Keep three axes distinct:
|
|
81
|
+
|
|
82
|
+
- **semantic type**: what the guest program and type system observe;
|
|
83
|
+
- **runtime kind**: which evaluator or VM behavior applies now;
|
|
84
|
+
- **storage tag**: how this value is encoded in a slot, word, heap object, handle, or cache.
|
|
85
|
+
|
|
86
|
+
One semantic integer may use an immediate small-integer kind or a heap big-integer kind. One guest
|
|
87
|
+
string type may use interned, flat, rope, or slice storage. Changing storage must not silently change
|
|
88
|
+
type checking, operator selection, FFI, equality, or serialization.
|
|
89
|
+
|
|
90
|
+
| Concern | Decision |
|
|
91
|
+
| --- | --- |
|
|
92
|
+
| Type tag | Which values are distinct guest types? |
|
|
93
|
+
| Payload | Primitive bits, heap identity, handle, cell, or another representation. |
|
|
94
|
+
| Mutability | Is the value immutable, mutable, or a reference to mutable state? |
|
|
95
|
+
| Equality | Value equality, identity equality, both, or neither. |
|
|
96
|
+
| Hashability | Which stable equality relation backs keys? |
|
|
97
|
+
| Numeric relation | Are integer and floating forms equal, ordered, or distinct as keys? |
|
|
98
|
+
| String relation | Value, object, interned symbol, rope, slice, or several explicit kinds. |
|
|
99
|
+
| Callable relation | Function identity, closure environment, native handle, bound receiver. |
|
|
100
|
+
| Sentinel | Uninitialized, missing, deleted, suspended, or internal-only states. |
|
|
101
|
+
| Host conversion | Copy, validated conversion, opaque handle, proxy, or denial. |
|
|
102
|
+
|
|
103
|
+
Do not use the guest null-like value for uninitialized or missing internal states. Do not leak raw
|
|
104
|
+
host objects whose equality, mutation, prototype, thread, lifetime, or serialization differs from
|
|
105
|
+
the guest contract.
|
|
106
|
+
|
|
107
|
+
Keep `Null`, `Missing`, `Uninitialized`, `Unit`, dispatch decline, deleted-slot tombstone, suspended
|
|
108
|
+
state, and engine poison distinct. Internal sentinels must be unforgeable by guest code and excluded
|
|
109
|
+
from guest printing, equality, hashing, and canonical serialization unless explicitly specified.
|
|
110
|
+
|
|
111
|
+
If compact tagging, NaN boxing, pointer tagging, small-integer immediates, or unboxed slots are used,
|
|
112
|
+
test every tag boundary, pointer width, alignment, address rule, floating-point payload, moving-GC
|
|
113
|
+
interaction, sanitizer mode, host conversion, serialization, debugger display, and portable fallback.
|
|
114
|
+
|
|
115
|
+
## Conversion and operator dispatch
|
|
116
|
+
|
|
117
|
+
Model conversion as a directed, context-sensitive graph. Give every edge a purpose, source and
|
|
118
|
+
target type, loss policy, guest-code-call policy, failure class, and budget cost. Separate Boolean,
|
|
119
|
+
primitive, numeric, index, exact-integer, lossy-float, interpolation, key, and FFI conversions when
|
|
120
|
+
their rules differ. A universal symmetric `coerce(left, right)` hides ordering and failure semantics.
|
|
121
|
+
|
|
122
|
+
Define every operator as an observable algorithm:
|
|
123
|
+
|
|
124
|
+
1. evaluate operands in the specified order;
|
|
125
|
+
2. perform the specified directed conversions;
|
|
126
|
+
3. enumerate user or protocol candidates in the specified order;
|
|
127
|
+
4. distinguish `Handled(value)`, `Declined`, and `Thrown(error)`-equivalent outcomes;
|
|
128
|
+
5. apply reflected, subtype-priority, or default fallback only after decline;
|
|
129
|
+
6. preserve the first real guest failure;
|
|
130
|
+
7. return through the declared completion protocol.
|
|
131
|
+
|
|
132
|
+
Represent an assignable location as a `Place` or equivalent resolved target. Compound assignment
|
|
133
|
+
must evaluate receiver, computed key, proxy, or index exactly once, then load, operate, and store.
|
|
134
|
+
Short-circuiting and conditional expressions lower to control flow, not eager ordinary calls.
|
|
135
|
+
|
|
136
|
+
When semantic analysis selects conversions or operator candidates, carry the result into typed or
|
|
137
|
+
executable IR with inferred type, inserted conversions, selected operation, effects, span, and a
|
|
138
|
+
stable proof or decision identity. Do not make the AST evaluator and bytecode compiler independently
|
|
139
|
+
repeat overload resolution.
|
|
140
|
+
|
|
141
|
+
## Equality, hashing, and ordering
|
|
142
|
+
|
|
143
|
+
Require consistency:
|
|
144
|
+
|
|
145
|
+
- equal keys produce the same stable hash under one runtime seed policy;
|
|
146
|
+
- object identity does not change when storage moves or GC compacts;
|
|
147
|
+
- mutable objects are either unhashable or their key relation cannot change while indexed;
|
|
148
|
+
- numeric equality and hash agree across permitted numeric representations;
|
|
149
|
+
- comparison failure is not silently coerced to an order;
|
|
150
|
+
- map or object iteration order is specified, injected, or explicitly unspecified;
|
|
151
|
+
- randomized hash state is part of the replay capsule when observable;
|
|
152
|
+
- native handles do not inherit host pointer or object equality by accident.
|
|
153
|
+
|
|
154
|
+
Test self-comparison, distinct equal values, aliased objects, NaNs or unordered values, signed zero,
|
|
155
|
+
numeric-width boundaries, mutable keys, interned and non-interned strings, and cross-engine results.
|
|
156
|
+
Freeze integer overflow, integer-to-float precision loss, division and remainder signs, shift bounds,
|
|
157
|
+
infinity, signed zero, NaN, and mixed numeric key normalization in executable tables before using
|
|
158
|
+
host arithmetic.
|
|
159
|
+
|
|
160
|
+
## Evaluation order
|
|
161
|
+
|
|
162
|
+
Write the order explicitly for:
|
|
163
|
+
|
|
164
|
+
- binary and unary operators;
|
|
165
|
+
- call target, receiver, and each argument;
|
|
166
|
+
- computed property receiver, key, and assigned value;
|
|
167
|
+
- compound assignment read, operation, and write;
|
|
168
|
+
- array, tuple, map, object, record, and set members;
|
|
169
|
+
- spread, splat, default, destructuring, and pattern guards;
|
|
170
|
+
- conditional and short-circuit expressions;
|
|
171
|
+
- interpolated strings and comprehensions;
|
|
172
|
+
- iterator acquisition, next, body, and cleanup;
|
|
173
|
+
- exception handler filters, cleanup, and rethrow;
|
|
174
|
+
- native callbacks and async continuation delivery.
|
|
175
|
+
|
|
176
|
+
Use side-effect traces with stable event identities. Test both success and failure at every position.
|
|
177
|
+
Changing a helper call, host collection literal, or evaluation abstraction must not reorder guest
|
|
178
|
+
effects.
|
|
179
|
+
|
|
180
|
+
## Completion and cleanup
|
|
181
|
+
|
|
182
|
+
Use one semantic completion algebra or equivalent protocol:
|
|
183
|
+
|
|
184
|
+
- normal value;
|
|
185
|
+
- return value;
|
|
186
|
+
- break with optional target or value;
|
|
187
|
+
- continue with target;
|
|
188
|
+
- guest throw;
|
|
189
|
+
- yield or suspend with resumable state;
|
|
190
|
+
- cancellation;
|
|
191
|
+
- resource-limit termination;
|
|
192
|
+
- engine defect outside guest completion.
|
|
193
|
+
|
|
194
|
+
For every completion kind, define:
|
|
195
|
+
|
|
196
|
+
- which constructs catch or transform it;
|
|
197
|
+
- which cleanup scopes run and in what order;
|
|
198
|
+
- whether a cleanup completion replaces the incoming completion;
|
|
199
|
+
- how nested loops and labeled targets resolve;
|
|
200
|
+
- how generators or coroutines store and resume it;
|
|
201
|
+
- how guest stack and source location are preserved;
|
|
202
|
+
- whether native code may observe or produce it;
|
|
203
|
+
- whether budget and cancellation remain active during cleanup.
|
|
204
|
+
|
|
205
|
+
Do not represent return with a host exception, break with a Boolean, throw with a different ad hoc
|
|
206
|
+
path, and cancellation with an unchecked flag. Performance lowering may differ while semantics stay
|
|
207
|
+
unified.
|
|
208
|
+
|
|
209
|
+
## Source provenance
|
|
210
|
+
|
|
211
|
+
Carry source identity through:
|
|
212
|
+
|
|
213
|
+
- token and syntax range;
|
|
214
|
+
- normalized or desugared node;
|
|
215
|
+
- resolver and semantic diagnostic;
|
|
216
|
+
- executable AST or IR;
|
|
217
|
+
- bytecode instruction and operand;
|
|
218
|
+
- frame and instruction pointer;
|
|
219
|
+
- guest stack trace;
|
|
220
|
+
- debugger breakpoint and stepping;
|
|
221
|
+
- coverage and profiler sample;
|
|
222
|
+
- cached compiled artifact;
|
|
223
|
+
- hot-reload generation.
|
|
224
|
+
|
|
225
|
+
Use stable file identity and declared half-open source ranges. For generated or desugared operations,
|
|
226
|
+
record primary, related, or synthetic origin rather than inventing a misleading token location.
|
|
227
|
+
|
|
228
|
+
Test multi-byte text, tabs, line endings, macros or generated forms where supported, repeated source
|
|
229
|
+
lines, cached code, nested calls, native-to-guest callbacks, suspended frames, and hot reload.
|
|
230
|
+
|
|
231
|
+
Source metadata compression may use shared tables or ranges, but it must preserve the debugger and
|
|
232
|
+
diagnostic contract actually promised.
|
|
233
|
+
|
|
234
|
+
## Fault domains
|
|
235
|
+
|
|
236
|
+
Classify at least:
|
|
237
|
+
|
|
238
|
+
| Domain | Payload and stack |
|
|
239
|
+
| --- | --- |
|
|
240
|
+
| Guest throw | Guest value, guest frames, guest source. |
|
|
241
|
+
| Guest type, name, or operation failure | Stable guest error identity and source. |
|
|
242
|
+
| Native-declared guest failure | Validated guest error plus native boundary note where safe. |
|
|
243
|
+
| Native infrastructure failure | Bounded host cause, translated policy, no raw secret leakage. |
|
|
244
|
+
| Capability denial | Capability, action, and bounded guest source. |
|
|
245
|
+
| Cancellation | Owner, reason, and resumability or terminal rule. |
|
|
246
|
+
| Resource limit | Budget kind, observed or charged amount, limit, and guest source. |
|
|
247
|
+
| Engine defect | Host stack and invariant evidence; never disguised as guest code. |
|
|
248
|
+
|
|
249
|
+
Do not catch every host exception and turn it into a guest throw. Catch only the declared native or
|
|
250
|
+
guest boundary. Preserve engine defects for maintainers while redacting sensitive host state from
|
|
251
|
+
user-facing surfaces.
|
|
252
|
+
|
|
253
|
+
## Native boundary
|
|
254
|
+
|
|
255
|
+
Define one adapter contract for every native function or host object:
|
|
256
|
+
|
|
257
|
+
- exported name and capability;
|
|
258
|
+
- guest argument and return schema;
|
|
259
|
+
- conversion, copy, handle, or proxy semantics;
|
|
260
|
+
- object ownership and GC rooting;
|
|
261
|
+
- thread and event-loop ownership;
|
|
262
|
+
- reentrancy and nested guest calls;
|
|
263
|
+
- synchronous versus asynchronous completion;
|
|
264
|
+
- cancellation and deadline propagation;
|
|
265
|
+
- guest and host exception translation;
|
|
266
|
+
- instruction, allocation, I/O, or weighted cost;
|
|
267
|
+
- lifetime of callbacks and retained guest values;
|
|
268
|
+
- authorization and tenant scope;
|
|
269
|
+
- deterministic replay or explicit nondeterminism;
|
|
270
|
+
- logging and secret-redaction boundary.
|
|
271
|
+
|
|
272
|
+
Do not hand native code the full VM, raw environment, raw stack, unrestricted filesystem, network,
|
|
273
|
+
process, clock, randomness, or credential objects merely for convenience.
|
|
274
|
+
|
|
275
|
+
For asynchronous natives, bind completion to an execution generation. Late completion after
|
|
276
|
+
cancellation, reset, or hot reload must be rejected or routed through an explicit stale-result
|
|
277
|
+
policy.
|
|
278
|
+
|
|
279
|
+
## Deterministic services
|
|
280
|
+
|
|
281
|
+
Route observable host inputs through an execution context:
|
|
282
|
+
|
|
283
|
+
- clock and timezone;
|
|
284
|
+
- random generator and seed;
|
|
285
|
+
- locale and collation;
|
|
286
|
+
- path root and separator policy;
|
|
287
|
+
- environment variables;
|
|
288
|
+
- filesystem and network adapters;
|
|
289
|
+
- map or hash iteration policy;
|
|
290
|
+
- floating-point environment;
|
|
291
|
+
- scheduler and async completion order;
|
|
292
|
+
- native function versions and results where replayed.
|
|
293
|
+
|
|
294
|
+
Choose deterministic, recorded, injected-nondeterministic, or forbidden policy for each service.
|
|
295
|
+
The policy must say what enters cache keys, replay capsules, tests, and user-visible diagnostics.
|
|
296
|
+
|
|
297
|
+
Do not use one global mutable fake clock or random source across concurrent sessions without
|
|
298
|
+
session-scoped ownership.
|
|
299
|
+
|
|
300
|
+
## Resource budgets
|
|
301
|
+
|
|
302
|
+
Track independent dimensions:
|
|
303
|
+
|
|
304
|
+
- evaluated nodes or bytecode instructions;
|
|
305
|
+
- function calls and recursion depth;
|
|
306
|
+
- frames and suspended computations;
|
|
307
|
+
- allocations and live heap;
|
|
308
|
+
- object, collection, and string size;
|
|
309
|
+
- output and diagnostic volume;
|
|
310
|
+
- regex, pattern, sort, hash, or other weighted operations;
|
|
311
|
+
- native call count and declared cost;
|
|
312
|
+
- I/O requests and bytes;
|
|
313
|
+
- wall-clock deadline and cancellation;
|
|
314
|
+
- cleanup reserve.
|
|
315
|
+
|
|
316
|
+
Charge before allocation or expensive work where possible. For size-dependent work, charge base plus
|
|
317
|
+
input and output growth. Native code must either consume the same budget or run behind a bounded
|
|
318
|
+
adapter; an instruction meter around an unbounded native call is not a sandbox.
|
|
319
|
+
|
|
320
|
+
Define terminal behavior for every exhausted dimension. Prevent catchable guest exceptions from
|
|
321
|
+
resetting or bypassing a hard sandbox budget unless the language explicitly permits a separately
|
|
322
|
+
bounded recovery region.
|
|
323
|
+
|
|
324
|
+
## Semantic differential tests
|
|
325
|
+
|
|
326
|
+
Compare:
|
|
327
|
+
|
|
328
|
+
- executable AST versus bytecode VM;
|
|
329
|
+
- interpreter versus specification model;
|
|
330
|
+
- optimized versus unoptimized bytecode;
|
|
331
|
+
- cached versus freshly compiled code;
|
|
332
|
+
- direct host adapter versus recorded or fake adapter;
|
|
333
|
+
- equivalent source transformations;
|
|
334
|
+
- serialize-deserialize or suspend-resume boundaries.
|
|
335
|
+
|
|
336
|
+
Normalize only representation details. Compare:
|
|
337
|
+
|
|
338
|
+
- result value and identity relations;
|
|
339
|
+
- ordered mutation and host-effect trace;
|
|
340
|
+
- completion kind and payload;
|
|
341
|
+
- guest error identity, source, and stack;
|
|
342
|
+
- final bindings and object graph observations;
|
|
343
|
+
- budget charges and terminal point;
|
|
344
|
+
- deterministic service consumption;
|
|
345
|
+
- source stepping and coverage where promised.
|
|
346
|
+
|
|
347
|
+
When engines disagree, use the semantic authority, not performance, implementation age, or majority.
|
|
348
|
+
|
|
349
|
+
## Failure matrix
|
|
350
|
+
|
|
351
|
+
| Fault or boundary | Required behavior |
|
|
352
|
+
| --- | --- |
|
|
353
|
+
| Host and guest numeric rules differ. | Guest value and operator contract wins. |
|
|
354
|
+
| Assignment key evaluation throws. | Later value evaluation and write follow declared ordering. |
|
|
355
|
+
| Return crosses nested cleanup. | Completion and cleanup order remains explicit. |
|
|
356
|
+
| Engine invariant throws a host exception. | It remains an engine defect, not a guest error. |
|
|
357
|
+
| Native retains a guest object. | Handle and GC root lifetime are visible and bounded. |
|
|
358
|
+
| Async native completes after cancellation. | Generation check rejects or handles stale completion. |
|
|
359
|
+
| Hash iteration changes across runs. | Specified order is preserved or seed is recorded as allowed nondeterminism. |
|
|
360
|
+
| String growth exceeds budget mid-operation. | Work stops before unbounded allocation and reports the correct budget. |
|
|
361
|
+
| Cleanup runs after budget exhaustion. | Cleanup uses a bounded reserve and cannot restart normal execution. |
|
|
362
|
+
| Cached bytecode uses old native symbols. | Cache validation rejects and recompiles or reports incompatibility. |
|
|
363
|
+
|
|
364
|
+
## Invariants
|
|
365
|
+
|
|
366
|
+
- Guest semantics never depend on an undocumented host default.
|
|
367
|
+
- Runtime values have one authoritative equality, identity, hash, and conversion contract.
|
|
368
|
+
- Semantic type, runtime kind, and storage tag remain independently replaceable.
|
|
369
|
+
- Operator decline is never confused with a thrown guest failure.
|
|
370
|
+
- A compound assignment resolves and evaluates its place exactly once.
|
|
371
|
+
- Evaluation order is observable and tested at every side-effecting boundary.
|
|
372
|
+
- Every nonlocal control result uses the declared completion protocol.
|
|
373
|
+
- Guest failures and engine defects remain distinguishable.
|
|
374
|
+
- Native code receives bounded capabilities and participates in lifetime, cancellation, and budget rules.
|
|
375
|
+
- Deterministic runs obtain every observable host input from the declared execution context.
|
|
376
|
+
- Every hard budget has an in-operation charge point and terminal rule.
|
|
377
|
+
- Differential tests compare semantic envelopes, not only printed values.
|
|
378
|
+
|
|
379
|
+
## Skill handoffs
|
|
380
|
+
|
|
381
|
+
- Use `interpreter-engineering-review` for guest semantics, runtime values, completion, native
|
|
382
|
+
boundaries, determinism, and budgets.
|
|
383
|
+
- Use `parser-engineering-review` for token, grammar, CST, AST construction, parser recovery, and
|
|
384
|
+
source-unit contracts.
|
|
385
|
+
- Use `compiler-engineering-review` for bytecode compiler transforms, IR verification, optimization,
|
|
386
|
+
code generation, or stage-local wrong-code localization.
|
|
387
|
+
- Use `fuzz-harness-review` for harness, instrumentation, corpus, mutator, sanitizer, campaign, and
|
|
388
|
+
generic artifact lifecycle.
|
|
389
|
+
- Use `security-flow-review` for host capability, authorization, filesystem, network, and secret
|
|
390
|
+
exposure paths.
|
|
391
|
+
- Use `memory-lifetime-review` for GC, host handles, callbacks, arenas, and retained-object defects.
|