Repository navigation
feat(inventory): supplies stock and recipe BOM depletion - #821
Conversation
|
Warning Review limit reachedNext included review available in 52 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (31)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
SummaryCoverage spans core inventory and recipe-order business behavior, including normal stock receipts and order processing, unit conversion, negative stock, audit attribution, validation, rollback, and duplicate-request handling. The exercised flows include both happy paths and edge or adversarial cases around invalid inputs, insufficient stock, concurrent updates, and preserving prior valid data. Safe to merge — the run reports no regressions or PR-attributable failures, and the exercised inventory, ordering, validation, and rollback behaviors remain healthy. Some order-related checks were blocked by local environment setup, but those are coverage limitations rather than merge-blocking product failures. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |
|
SummaryCoverage spans core order and inventory behavior, including recipe-based stock changes, cancellation and restoration rules, recipe management, database upgrades, unit validation, and protection against duplicate or invalid operations. It includes normal business flows, boundary and negative cases, lifecycle consistency, permissions, and transactional safety across product and ingredient inventory. Safe to merge — the run found no PR-attributable regressions or unresolved failures, and the exercised business logic and edge cases behaved as expected. Environment-blocked checks and source-based confirmations are flags for later validation, not merge blockers for this PR. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |
d34614d to
c67b5a7
Compare
Commit: SummaryCoverage spans order creation and inventory effects, cancellation, refunds, manual stock changes, unit conversion, recipe lifecycle and validation, authorization boundaries, and protection of recipe-linked stock. The exercised behavior is broadly healthy across normal business flows, edge cases, and adversarial permission checks, with several UI workflows unable to run because the local application was unavailable or not built. Safe to merge — no failures were attributable to this PR, with no regressions, new failures, or previously flagged failures still present. The environment-blocked workflows are unrelated caveats rather than merge blockers. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |
d8f2313 to
4bb23c4
Compare
Implements Supplies Stock (#768) and Recipe/BOM Depletion (#769): - Supplies CRUD with signed supply_movements ledger (receive, count, adjustment, waste); negative stock allowed and never blocks orders - Metric unit conversions (each/g/kg/ml/l) with cross-dimension rejection - Recipes/BOM per product with yield scaling; depletion at order creation and item append via immutable order_items.recipe_snapshot - Pending item/order cancel restores snapshot amounts; void after prep and refunds do not restore (waste); item restore re-depletes - /inventory page (Supplies, Recipes, Movements tabs), owner/manager only - Migrations v87 (supplies/recipes tables) and v88 (recipe_snapshot column) - Docs: API.md, roles-and-permissions.md, business-decisions.md - Tests: units, supplies-service, recipe-order-lifecycle (incl. snapshot immutability); registered in npm test chain
4bb23c4 to
0d499a5
Compare
Commit: SummaryCoverage spans core inventory and order flows, including recipe-based stock changes, historical cancellation and restoration, unit conversion, validation, persistence, and duplicate-request handling. It also exercises edge and abuse cases such as unauthorized access, invalid inputs, failed multi-item orders, negative stock, and safe voiding, with the application behavior broadly healthy. Safe to merge — no regressions, new failures, or previously flagged failures are attributable to this PR, and the exercised business rules and protection against invalid or duplicate operations behaved as expected. The inability to fully exercise some inventory screens is an environment limitation rather than a PR-related merge blocker. Tests run by Ito
Tip Reply with @itoqa to send us feedback on this test run. |

Summary
Implements Supplies Stock (#768) and Recipe/BOM Depletion (#769) as one milestone.
Supplies stock
supplies+supply_movementstables (migration v88) with a signed ledger:receive,count,adjustment,waste, plusrecipe_depletion/recipe_restoreeach/g/kg/ml/l); cross-dimension conversions rejected with 400POST /api/supplies/:id/movementsfor manual movements; cursor-paginatedGET /api/supplies/movementsRecipe/BOM depletion
recipes+recipe_itemstables (migration v88);order_items.recipe_snapshot(migration v89)order_quantity / yield_quantityin_progress/ready/completed) does not restore supplies (kitchen waste)track_inventory) and recipe depletion run independently on the same productUI
/inventoryroute (sidebar,ROLE_ACCESS.ownerManager) with Supplies / Recipes / Movements tabsinventoryManagecapabilityDocs
docs/API.md,docs/roles-and-permissions.md,docs/business-decisions.md(negative stock, void=waste, snapshot rules)Design decisions
POST /api/supplies/:id/movements(spec said/adjust);DELETE /api/recipes/product/:productId(spec said/:id) - frontend and docs aligned to implementationPOST /api/orders/from-cartin this codebase; depletion is wired into the real creation paths:POST /api/ordersandPOST /api/orders/:id/itemssaveRecipe/deleteRecipewrapped inwithTxnto avoid partial item wipesTests
npm run test:unitsnpm run test:supplies-servicenpm run test:recipe-order-lifecyclenpm run test:backupnpm run test:upgrade-pathnpm run test:schema-healthnpm run test:inventory-ledgernpm run test:translationsnpm run i18n:checknpm run lintnpm run buildnpm run build:frontend/inventoryexported)npm testNot run:
npm run test:e2e:browser(no new Playwright specs; backend + unit coverage exercised the lifecycle end-to-end via HTTP).Known limitations / follow-ups
SUPPLY_UNITSlist exists in backend (main/services/units.ts), frontend page, and SQLCHECKconstraints; backend remains authoritative (400 on unknown units). Could move the constant toshared/laterbase_unitis immutable after creation (by design); changing a unit would require a data migrationCloses #768, closes #769