test(runtime): assert guest-observed wasi:clocks time under a ManualClock override#282
Merged
Conversation
f904fdd to
a5dff05
Compare
d7f492e to
0cbbf13
Compare
a5dff05 to
ec3f266
Compare
0cbbf13 to
209af78
Compare
ec3f266 to
f4d7a23
Compare
209af78 to
ac66518
Compare
f4d7a23 to
bb88b17
Compare
ac66518 to
f6b39b6
Compare
bb88b17 to
b388962
Compare
f6b39b6 to
d08136d
Compare
b388962 to
146d6cb
Compare
d08136d to
c930cc0
Compare
146d6cb to
5177c22
Compare
c930cc0 to
035550f
Compare
5177c22 to
25bccb5
Compare
035550f to
5340905
Compare
25bccb5 to
62b40a8
Compare
5340905 to
84542b5
Compare
62b40a8 to
f25ce1b
Compare
84542b5 to
711da09
Compare
f25ce1b to
5186aff
Compare
711da09 to
6346d1f
Compare
5186aff to
cc3d720
Compare
6346d1f to
5271b4a
Compare
cc3d720 to
0088a67
Compare
5271b4a to
454c904
Compare
0088a67 to
aadc89c
Compare
4fc6d4a to
845029d
Compare
jean-neiverth
approved these changes
Jul 8, 2026
jean-neiverth
left a comment
Collaborator
There was a problem hiding this comment.
Clean test. The ManualClock sharing via Arc is correct, the timeout prevents hangs, and the CI wiring is consistent.
df45f97 to
a6ec61a
Compare
a22852e to
d635bbe
Compare
8f1affb to
3825099
Compare
35a3c85 to
c13c909
Compare
93006aa to
fa54bf4
Compare
fa54bf4 to
e1282d9
Compare
c13c909 to
8a272d5
Compare
…lock override Add a clock-reader fixture that reads the WASI wall clock through std on every event and logs it, plus a harness test that pins a ManualClock, boots the fixture under that override, dispatches a block, and asserts the guest logged the pinned instant rather than the ambient host clock. This proves the WasiClockOverride reaches the guest end to end, not just the host boot path.
e1282d9 to
0adea04
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add a small
clock-readerguest fixture undermodules/fixtures/that on every event readsstd::time::SystemTime::now()(which routes towasi:clocks/wall-clockunderwasm32-wasip2) and logs the wall time as whole seconds. Add anexum-runtimeharness test,harness_guest_observes_the_clock_override, that pins aManualClockto a known instant, boots the fixture under that override, dispatches a block, and asserts the guest logged the pinned instant.The fixture is registered in the workspace members, the
just ciwasm build list, and the CItestjob's wasm build list so the integration test always has its artefact.Why
e2e_manual_clock_override_boots_and_dispatchesonly proves theWasiClockOverridethreads through boot on the host side; nothing asserted that a guest readingwasi:clocksobserves the overridden time. This closes that gap with an end-to-end assertion: the logged value equals the pinned instant and not the ambient host clock, so the override is proven to reach the guest.This is authored as a top-of-train car so the new workspace member and fixture do not conflict-cascade against the in-flight epic stack.
Closes #281
Testing
cargo build -p clock-reader --target wasm32-wasip2 --release. Confirmed the emitted component importswasi:clocks/wall-clock@0.2.6viawasm-tools component wit.cargo test -p nexum-runtime --all-features harness_guest_observes_the_clock_overridepasses: the guest logsclock wall 1700000000, parsed back and asserted equal to the pinned seconds.clock().set(...)call: the override then defaults to the epoch, the guest logs0, and the test fails on the timeout, confirming the assertion is live and the guest is bound to the override rather than the ambient clock.cargo clippy -p nexum-runtime --all-targets --features test-utils -- -D warningsandcargo clippy -p clock-reader --all-targets -- -D warningsare clean.cargo fmt -p nexum-runtime -p clock-reader -- --checkreports only a pre-existing, unrelated drift inbuilder.rs(untouched here).AI Assistance
AI Assistance: Claude Code (Opus 4.8) used for the fixture, test and PR authoring.