Repository navigation
feat(data): add shipped-bundle safety invariants with a claims-vs-gate sweep - #194
Conversation
…olations Linux-side, read-only check proving the four shipped diet claims never admit a recipe the household safety gate would block, for every recipe and every screened household (10 allergen groups + 4 diets singly, 11 pinned multi-restriction households). Rules: claims true only when compile_bundle.derive_claim proves them; vegan implies vegetarian and dairy_free; the claims-vs-screen sweep; thermometer checks for cooked raw animal lines with named ready-to-eat exemptions; timers within 1 s..12 h. Tables mirror HouseholdSafetyGate.swift and a test fails on drift. The shipped bundle's 12 violations (5 unprovable claims, the rcp-000179 vegan lattice break, 6 sweep rows) and the 15 gluten_free oat recipes are pinned as strict expected failures — recorded for burst11-fridgeluck-catalog-rebuild to clear; oats remain Sam's call. Co-authored-by: Sam Gu <sgu07966@gmail.com>
…ck-safety-invariants
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Note Review skipped Codemetrics is installed on this repository, but it hasn't been added to your team yet. To enable AI code reviews for this repo, go to your dashboard and add FridgeLuck to your team's repositories. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What changed and why
Two new files; no existing file is touched.
data/recipes/tools/safety_invariants.py— a Linux-side, read-only proof over the shipped bundle (data/recipes/build/recipes-v2.json) that the four per-recipe diet claims (vegetarian,vegan,gluten_free,dairy_free) never admit a recipe the app'sHouseholdSafetyGatewould block for a screened household. Five rules:compile_bundle.derive_claimover the lines' composition classes — imported from the compiler, one definition, never re-derived. The compiler keeps authored True claims it cannot verify (derive → None) andvalidate_bundlefails only true-vs-false contradictions, so a true claim over anunknownline ships silently today.milk→dairy_free,wheat_gluten→gluten_free,vegetarian→vegetarian,vegan→vegan); households restricting anything else fail closed on the claim path, exactly like the gate fails closed. Keto never claim-admits (no class expresses keto; the gate limit is unset).The gate tables mirror
HouseholdSafetyGate.swift; a test parses that file's enum lines and fails on drift (including the keto limit no longer being nil, or the unknown-composition fail-closed screen disappearing). A recorded-but-never-decided advisory listsgluten_freerecipes using oats, which the bundle classes as plainplant— certified gluten-free oats are Sam's call.data/recipes/tools/tests/test_safety_invariants.py— planted failures for each rule (synthetic bundles), drift mutation tests over the real Swift file, and strict pins of the shipped bundle's current violations. The pins fail when a listed violation disappears or a new one appears, soburst11-fridgeluck-catalog-rebuild(which fixes the compiler and rebuilds the bundle) has a ready-made tripwire; when it clears the list, it updates the pins in the same PR.Pinned findings (bundle at alpha
ef236fcd, re-verified unchanged at merged headd4d79df9) — 12 violations:unknownlines):rcp-000179vegan (chipotle),rcp-000190dairy_free (tamari),rcp-000207vegetarian (baking_powder,sugar),rcp-000532vegetarian + dairy_free (sugar).rcp-000179claims vegan without vegetarian/dairy_free.milk× {000190, 000532},vegetarian× {000207, 000532},vegan× {000179},milk+vegetarian× {000532} — all blocked byunknown composition.gluten_freeoat recipes (rcp-000167…rcp-000934), recorded for Sam, exit-code neutral.How I checked it
python3 -m pytest data/recipes/tools/tests -q→ 76 passed, 1 skipped (the skip is pre-existing intest_pipeline.py), at the work commit and again at the merged head.python3 -I data/recipes/tools/safety_invariants.py→ exit 1 with exactly the 12 pinned violations + 15-item oats advisory (the expected, pinned failing state); the CLI test also proves exit 0 on a synthetic clean bundle and exit 2 on a missing file.HouseholdSafetyGate.swift(remapped group class, dropped group case, dropped diet case, changed veganblockedClasses, keto limit set non-nil, unknown screen removed) are all caught.origin/alpha(f812dfde, 9 commits of guest-meal-planning work, zero file overlap) →d4d79df9; zero conflicts; tests and pins re-verified identical at the merge.git diff origin/alpha HEAD --statshows exactly the two new files (+808 lines);grepfor merge conflict markers: none.What I couldn't check
HouseholdSafetyGate.screencomes from reading the Swift, not running it. The repo's hosted macOS CI covers the app build.Assumptions
ketoMaxCarbsPerServingGramsstays nil (drift-checked).d4d79df9. PR feat(data): repair catalog identity pins and aliases for pantry reach #192 also ownsdata/recipes/build/recipes-v2.json; if it lands first, this PR's pins re-validate — a changed bundle is precisely what the pins exist to catch.Human author: Sam Gu (sgu07966@gmail.com)
🔗 Obvious Project · 🧵 Obvious Thread · 🔀 Obvious PR Artifact