# Implementer — F-018 Cart module

## Summary
Implemented authenticated cart persistence that stores only product id, variant id and quantity, and recalculates totals/availability through injected `PricingService` and `InventoryService` on every read.

## Files changed
- `project/migrations/013_cart.js`
- `project/src/app/build-app.ts`
- `project/src/app/tests/cart.itest.ts`
- `project/src/modules/cart/**`
- `project/src/modules/inventory/index.ts`
- `project/src/modules/pricing/index.ts`

## Acceptance evidence
- AC1 price changed after add: `cart.itest.ts` adds item at one price, changes server price, then `GET /cart` returns recalculated totals.
- AC2 out of stock: `cart.itest.ts` sets stock to zero and verifies cart item is flagged unavailable.
- AC3 client price ignored: `cart.itest.ts` sends bogus price fields; response uses server-side pricing and `cart_items` has no price/tax/stock columns.
- `verify.sh`: passed.

## Commands run
- `cd project && npm run lint` — passed
- `cd project && npm run typecheck` — passed
- `cd project && npm run build` — passed
- `cd project && npm test` — passed; DB tests skipped without `TEST_DATABASE_URL`
- `cd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- cart.itest migrations.itest` — passed; 10 files, 42 tests
- `./scripts/verify.sh` — passed

## Notes
- Cart routes require authentication; no guest cart persistence in this slice.
- Cart imports only public pricing/inventory interfaces, not internals.
- Added public service factories in inventory/pricing module indexes for composition-root injection.
