Configured order lifecycles and order presentation profiles - #346
Open
shivthakker wants to merge 6 commits into
Open
shivthakker wants to merge 6 commits into
shivthakker wants to merge 6 commits into
Conversation
Opt-in via OrderConfig meta; orders whose config does not opt in keep the default dispatch lifecycle and presentation. Backend (meta.lifecycle): - OrderConfig helpers: initial/completed/canceled/terminal codes, allowsDispatch, strict transitions, canTransition over the flow graph - createRecord starts at the configured initial activity and never dispatches when dispatch is disabled - Tracking number initial status comes from the owner when provided - Order::cancel uses the config's canceled activity - updateActivity validates targets against the configured graph when strict_transitions is set; dispatch endpoints refuse non-dispatch configs Frontend: - order-presentation service: extensions register profiles (by meta.presentation_profile) that compose the order form/details, hide fields/actions and route edits to the profiled form - Kanban derives columns/labels from a configured lifecycle instead of injecting default dispatch columns - Activity flow editor roots at the configured initial activity Tests: OrderConfigLifecycleTest; existing suite unchanged (ReportSchemaContractsTest fails on main as well). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…figured-order-lifecycle
…nfigured-order-lifecycle # Conflicts: # addon/controllers/operations/orders/index/details.js
- Profiles hide actions by the built-in ids the order table and details use in the resource view registries (assign-driver, unassign-driver, update-activity, edit-order-details, view-label, listen-to-socket-channel, view-metadata, ...). The details assign/unassign item now has those ids too. - The orders table applies a profile's hidden.actions to every row action by id, as the details panel does, instead of only dispatch and assign driver. - isClosed counts the configured completed and canceled codes as terminal, matching OrderConfig::getTerminalActivityCodes(). - bulkDispatch no longer fatals for an order without a config. - Restore Order::config()'s docblock, which getInitialTrackingStatus() split off.
… and initial tracking status
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v0.6.71 #346 +/- ##
===================================================
Coverage 100.00% 100.00%
- Complexity 12329 12379 +50
===================================================
Files 600 600
Lines 46419 46496 +77
===================================================
+ Hits 46419 46496 +77
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:
|
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.
Summary
Lets an Order Config define its own lifecycle and lets extensions supply an order presentation profile, without changing behaviour for configs that don't opt in.
Configured lifecycle (
order_config.meta.lifecycle){ "initial": "requested", "completed": "completed", "canceled": "cancelled", "terminal": ["completed","cancelled"], "dispatch": false, "strict_transitions": true }OrderConfig:lifecycle(),hasConfiguredLifecycle(),getInitialActivity(),getInitialStatusCode(),allowsDispatch(),hasStrictTransitions(),getTerminalActivityCodes(),isTerminalActivityCode(),canTransition().getCanceledActivity()/getCompletedActivity()honour configured codes.OrderController::createRecord: starts at the configured initial activity; never dispatches whendispatch: false.TrackingNumber::insertGetUuid: the owner may supply its initial tracking status (Order::getInitialTrackingStatus()), so no forcedCREATEDentry.Order::cancel(): uses the config's canceled activity/code.updateActivity: withstrict_transitions, the target must be a configured child of the current activity and the server-side activity definition is used.dispatchOrder/bulkDispatchrefuse configs with dispatch disabled.Presentation profiles (frontend)
order-presentationservice. Extensions register profiles in the registry (fleet-ops:order-presentation/profiles), matched byorder_config.meta.presentation_profile(+ optionalisEnabled).order/formandorder/detailssections (native section names orExtensionComponents), hide fields inorder/form/detailsand multi-drop routing, hide detail/table actions, and route "Edit details" to the profiled panel form. Draft order-type switches call the profile'sprepare/release.order/kanban: with a configured lifecycle, columns/labels come from the flow (graph order, activity status labels) instead of injected default columns.created/dispatched/startedfor such configs.Compatibility
Every new branch is guarded by
hasConfiguredLifecycle()/ a matching profile. Configs withoutmeta.lifecycleand orders without a profile render and behave exactly as before.Tests
server/tests/OrderConfigLifecycleTest.php(5 passing): default semantics unchanged, configured codes, graph-only transitions, config-only flow changes, dispatch disabling.ReportSchemaContractsTestfails identically onmain(pre-existing).Known follow-ups (not in this PR)
OrderFilter::status('active')alias,LiveOrderQueryand metrics still assume default codes;Order::attachFilesdoes not company-scope file ids.