refactor(stella-time): one home for the real time sources behind the Sleeper and Clock ports - #6488
Open
macanderson wants to merge 3 commits into
Open
refactor(stella-time): one home for the real time sources behind the Sleeper and Clock ports#6488macanderson wants to merge 3 commits into
macanderson wants to merge 3 commits into
Conversation
Contributor
|
SCR-003 DoD check waived by the |
macanderson
force-pushed
the
fix/6484-engine-clock-port
branch
from
September 10, 2026 07:50
4153a71 to
ec31417
Compare
macanderson
force-pushed
the
fix/6484-engine-clock-port
branch
2 times, most recently
from
September 10, 2026 17:48
4ed693c to
62937eb
Compare
macanderson
marked this pull request as ready for review
September 10, 2026 18:11
Contributor
There was a problem hiding this comment.
Sorry @macanderson, your pull request is larger than the review limit of 150,000 diff characters
macanderson
force-pushed
the
fix/6484-engine-clock-port
branch
from
September 10, 2026 18:34
62937eb to
2d1f68b
Compare
…verity advisories
… license check, as arenabench's once were
…Sleeper and Clock ports #6486 routed every instant, wait and timeout in stella-core through retry::Sleeper and left the real sources copied: a wall clock in stella-cli, stella-runtime and stella-serve, a Tokio sleeper in two of them, and a sleeper trait of stella-fleet's own with a third. stella-time now holds TokioSleeper, WallClock and MonotonicClock (which replaces the CLI's per-construction SystemClock), and ships PausedSleeper and NoopSleeper behind a test-util feature for the test sweep that follows. The copies are deleted; stella-fleet's monitor takes the engine's Sleeper. tests/one_home.rs reads the shipping tree and fails on any other copy. ADR 0042 records the design #6486 merged and where the sources live. Refs #6484
macanderson
force-pushed
the
fix/6484-engine-clock-port
branch
from
September 10, 2026 18:34
2d1f68b to
c6af5f7
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 & why
#6486 routed every instant, wait and timeout in
stella-corethroughretry::Sleeper. It left the other half of the same defect in place: the real time sources are copied. A Unix-epoch wall clock lived three times (stella-cliWallClock,stella-runtimeHostClock,stella-serveWallClock); a Tokio sleeper twice (stella-cli,stella-serve); andstella-fleetkept aSleepertrait of its own with a thirdTokioSleeper.stella-servemay not linkstella-cliorstella-runtime, andstella-coremay not link the Tokio timer, so the copies had no home.This PR gives them one, and ships the two test doubles the follow-up sweep will move every test onto.
stella-timeholdsTokioSleeper(the engine's real sleeper andnow),WallClock(Unix epoch, for a stamp another process reads) andMonotonicClock(one origin per process, for a span compared as a number; replacesstella-cli's per-constructionSystemClock). The copies are deleted;stella-fleet's trait is gone and its monitor takes the engine's, re-exported under the old name. Justified under AGENTS.md § "When a new crate is justified" on two counts: it holds the effects the ports keep out ofstella-core, and it sits belowstella-serve. Exemplar: tokio / tokio-test.stella_time::test_utilshipsPausedSleeperandNoopSleeperbehind atest-utilfeature. Nothing takes them yet: the sweep that retires the ~30 per-file copies instella-coreandstella-engineis the stacked follow-up PR, kept separate so each diff stays under Sourcery's review limit and reads as one change.nowsits onSleeper, why the reading is anInstant) and where the sources and doubles live. fix(stella-core): read every instant, wait and timeout through the Sleeper port #6486 closed nothing and wrote no ADR; SCR-002 asks for one.Refs #6484 — the issue closes with the follow-up sweep, which lands its last two checklist items.
The witness
main, passes here)crates/stella-time/tests/one_home.rsreads every shipping.rsundercrates/*/src(test directories andtests.rsfiles skipped) and fails on anyimpl … Sleeper foroutsidestella-time, and on anystruct WallClock | HostClock | SystemClock | MonotonicClockoutside it. Theimpls that stay are named with reasons: two special-shape doubles (the retry tests' recording sleeper, the monitor's advancing sleeper) and five inline test doubles the follow-up sweep retires; a second test fails if a named one disappears, so the list cannot go stale. Onmainthe sleeper test fails onstella-cli/src/runtime.rsandstella-serve/src/remote.rs, and the clock test onstella-cli/src/runtime.rs(SystemClock,WallClock) andstella-runtime/src/wrapper/stamp.rs(HostClock);stella-fleet/src/monitor.rsis on the kept list for its advancing double, so its productionTokioSleeperwas reachable only through the trait it also deleted. Locally the time crate's 6 + 3 tests pass, andstella-core,stella-engine,stella-serve,stella-runtime,stella-fleetandstella-clitype-check with their tests.The gate
cargo fmt --check-D warnings— CI; ran locally, scoped and clean, on the six touched crates--help, doc comments)Closeshere by design: this PR advances The engine reads the clock itself in nineteen places, and three crates keep their own copy of the wall clock #6484 and the follow-up closes it (closes-nothing)Fix over file
main(sharp<0.35.4, GHSA-rgj7-g3m4-5g8c;js-yaml<4.3.2, GHSA-2883-xcg3-v3hh) are both transitive underwebsite/, sowebsite/pnpm-workspace.yamlraises thesharpfloor and adds ajs-yamlone, the way that file already handlespostcssandnanoid;js-yamltakes a caret because a bare floor resolves to 5.x, which fumadocs does not call.dependency-reviewre-surfaced sharp's fourteen LGPL-3.0 libvips tuples on that bump (not a required check). They are named inallow-dependencies-licenses, which is the immediate remedy issue dependency-review: the @img/sharp-* LGPL exemption cannot converge — the action has no purl globbing, so every new libvips tuple reds the gate #2532 records, with the reasoning in the workflow comment: the docs site is private, imports nonext/image, and ships nothing into either license track.AGENTS.mdcarried two crate counts ("Twenty-nine crates", "The other twenty-four crates") that a new crate makes wrong; both are now phrased without a number.Ground-rule check
stella-core; it is untouched except its READMEDeleted tests
Three tests in
stella-cli/src/runtime.rstested the clocks that module no longer defines, and each has a counterpart instella-time/src/lib.rs:system_clock_starts_near_zero_and_advances_monotonically→the_monotonic_clock_never_goes_backwards(plusevery_monotonic_clock_shares_one_origin, the property the old per-construction clock lacked)default_constructs_a_fresh_clock→ gone with the constructor;MonotonicClockis a unit structwall_clock_reads_epoch_milliseconds_not_a_process_origin→the_wall_clock_counts_from_the_unix_epochAnything reviewers should know?
u64readings ofClock. That design lost to fix(stella-core): read every instant, wait and timeout through the Sleeper port #6486 on the merge order and on the merits the ADR states (a double has to answernowandsleepfrom one timeline), and it was dropped rather than rebased over the merged one.stella-cli'sruntimemodule is now three re-exports andone_shot_budget_guard. TheSystemClockrename toMonotonicClockreachesfleet_cmd,agent/engine.rsand two test files, and nothing else.Summary by Sourcery
Centralize real time sources and shared sleeper doubles in
stella-timewhile preserving the existing time ports across all hosts.New Features:
stella-timecrate as the shared home for Tokio-backed sleeping, wall-clock timestamps, process-monotonic timing, and reusable test sleeper doubles.Bug Fixes:
Sleeperport.Enhancements:
stella-time.Build:
stella-timein the workspace and add it as a dependency for the affected host crates.CI:
Documentation:
Tests:
stella-timesource-layout witness tests.Chores: