# Implementer — F-021 Orders module ## Summary Implemented orders module with item snapshots, explicit state machine, ownership-scoped reads, and domain event publishing for OrderCreated, OrderPaid and OrderCancelled. ## Files changed - `project/migrations/016_orders.js` - `project/src/modules/orders/**` - `project/src/app/build-app.ts` - `project/src/app/tests/orders.itest.ts` ## Acceptance evidence - AC1 snapshot survives: `orders.itest.ts` GET `/orders/:id` returns name/sku/price/tax/discount exactly as provided at create time. - AC2 illegal transition rejected: SHIPPED -> PENDING returns 409 ORDER_STATE_TRANSITION_INVALID. - AC3 state machine: `order-state-machine.test.ts` covers happy path and terminal states; `order-service.test.ts` covers creation event emission and rejected transitions. - AC4 OrderCreated emitted: `order-service.test.ts` captures the event. ## Commands run - `cd project && npm run lint/typecheck/build/test` passed - `cd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- orders.itest` passed; 13 files, 50 tests - `./scripts/verify.sh` passed ## Notes - No new runtime dependency. - Refunds and admin UI intentionally deferred to F-023+. - Event publisher is no-op for v1; F-024 will provide an implementation.