Repository navigation
feat(simulation): implement Phase 15 deterministic delivery engine - #20
Merged
Merged
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.
Phase 15 adds a deterministic discrete-event engine for executing delivery scenarios through a configured horizon.
roadrunner simulate scenario.json [--json]now runs order creation, readiness, assignment, rider movement, pickup, delivery, and traffic replacement through a stable priority queue, reusing the existing dispatch and shared World transitions.The new
roadrunner-simulationcrate owns logical time, versioned seeded readiness generation, queue insertion order, execution history, and population-aware metrics. Each run starts fresh, materializes exogenous readiness before dispatch, commits assignments serially, and retries pending work when domain events or completed deliveries make progress possible.World::register_orderatomically creates request/readiness/fulfillment records.Traffic changes affect newly departing legs; in-flight route costs remain pinned. Output separates predicted ETA from recorded execution, reports uncreated and unfinished orders, and distinguishes completed lateness from outstanding deadlines. Empty metrics are unavailable. The CLI supports checked inline synthetic graphs and validated graph artifacts with exact digest binding.
A seeded fixture, ADR 0015, usage documentation, completion report, and reproducible timing collector accompany the implementation. The 600-second synthetic fixture produces four deliveries, one capacity-infeasible pending order, and one uncreated order. Its external timing artifact records hardware, dataset/graph identities, compiler/configuration, warmup, 11 measured samples, median/p95/p99, and byte-identical replay hashes. This is a small-fixture scheduling check, with fleet benchmarking and dynamic re-dispatch left to their later phases.
Validation:
cargo fmt --all -- --checkcargo +1.99.0 clippy --workspace --all-targets --all-features --locked -- -D warningscargo +1.99.0 test --workspace --all-features --locked— 130 tests pass; doc tests passcargo +1.99.0 build -p roadrunner-cli --release --lockedgit diff --checkpasses