kell_creations/kell_creations_apps/packages/feature_orders
Mike Kell ea4b76b407 chore: reconcile working tree with main and re-baseline master documents
Reconciles repository state after the local toolchain moved to Flutter 3.47.0
/ Dart 3.13.0. No product code changed - no lib/ or test/ file was modified.

Working tree drift:

1. analysis_options.yaml churn (accepted, 11 files). Flutter 3.47 ships
   AnalysisOptionsMigration, which unconditionally writes a fixed
   analyzer.exclude block into every analysis_options.yaml. It runs from
   ensureReadyForPlatformSpecificTooling, so pub get / analyze / run / build
   all restore it, and there is no opt-out (flutter#191160, flutter#191131).
   Commit 92d83e0 previously reverted this; the revert did not hold - a full
   test sweep regenerated the block in 8 more packages. Accepted and committed
   rather than fighting the tool. Verified the risky web/** entry drops
   nothing: neither kell_web/web/ nor kell_mobile/web/ contains .dart files.

2. kell_mobile web scaffold (reverted). A stray `flutter create
   --platforms=web` had added an untracked web/ directory and rewritten
   .metadata so the android platform entry was replaced by web. kell_mobile is
   the Android target, so .metadata was restored and the scaffold deleted.

3. kell_mobile/pubspec.lock (accepted). Transitive bumps resolved under the
   newer SDK: clock, matcher, meta, stack_trace, test_api, vector_math,
   vm_service. All SDK-pinned.

Master document reconciliation:

- PROJECT_STATE_AUDIT.md: removed a duplicated "## 5. Summary Scorecard"
  section - the scorecard and readiness table were present twice from a bad
  append. Re-baselined the remaining §5 against main, added a test-count
  column, and corrected §3.4 counts and §3.5 antipattern status. Stages
  10C-10F, 11A, and 16A had landed but were still recorded as missing.
- master_development_brief.md: Appendix A maturity matrix refreshed to the
  verified counts; new "Toolchain baseline" section documents the Flutter 3.47
  behaviour so a future slice does not try to revert it again.
- build_execution_tracker.md: added the reconciliation slice entry and a
  toolchain note.
- Fixed a pre-existing MD040 lint error (unlabelled code fence).

Verification:
- dart analyze --fatal-infos: clean across all 11 packages and apps
- tests: 1,898 / 1,898 passing (core 90, design_system 51, auth 42,
  integrations 123, data 63, feature_wordpress 545, feature_inventory 167,
  feature_orders 657, feature_policy 17, kell_web 62, kell_mobile 81) -
  identical to the Stage 11A total, confirming no behaviour change
- markdownlint-cli2: 0 issues
2026-09-25 14:19:36 -04:00
..
build feat(orders): Stage 9A - WooCommerce Orders API integration 2026-07-11 09:45:36 -04:00
lib feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
test feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
.gitignore chore(feature_orders): add .gitignore, untrack .dart_tool and pubspec.lock 2026-05-30 10:09:40 -04:00
.metadata feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
CHANGELOG.md feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
LICENSE feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
README.md feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00
analysis_options.yaml chore: reconcile working tree with main and re-baseline master documents 2026-09-25 14:19:36 -04:00
pubspec.yaml feat(stage-11a): custom order domain and data 2026-08-29 15:19:29 -04:00

README.md

Order management for the Kell Creations operations platform. Covers both standard catalogue orders and made-to-order custom commissions behind a single Order aggregate and one OrdersRepository contract.

Features

  • Domain model — Order, OrderItem, OrderStatus, OrderSource, OrderType, PaymentMethod, PaymentResult.
  • Custom orders — CustomOrderSpec (material, colour, size, dimensions, reference images, notes, estimated completion) and DepositInfo (deposit and total amounts in integer cents, deposit/settlement dates, derived balance).
  • Fulfillment pipeline — FulfillmentStatus with enforced transitions: quoted → depositReceived → inProduction → qualityCheck → readyForPickup → completed, plus cancelled from any non-terminal stage and a qualityCheck → inProduction rework path. Illegal jumps are rejected by the domain, not silently applied.
  • Repository contract — OrdersRepository with read, status, note, and create operations plus createCustomOrder, updateCustomOrderSpec, recordDeposit, and advanceFulfillmentStatus.
  • Implementations — FakeOrdersRepository (seeded standard and custom orders across every pipeline stage) and WooCommerceOrdersRepository (REST API v3, custom order state round-tripped through _kc_-prefixed order meta-data).
  • Application layer — OrdersController, CheckoutController, and the GetOrders / UpdateOrderStatus / AddOrderNote / CreateOrder use cases.
  • Presentation — OrdersPage, OrderCard, OrderDetailPanel, OrderStatusChip.

Getting started

Add the package as a path dependency and import the barrel:

dependencies:
  feature_orders:
    path: ../feature_orders
import 'package:feature_orders/feature_orders.dart';

Usage

final repository = FakeOrdersRepository(logger: observability.logger);

final result = await repository.createCustomOrder(
  order,
  spec: CustomOrderSpec(
    material: 'Organic cotton',
    color: 'Sage green',
    size: 'Large',
  ),
  deposit: const DepositInfo.quoted(
    totalAmountCents: 7200,
    depositAmountCents: 2400,
  ),
);

// Advance through the pipeline — illegal jumps are rejected.
await repository.recordDeposit(
  order.id,
  amountCents: 2400,
  paidAt: DateTime.now(),
);
await repository.advanceFulfillmentStatus(order.id, FulfillmentStatus.inProduction);

Observability and privacy

Repository implementations accept an optional KcLogger from core. Failed and rejected write operations are logged with the operation name, order ID, and status names only. Customer identity, addresses, money amounts, and deposit payment identifiers are never logged, and every context map is additionally passed through KcRedactor. There are no silent catch (_) {} blocks.

The WooCommerce meta-data mapping deliberately excludes the deposit transaction ID — it lives on PaymentResult alone. See the class-level documentation on WooCommerceOrderMapper for the complete key table.

Additional information

Part of the kell_creations_apps monorepo. Run the package tests with flutter test from this directory, or the whole suite with ./tools/run_all_tests.sh --analyze from kell_creations_apps/.