# Checkpoint 1 (sandbox session)

## Done (files in repo)
sql/001_core.sql, 002_reference_data.sql; src/ Db (Connection, Migrator, Tx), Support (Money, PaymentStatus), Access/BrandScope,
Customers (PhoneNormalizer, CustomerResolver), OrderCodes (JournalSink, FileJournalSink, JournalVerifier, OrderCodeService, Recovery),
Orders/OrderService, Payments/PaymentService, Reporting (Reports, Reconciler), Exceptions; tests (46) + parallel workers.

## Tests actually run (sandbox MariaDB 10.11, PHP 8.3, PHPUnit 9.6): 46 tests, 282 assertions, all passed.
Covers: phone normalization; journal-ack-before-claim; pool exhaustion fails closed; flip rules + retirement; no delete/reissue at DB level;
parallel order creation (8 procs x 40); same-phone race (12 procs); cutover under load; refund/payment races; golden financial dataset
(cancelled/returned, voids, refunds, credit, brand scoping); reconciler fault detection; composite-FK brand integrity; CHECKs;
real mysqldump restore + journal quarantine; tampered/truncated journal rejected.

## NOT verified / not built
Any host or Phase 0 item; MySQL (only MariaDB tried); Laravel app, Livewire UI, auth/users/roles, designs/uploads, parser, retention/purge,
backups, offsite journal (FileJournalSink is local-only), Pathao. FileJournalSink proves nothing about offsite durability.

## Design consequences found while building (need to be carried into the plan)
1. Seven-digit pool must be journaled and reserved BEFORE the flip (flip refuses otherwise, even when forced at 85%).
2. After a restore, every restored 'reserved' code is quarantined too (claim state after the backup is unknown).
3. Journal truncation is detected only if the database knows a batch the journal lacks; tail loss beyond the last DB-known batch is residual risk.
4. The order-code guarantee stays conditional (offsite ack durable, journal intact, restore procedure followed).

## Next task
Laravel scaffold + wiring (needs composer/Packagist access), then: users/roles/permissions + BrandAccess middleware, Livewire order form.
