WFDASH-WEBAPP/docs/superpowers
Dave ab16404003 fix(giellie): route stock_items.adjust through the audited write path
`stock_items.adjust` wrote its `stock_ledger` row with no acting user
(`created_by: ""`), and it updated `current_qty` with no compensation —
the same orphan-ledger shape the new quantity tool removed. The docs
advertise this tool, so it is a load-bearing write path.

- `updateStockItemsQuantities` takes optional `reason`, `referenceType`,
  `referenceId` and `notes` overrides. The defaults are unchanged
  ("adjustment", "manual", the service's own note), so the /stock page
  and the agent write exactly what they wrote before.
- The adjust handler now requires `actor.id` (the same 15-char check and
  error style as `stock_items.set_quantities`), reads the row's current
  quantity, turns the signed delta into an absolute target and calls the
  service. Attribution, ledger-first ordering and the compensating
  reversal row come from the service instead of being duplicated here.
- The caller's `reason` and `notes` survive the conversion, and a
  negative resulting quantity is allowed — the till oversells on purpose.
- The tool description marks the tool as superseded for quantity work
  and points at `stock_items.set_quantities`.
2026-11-06 08:01:10 +02:00
..
plans docs(plan): the policy dry-run rule must match the route 2026-11-06 00:24:50 +02:00
smoke-tests docs(item-history): add manual smoke-test checklist for 4 env-var modes 2026-07-29 15:16:40 +02:00
specs fix(giellie): route stock_items.adjust through the audited write path 2026-11-06 08:01:10 +02:00