Repository navigation
Dispatch workspace: plan a day, publish routes, move orders between routes - #439
Merged
Merged
Conversation
…tween routes - Orchestrator run plans the posted order ids or the orders scheduled for a posted date, and no longer falls back to every unassigned order on every date; order_statuses is honoured - Every run is stored with the reason each order was left out, returned as unassigned_reasons keyed by order id with a plan_run_id; the driver-assignment engine now reports the orders it could not place, not vehicle ids - Commit dates manifests and their orders by scheduled_date, creates drafts without telling drivers, takes re-planned orders off their old route, and can publish now or at a booked time - Manifests go draft, published, active, completed, with published_at and a queued scheduled publish; driver endpoints only return routes that were published. Existing drafts stay drafts - One reassignment service moves an order's unfinished stops between routes, re-sequences both, updates the order's driver, vehicle and manifest and tells both drivers; order detail, bulk assign, the Scheduler and commit all use it - Insert an order into a route at a position, and a best-fit query that returns the cheapest insertion per driver - Order import returns an outcome per row, can re-validate edited rows without creating anything, and marks created orders with imported_via_orchestrator and an import batch id - The Orchestrator workbench publishes on commit, so its routes still reach drivers - API changes are listed in docs/DISPATCH_WORKSPACE_API.md Co-Authored-By: Claude <noreply@anthropic.com>
feature/map-canvas now carries main through v0.7.4, including route optimisation
(ManifestBuilder, sequencing, locks, dispatch stop edits, manifest.changed). D1 is
reworked to sit on it rather than beside it:
- One lifecycle: draft (unpublished Orchestrator plan) -> published -> active (opened)
-> in_progress (a stop worked) -> completed. ManifestBuilder's own routes start
published; drivers never see, open or start a draft. The migration publishes
existing auto-built drafts and leaves Orchestrator drafts as drafts.
- Commit is main's (one manifest per driver-day, one stop per order point) plus the
date checks, order dating, quiet drafts, publish / publish_at and plan runs.
- RouteReassignment now drives ManifestBuilder: bulk assign and the Scheduler (which
bypassed the manifest observer) go through it; it moves the vehicle, a new day's
stops and orders.manifest_uuid, and positions an order on a chosen route. The
order form's PUT is left to main's observer.
- The order insert endpoint moves to POST manifests/{id}/orders (main owns
manifests/{id}/stops) with main's position convention; best-fit uses main's
road-matrix ManifestStops::fit.
- manifest.updated is dropped for main's manifest.changed; a draft's goes to the
company channel only.
Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/map-canvas #439 +/- ##
=======================================================
Coverage 100.00% 100.00%
- Complexity 20500 20747 +247
=======================================================
Files 787 794 +7
Lines 65151 65726 +575
=======================================================
+ Hits 65151 65726 +575
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…n's key The /v1 manifest endpoints serve both Navigator (a driver's own token) and the organisation's API key. Only the driver should be kept from drafts; the key that committed a draft through /v1/orchestrator/commit reads, sequences and edits it. This is what the Postman contract's manifest requests do. Co-Authored-By: Claude <noreply@anthropic.com>
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 changes
orchestrator/commitacceptsscheduled_date. Manifests are dated by it, and each order'sscheduled_atmoves to that day: its time of day is kept, an order with no time takes its planned arrival, and failing that the start of the day. The commit also acceptsplan_run_id,publishandpublish_at.orchestrator/runplans the orders inorder_ids, or the orders scheduled onscheduled_date. Sending neither is a 422; a run no longer plans every unassigned order on every date.order_statusesis now honoured (any of created / dispatched / started).orchestration_runstable with the reason each unplaced order was left out. The run returnsunassigned_reasons, keyed by order id, and aplan_run_id. Engines that give no reason get that engine's usual cause. The driver-assignment engine now reports orders instead of vehicle ids.draft → published → active → in_progress → completed(active/in_progressare main's opened/started statuses), withpublished_atand a bookedpublish_atthat a queuedPublishScheduledManifestjob carries out. New endpoints:POST manifests/{id}/publishandPOST manifests/publish(by ids, or every draft of a day). Driver endpoints return only manifests that were published, so a draft is a 404. Publishing records a status history row (so main'smanifest.changedgoes out), sends the driver amanifest_publishedpush, and queues the per-order notices older Navigator builds rely on. Routes main'sManifestBuildermakes from a driver's own assignments startpublished; the migration publishes existing auto-built drafts, and Orchestrator drafts stay drafts (drivers stop seeing them until a dispatcher publishes them).Support\Dispatch\RouteReassignment), built on main'sManifestBuilder. It moves the order's stops between routes, updates its driver, vehicle andmanifest_uuid, follows a new day, and can position the order on a chosen route.orders/bulk-assign-driverandorders/schedule(Scheduler drag), which bypassed main's manifest observer, now go through it. Order detail (PUT) and the orchestrator commit use main's observer and commit.POST manifests/{id}/ordersputs an order on a route at a position among the stops still to do (main's convention; main ownsmanifests/{id}/stopsfor stops of no order). Without a position it goes to its best fit, never ahead of stops done or locked.GET manifests/best-fitreturns the cheapest insertion per driver, priced with main's road-matrixManifestStops::fit.orchestrator/import-ordersreturns an outcome for every row (created / failed with a reason and per-field errors).validate_onlyre-checks edited rows without creating anything, andimport_batch_idlets fixed rows join the earlier batch. Created orders carrymeta.imported_via_orchestratorandmeta.import_batch_id.Frontend: one forced change. The current workbench sends
publish: trueon commit, so its routes still reach drivers now that drafts are hidden from them.Behaviour changes to know about
UPDATE. That gives correct routes and notices, at the cost of one save per order.v1order update does not move routes yet. Only the console entry points listed above do.Tests
Feature/Http/Internal/DispatchWorkspaceTest.php(SQLite, real models and controllers):publish/publish_at; a re-plan takes the order off its old routec4d0af3d, mostly in code fromc929bdd7(driver duty periods, fuel reports, issues, navigator links). They are not touched here.Merged with
feature/map-canvas(main through v0.7.4)Conflicts resolved in
Manifest,ManifestStop, the driver and internalManifestControllers,OrchestrationController,OrderController, the service provider and the orchestrator contracts test; D1 was reworked to sit on main's route optimisation (see the merge commit message and the doc). Main's manifest tests were updated where they asserted that drafts are driver-visible.