Refactor orchestration timing to use Effect Clock and add deterministic test clock#102
Open
danielbdyer wants to merge 1 commit into
Open
Refactor orchestration timing to use Effect Clock and add deterministic test clock#102danielbdyer wants to merge 1 commit into
danielbdyer wants to merge 1 commit into
Conversation
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.
Motivation
Date.now()calls with an EffectClock-backed abstraction so progress/elapsed assertions are not flaky.elapsed,wallClockMs,durationMs,phaseDurationMs) while sourcing values through the injected clock.Description
lib/application/time.tsthat exposesnowMillisandelapsedSincebacked byClock.currentTimeMillis.Date.now()usages with the new abstraction inrunPipelineStage(lib/application/pipeline/stage.ts) so stage lifecycle events emitdurationMsusing the Effect clock.lib/application/speedrun.tsto computespeedrunStart, phase starts, and phase durations usingnowMillis/elapsedSince, preserving the original progress payload fields.lib/application/dogfood.tsto thread the loopstartedAtfromrunDogfoodLoop, compute iteration start/duration via the clock, and make progress-event construction read time through the abstraction (returned as an Effect) to keep elapsed/wall-clock deterministic.tests/support/test-clock.tswhich supplies aClockimplementation and helpers (advanceBy,setTime) for tests.tests/dashboard-projection.laws.spec.tsthat injects the test clock and assertsrunPipelineStagereports the exact elapsed duration (25 ms) when the test clock is advanced.Testing
npx playwright test tests/dashboard-projection.laws.spec.ts, and the file's tests passed (11/11).npm run typecheck; typecheck failed due to pre-existing missing generated module declarations (../generated/tesseract-knowledge) which are unrelated to the timing refactor.Codex Task