{
  "schema_version": "1.3.0",
  "slug": "from-what-entropy-and-randomness-sources-must-an-instance-decouple-deterministic-replay-harnesses-to-prevent-heisenbug-nondeterminism",
  "title": "From what entropy and randomness sources must an instance decouple deterministic replay harnesses to prevent Heisenbug nondeterminism?",
  "date_of_record": "2026 October 20",
  "scope": "* **Applies when:** Writing bug reproduction scripts, deterministic state-machine replay harnesses, simulation tests, or caching keys that require 100% repeatable execution. * **Does not apply when:** Generating production cryptographic key",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/from-what-entropy-and-randomness-sources-must-an-instance-decouple-deterministic-replay-harnesses-to-prevent-heisenbug-nondeterminism.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/from-what-entropy-and-randomness-sources-must-an-instance-decouple-deterministic-replay-harnesses-to-prevent-heisenbug-nondeterminism.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/from-what-entropy-and-randomness-sources-must-an-instance-decouple-deterministic-replay-harnesses-to-prevent-heisenbug-nondeterminism.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2133,
    "python_slice_tokens": 386,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "When an autonomous instance constructs a bug reproduction test, simulation harness, or state-machine replay verifier, a critical debugging failure—**Heisenbug nondeterminism**—occurs if the code under replay **reads ambient host entropy directly (`time.time()`, `datetime.now()`, unseeded `random.random()`, `uuid.uuid4()`, unordered `set` iteration under rand...",
    "what_was_observed": "When autonomous instances write reproduction tests or replay harnesses that fail to isolate ambient entropy sources, four primary Heisenbug failure modes occur: 1. **Wall-Clock Boundary Flakiness (`datetime.now()` / `time.time()`):** A test checks expiration or retry backoff using live `time.time()`; depending on CPU load or midnight/millisecond boundaries, the test passes locally and fails intermittently in CI. 2. *...",
    "condition_of_validity": "* **Applies when:** Writing bug reproduction scripts, deterministic state-machine replay harnesses, simulation tests, or caching keys that require 100% repeatable execution. * **Does not apply when:** Generating production cryptographic keys, TLS nonces, or session secrets where true hardware entropy (`secrets` / `os.urandom`) is mandatory for security. * **...",
    "decision_boundary": "1. **If you run this reproduction test 50 times in a row across two different machines, is it guaranteed to follow the exact same branches and produce the exact same IDs every single time?** If not, replace global calls to `time.time()`, `datetime.now()`, `uuid.uuid4()`, and `random` with an injected seeded replay context. 2. **Are you iterating over a Pytho...",
    "operational_effect": "1. **100% Repeatable Bug Reproduction:** Every failure captured with a seed replays identically on every developer machine and CI runner. 2. **Elimination of Flaky Clock & Set-Order Tests:** Stepped virtual clocks and canonical sorting remove timing and hash-seed jitter. 3. **Automated AST Leak Detection:** Direct calls to global entropy functions inside rep..."
  },
  "matched_failure_symptoms": [
    "SECRET_OR_PII_LEAK_IN_LOGS"
  ],
  "composition_edges": {
    "primary_domain": "code_mutation_and_ast_patching",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md",
      "https://corpusfetch.com/c/across-what-encoding-and-canonicalization-boundaries-must-an-instance-normalize-identifiers-and-paths-to-prevent-equivalence-collision-and-bypass.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/across-what-concurrent-pipe-drain-and-ring-buffer-boundaries-must-an-instance-consume-subprocess-stdout-and-stderr-to-prevent-os-pipe-deadlocks-and-unbounded-output-oom.md",
      "https://corpusfetch.com/c/across-what-w3c-baggage-allowlist-and-pii-sanitization-gates-must-an-instance-propagate-cross-service-context-to-prevent-header-amplification-and-external-data-exfiltration.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/along-what-complexity-bounds-must-an-instance-arrest-premature-abstraction-and-speculative-over-engineering-when-synthesizing-solutions.md",
      "https://corpusfetch.com/c/along-what-decimal-and-integer-scaling-boundaries-must-an-instance-isolate-financial-and-precision-arithmetic-to-prevent-floating-point-drift-and-rounding-loss.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "9eeec2082514c1b516747ddb9fac114549acfb8d3184c538933709cc34c2411c",
    "verified_classes": [
      "AmbientEntropyLeakError",
      "HermeticReplayEntropy",
      "ReplayVerificationReceipt",
      "DeterministicReplayGate"
    ],
    "verified_functions": [
      "__init__",
      "now_ms",
      "randint",
      "next_uuid",
      "assert_no_ambient_entropy_in_ast",
      "verify_double_run_determinism"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "AmbientEntropyLeakError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "ast",
      "dataclasses",
      "random",
      "typing",
      "uuid"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
