Skip to content

test(library): deterministic mode replays a byte-identical trace over 10,000 ticks - #11

Closed
Immanuel-Fowler wants to merge 1 commit into
feat/tick-cost-benchmarkfrom
test/determinism-trace
Closed

Immanuel-Fowler wants to merge 1 commit into
feat/tick-cost-benchmarkfrom
test/determinism-trace

Conversation

@Immanuel-Fowler

Copy link
Copy Markdown
Owner

Stacked on #10 (feat/tick-cost-benchmark); merge that first.

What

Two tests in tests/library_tests.rs:

  • engine_deterministic_trace_is_byte_identical_over_ten_thousand_ticks. One scripted sequence of 10,000 ticks and events (host-fired events on every third and eleventh tick, a handler that triggers another event every seventh tick, handlers that sleep on host time across ticks, instance state, a varying dt) is replayed on fresh instances, on a current-thread and a multithreaded runtime, through tick_blocking and tick_sync. Every run must produce the same host-call trace byte for byte, and the trace is checked to actually contain what it should: one record per tick, thousands of sleeps that started and finished on host time, handler-fired events.
  • engine_deterministic_mode_refuses_what_it_excludes. Builds the four documented exclusions (a spawned worker, a serverlet, a landline, a sleep outside an event handler) and asserts each fails with the deterministic-mode message: as ready returning "library startup task failed" or tick returning "tick task failed" on the coordinator's task, and as a panic on the calling thread under tick_sync.

Docs

docs/library-mode.md said the exclusions "panic". They do, but the host observes an error without the reason; the guide now says exactly what surfaces where, and LIMITATIONS-notes.md records that the reason only reaches the panic hook.

Changelog entry under [Unreleased]. No version bump.

🤖 Generated with Claude Code

… refuses what it excludes

One scripted sequence of 10,000 ticks and events — host-fired events,
events fired by handlers, handlers that sleep on host time across
ticks, and instance state — is replayed on fresh instances, on a
current-thread and a multithreaded runtime, through tick_blocking and
tick_sync, and every run must produce the same host-call trace byte
for byte. A second test builds the four documented exclusions, a
spawned worker, a serverlet, a landline and a sleep outside an event
handler, and asserts that each fails with the deterministic-mode
message, as an error from ready or tick on the coordinator's task and
as a panic on the caller's thread under tick_sync.

The library guide said the exclusions "panic". They do, but what the
host sees is an error without the reason; the guide now says exactly
that, and the notes record the gap.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant