feat: Phase 2 — order detail + append-only status timeline - #3
Merged
Merged
Conversation
An order detail view at GET /admin/commerce?order=REF (a branch of the existing gated page — no new route, holdsPageGate still applies): the order, its lines, its lifecycle buttons, and a real timeline. The timeline is backed by a new append-only commerce_order_event table (002_order_events); OrderBook records one row inside each existing gated transition (place/pay/fulfil/cancel). The actor is server-set — 'admin-ui' from the admin actions, the token principal name over MCP — never from request input. The order's own status stays the authoritative current state. Order references in the list link to the detail. All reads bound; REF escaped. place/pay/cancel gained an optional actor param (default 'system', BC); the now-unused transition() helper was inlined into pay(). Tests: order detail renders lines + timeline (pending reads as "Placed"), currency in the order's currency, rows link to it, unknown/hostile ?order= are handled + escaped; migration list asserts 002_order_events; Choreography + actions tests create the event table. 26 tests green; PHPStan + php-cs-fixer clean. Co-Authored-By: Claude Opus 4.8 <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.
Phase 2a "Answers" (from Fable's Stocked & Shipped), pairs with NimbusCMS/plugin-inventory#3.
What
An order detail at GET /admin/commerce?order=REF — a branch of the existing gated page (no new route;
holdsPageGate/ADR 0020 applies): the order, its lines, its lifecycle buttons, and a timeline.The timeline is backed by a new append-only
commerce_order_eventtable (002_order_events);OrderBookrecords one row inside each existing gated transition (place/pay/fulfil/cancel). The actor is server-set —admin-uifrom the admin actions, the token principal over MCP — never from request input. The order'sstatusstays the authoritative current state. Order refs in the list link to the detail.place/pay/cancelgained an optionalactorparam (defaultsystem, backward-compatible); the now-unusedtransition()helper was inlined intopay().Safety
Read views are bound + escaped (REF); the only write is the append-only event, server-set fields inside existing gated transactions — no new endpoint. (Both review skills run pre-build; security-green.)
Deploy note
Adds a migration → the demo/redeploy needs
php bin/nimbus migrate+ agolden.sqlreseed.Tests
Detail renders lines + timeline (pending → "Placed"), currency-correct totals, rows link to it, unknown/hostile
?order=handled + escaped; migration list updated; Choreography + actions suites create the event table. 26 tests green; PHPStan + php-cs-fixer clean.🤖 Generated with Claude Code