Repository navigation
feat(dispatch): implement Phase 14 preparation-aware assignment - #19
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.
Preparation delays can make the nearest rider spend unnecessary time waiting at pickup. Phase 14 adds
preparation_aware_dispatch, which predicts pickup waiting and ranks feasible idle riders by elapsed delivery completion plus a configurable waiting penalty. In the deterministic 18-minute preparation scenario, it selects the rider who waits 3 minutes instead of 13 while preserving the same delivery completion time.Observed readiness overrides forecasts, missing readiness returns a typed evaluation error, and waiting advances the delivery leg’s routing departure, including FIFO traffic. The implementation reuses Phase 13 eligibility, coverage, feasibility, routing validation, immutable proposals, and atomic commit. Structured evidence records readiness inputs/source, weight, completion duration, waiting, and penalty contributions. The original Basic Dispatch baseline remains available.
Three runnable synthetic scenarios compare fresh equivalent worlds with identical external readiness events and distinguish predictions from executed fulfillment metrics. Documentation includes ADR 0014 and the Phase 14 completion report. A positive waiting penalty may prefer later completion with less idle time; deadlines remain soft-observed. The general simulation engine remains Phase 15 work.
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— 108 tests pass, including 12 new Phase 14 fixtures; doc tests passbasic_dispatchandpreparation_aware_dispatchexamples pass on Rust 1.99 and emit valid JSONgit diff --checkpasses