refactor(videre-host): unify quote ledger on runtime wall-clock seam - #43
Open
mfw78 wants to merge 2 commits into
Open
refactor(videre-host): unify quote ledger on runtime wall-clock seam#43mfw78 wants to merge 2 commits into
mfw78 wants to merge 2 commits into
Conversation
mfw78
force-pushed
the
refactor/host-wall-clock-seam
branch
from
August 4, 2026 23:26
c00c999 to
3e724ee
Compare
mfw78
force-pushed
the
chore/qa-sweep-terse-dedup
branch
from
August 6, 2026 17:13
6d1e8f8 to
74ba5ba
Compare
…ck seam Drop the private Clock/SystemClock seam and adopt the runtime's attach_clock seam: Videre overrides Extension::attach_clock and lands the launch wall clock in the VenueRegistry, whose clock slot is now a late-set Mutex that reads the real host clock until a clock is installed. VenueRegistryBuilder::new no longer defaults a clock; with_clock stays as a test and standalone escape hatch over Arc<dyn HostWallClock + Send + Sync>, and the two ledger read sites go through one private now_ms helper. Registry unit tests run on nexum_runtime::test_utils::clock::ManualClock; the platform e2e drives one ManualClock through with_wasi_clocks only, the single-timeline property being guaranteed by construction upstream, and the u64::MAX validity workaround in ScriptedAdapter retires. The last auto_impl use goes with the Clock trait, so the crate drops the dependency. Refs #42. AI Assistance: Claude Fable implemented this change from the issue's decided design, reworked onto the attach_clock seam nexum-runtime#97 landed.
mfw78
force-pushed
the
refactor/host-wall-clock-seam
branch
from
August 6, 2026 18:15
3e724ee to
fe62f37
Compare
…ugh the runtime Collapse the clock slot to a plain handle defaulted to the real host clock: the `Option` carried no state the default could not, and the read now clones the handle out before calling it, so caller-supplied clock code never runs under the slot's lock. Drop `now_ms`, a one-line wrapper over `saturating_ms` with a single call site. Boot the shared-clock e2e through `BootScenario`, the runtime's own launch path, so the runtime performs `attach_clock` instead of a test-side mirror of `attach_wall_clock` that could drift from it silently.
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
Reworks the quote-staleness ledger onto the runtime's
attach_clockseam (rt#97) instead of the crate-localClocktrait.Viderenow overridesExtension::attach_clockinlib.rs, forwarding the launch wall clock intoVenueRegistry::set_wall_clock.Mutex<Option<Arc<dyn HostWallClock + Send + Sync>>>slot: the lock serialises installs and the last launch wins, read throughledger_now_mswhich falls back towasmtime-wasi's realWallClockwhile unset.VenueRegistryBuilder::newno longer defaults a crate-localSystemClock; it now defaultswasmtime_wasi::clocks::WallClock.with_clockis kept as a documented test/standalone escape hatch.Clocktrait andSystemClock, and theauto_impldependency invidere-host/Cargo.tomlused only for that trait's forwarding impls; addswasmtime-wasias a direct dependency.crates/videre-host/tests/platform.rs: theTestClockfixture inregistry.rs's unit tests is replaced withnexum_runtime::test_utils::clock::ManualClock, and two new e2e tests are added,e2e_stale_quote_is_refused_on_the_shared_wall_clock(boots a module throughBootScenariowith aManualClockoverride so the runtime performs theattach_clockcall itself, then proves a fresh submit succeeds and a submit past the advanced clock is refused with thestale-quote:prefix) andattach_clock_installs_the_quote_ledger_clock(callsattach_clockdirectly, no wasm artefact, so the seam stays pinned when the e2e skips).Why
The registry previously ran its own
Clocktrait disconnected from the runtime's wall-clock seam, so the ledger and the guest-visible clock could diverge. Wiringattach_clockgives the ledger and guests one shared timeline sourced from the same launch clock, and lets aManualClock-driven boot exercise the real staleness path end to end instead of only through a registry-local stub.Closes #42
Testing
All checks ran on a fresh clone of
refactor/host-wall-clock-seamat13605fe, detached, insidenix develop(rustc 1.94.0, cargo-nextest 0.9.127). The only touched crate overorigin/chore/qa-sweep-terse-dedup..HEADisvidere-host(plusCargo.lock).No guest crate and no
videre-macroschange is in the diff, buttests/platform.rsis reworked ontoBootScenario, so the wasm-loading suite ran anyway:just build-modules # 5 module wasms built, exit 0 cargo nextest run -p videre-hostRed-teamed against the pinned runtime (db39b6c, cloned to
/tmp/rt42/rtfor the authoritative seam): re-derivedledger_now_ms/record_quote/check_quote_freshnessagainstQUOTE_HORIZON_MS/QUOTE_GRACE_MSand confirmed the new e2e's fresh-submit leg genuinely exercises the shared-clock path rather than passing vacuously; fixes from that pass are folded into13605fe.AI Assistance
Implementation by claude-fable-5, red-team review by claude-opus-5, PR description by claude-sonnet-5.