docs(sim): add determinism scope to SIM_SPEC

Appends section 7.7 clarifying that the determinism contracts bind only the
simulator's own components: hidden entropy inside a wrapped production dependency
(allocator state, HashMap RandomState, process-local entropy) is out of scope, and
property tests comparing two independently-allocated wrapped state machines should
not be written.


Signed-off-by: Zachery Aaron Shores-Chmielewski <zacheryasc@gmail.com>
This commit is contained in:
Zachery Aaron Shores-Chmielewski 2026-05-22 15:06:07 +04:00
parent f1f98e9f7d
commit 00270a4059

View file

@ -778,6 +778,30 @@ scenario on every supported architecture and compares the checksum to the
stored value. A mismatch is either a deliberate spec amendment (with
justification) or a bug.
### 7.7 Scope of determinism
The contracts in §4.10, §6.4, and §7.3 bind the simulator's own
components — the §3.1 list. Production code that a host adapter wraps
(the SWIM host adapter wraps `crates/distribution/src/swim/`) is a
dependency, not a §3.1 component. Hidden state inside a wrapped
dependency — allocator state, `std::collections::HashMap` `RandomState`,
any process-local entropy that does not flow through the §7.2
randomness tree — is out of scope. The simulator does not promise to
fix, mirror, or compensate for non-determinism inside a wrapped
dependency.
"Same RNG seed" in §6.4 is the simulator-controlled seed handed to the
host adapter via the §7.2 randomness tree. "Same seed" in §4.10 is the
scenario seed. Neither extends to hidden entropy held inside a wrapped
dependency.
A property test that compares two independently-allocated instances of
a wrapped state machine and asserts identical behaviour is testing the
dependency, not the simulator. The spec does not require it. Do not
write such a test; if one exists, delete it rather than propose a §15
amendment to relax a contract that, on this reading, the spec is not
making.
---
## 8. The scenario format