Skip to content

fix(determinism): stabilize contract_hash, widen NoWallClock, correct DET-003#212

Merged
yairfalse merged 2 commits into
mainfrom
feature/monster-b-determinism
May 24, 2026
Merged

fix(determinism): stabilize contract_hash, widen NoWallClock, correct DET-003#212
yairfalse merged 2 commits into
mainfrom
feature/monster-b-determinism

Conversation

@yairfalse
Copy link
Copy Markdown
Collaborator

Monster Phase B of the audit-remediation program (docs/audit-2026-05-22.md).

Supersedes #211, which GitHub auto-closed when #210's branch was deleted on merge (stacked-PR gotcha). This is the same work, rebased onto main now that #210 is merged. Review history and discussion are on #211.

Changes

  • B4 — contract_hash stability (real bug). Recursively sorts object keys before hashing so semantically-identical contracts hash identically (>32-key maps had OTP-version-dependent iteration order). Tests cover the >32-key case.
  • B3 — NoWallClock widened (DET-006). Now covers the pure contract & output-shaping transforms (graph parse/validate, vocab modules, contract hashing, occurrence serializer/enrichment). Wholesale broadening was infeasible (83 legitimate wall-clock uses), so time-stamping engine modules stay exempt.
  • B2 — DET-003 was a flawed test, not an engine bug. The engine is deterministic; corrected the case to two fresh workspaces and to normalize only the run-id segment of the log path (per review on fix(determinism): stabilize contract_hash, widen NoWallClock, correct DET-003 #211).

DET-003 and DET-006 now pass without expected_failure flags (closes #207, #208). B1 (injectable clock/id) deferred to Phase H/DST.

Verification

All gates pass locally; #211 was fully green in CI (Core/Black-box/Conformance/Credo/SDKs) before rebase. CI will re-run here on main.

🤖 Generated with Claude Code

yairfalse and others added 2 commits May 25, 2026 00:41
… DET-003

Monster Phase B (docs/audit-2026-05-22.md):

- contract_hash: recursively sort object keys before hashing so
  semantically-identical contracts hash identically regardless of map
  iteration order (>32-key maps are not stable across OTP versions).
- NoWallClock: widen the Credo guard to pure contract & output-shaping
  transforms (graph, validate, vocab modules, contract hashing, occurrence
  serializer/enrichment). Fixes DET-006. Time-stamping engine modules
  (occurrence factory, run history, cache, OIDC, coordinator) stay exempt.
- DET-003: the engine was already deterministic — corrected the flawed
  black-box case to compare two fresh workspaces and strip the
  run_id-bearing log path (the prior case reused .sykli/ so run 2 was a
  cache hit, and under-stripped).

DET-003 and DET-006 now pass without expected_failure flags (#207, #208).
B1 (injectable clock/id) is deferred to Phase H/DST: with the engine already
deterministic it fixes no shipping bug and belongs where it is exercised.

Verification: mix format/credo (32 files)/test (1756, 0 failures),
escript.build, black-box 166 passed / 0 failed / GH-4 expected-red.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ield

Review feedback on #211: keep the log evidence path under comparison and
normalize only the variable run-id segment (logs/<run_id>/ -> logs/RUN_ID/),
rather than deleting .data.tasks[].log entirely. Both runs use fresh
workspaces (distinct cache keys), so neither is a cache hit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yairfalse yairfalse merged commit 4b93ff4 into main May 24, 2026
12 checks passed
@yairfalse yairfalse deleted the feature/monster-b-determinism branch May 24, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix DET-003 occurrence nondeterminism

1 participant