Skip to content

fix(catalog): resolve allergens through nested subassemblies - #53

Merged
puemos merged 1 commit into
mainfrom
feat/49-subassembly-allergens
Oct 7, 2026
Merged

puemos merged 1 commit into
mainfrom
feat/49-subassembly-allergens

Conversation

@puemos

@puemos puemos commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Products now derive allergens from the same recursively flattened material list used for batch snapshots. Allergens in subassemblies are included, sorted, and deduplicated, keeping finished-product and batch-label declarations consistent.

The shared traversal now loads components at every depth and tracks the root product in its cycle guard. Previously nested BOMs were fetched without their components, silently omitting nested materials from the persisted rollup. This also makes nested material quantities available to batch consumption and ingredient snapshots.

Closes #49.

Validation:

  • GitHub CI passed, including application checks and the SeaweedFS/MinIO storage integration.
  • Full local suite: 443 passed, 1 skipped (existing e2e exclusions).
  • Tests cover multiple nesting levels, shared components, exact rollup quantities, absent active recipes, cycles, and frozen batch declarations after allergen edits.
  • Manually used the running local app in the Codex in-app browser: added a blend containing Whole Milk to a finished product's recipe; verified Milk on product details; created, started, and completed a batch; confirmed 20 ml consumed from the milk lot and WHOLE MILK / MILK on its label.

@puemos
puemos merged commit 1d6c388 into main Oct 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allergens are dropped when a BOM component is a sub-assembly (component_type: :product)

1 participant