Skip to content

feat(simulation): implement Phase 15 deterministic delivery engine - #20

Merged
404khai merged 1 commit into
mainfrom
feat/dispatch-simulation
Oct 6, 2026
Merged

404khai merged 1 commit into
mainfrom
feat/dispatch-simulation

Conversation

@404khai

@404khai 404khai commented Oct 4, 2026

Copy link
Copy Markdown
Owner

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-simulation crate 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_order atomically 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 -- --check
  • cargo +1.99.0 clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo +1.99.0 test --workspace --all-features --locked — 130 tests pass; doc tests pass
  • cargo +1.99.0 build -p roadrunner-cli --release --locked
  • Timing collector — 11 byte-identical measured replays plus warmup; median wall-clock time below the fixture’s logical window
  • Documentation file links resolve; git diff --check passes

@404khai
404khai merged commit 4968daa into main Oct 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant