Engineering record — internal detail. The manual is authoritative for product behaviour.
Engineering2026-07-216 min read
Inventory review fixes
Design and plan for 21 issues found in an inventory subsystem audit: 5 critical, 3 type-safety, 3 performance, 6 medium, 4 low.
ForEngineer
Scope
A full audit of the inventory subsystem produced 21 findings across severity bands. The design pairs a required fix and acceptance criteria with each finding; the plan breaks execution into four checkpoints with per-task file paths, code, tests and verification commands.
| Band | Count | Representative issues |
|---|---|---|
| Critical | 5 | Soft-delete stock guards, negative-stock prevention, tenant-scoped policy consistency |
| Type safety | 3 | Schema drift between Drizzle inference and action payloads |
| Performance | 3 | Missing indexes, cache invalidation on mutation |
| Medium | 6 | Validation and role-gate gaps |
| Low | 4 | Cleanups |
Execution
- Checkpoint 1 — schema and policy migrations.
- Checkpoint 2 — business logic and stock guards.
- Checkpoint 3 — TypeScript correctness and test additions.
- Checkpoint 4 — AI integration and cleanup.
- Each task carries exact file paths, copy-paste code or SQL, the test to add, and the verification command.
Source records
- Design
- docs/superpowers/specs/2026-07-21-inventory-review-fixes-design.md
- Plan
- docs/superpowers/plans/2026-07-21-inventory-review-fixes-plan.md