Repository navigation
fix: keep expired food out of cooking decisions on iOS and PWA - #41
Open
1395490241lhj-code wants to merge 2 commits into
Open
1395490241lhj-code wants to merge 2 commits into
1395490241lhj-code wants to merge 2 commits into
Conversation
Expired inventory (remainingDays < 0) was treated as the most urgent "use first" food by every ranking and AI path: Home local ranking and AI prompts, the AI recipe form preselection, Special Plan, weekly menu, Quick Meal / Component Meal, the Kitchen AI inventory context, and on the PWA the expiring bonus, clean-fridge, recipe coverage, variants and AI inventory names. Expired rows still show in expiry alerts, but are no longer a cooking candidate, a use-first priority, an "already have it" match or AI inventory. Rows due today or within three days keep their priority. iOS: InventoryItem.isExpired; recipe-creation pools, AI recipe form preselection and the Quick Meal pool exclude it; the conversation context reports expired rows in a separate `expired` array. Prepared batches keep their own finish-by rule. PWA: inventory.js owns isExpiryTracked / isExpiredItem / isUseSoonItem / getCookableInventory (dry goods, eggs and milk are never judged by days), used by recipe coverage, clean-fridge, variants, the weekly AI payload and AI inventory names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Pages workflow's `npm audit --omit=dev --audit-level=high` gate started failing after GHSA-mrwp-f3q8-3g9p (high) was published against follow-redirects 1.16.0-1.16.1. The fix is inside axios's existing ^1.16.0 range, so only package-lock.json changes: follow-redirects 1.16.1 -> 1.16.2 main carries the same lockfile, so it would fail this gate too. Verified locally with the workflow's own steps: npm ci, npm test (2026 pass, 0 fail), validate:recipe-packs, validate:recipe-pack-data and the audit gate all exit 0. package.json is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expired inventory (
remainingDays < 0) was ranked as the most urgent "use first" food by every recipe recommendation, planning and AI path on iOS and the PWA. A spinach row five days past its date pushed recipes built on it to the top of Home, was pre-ticked in AI 做菜, was sent to AI as 临期食材, and on the PWA earned the largest expiring bonus with the reason "已过期,优先用".After this change an expired row still appears in expiry alerts, but it is never a cooking candidate, a use-first priority, an "already have it" match or AI inventory. Rows due today or within three days keep their priority. This was the top item of the 2026-11-01 read-only AI logic audit.
What changed
iOS
InventoryItem.isExpired.recipeCreationInventoryandrecipeCreationExpiringItemsexclude it, which covers Home local ranking, Home and Apple AI requests, AI 做菜, Special Plan and the weekly menu.expiringItems(alerts) is unchanged.QuickMealCandidate.pooldrops expired inventory, covering Quick Meal and Component Meal. Prepared batches keep their own rule, because their date is the member's finish-by plan.availableandexpiringinto a newexpiredarray. The context is not persisted.PWA
inventory.jsnow ownsisExpiryTracked,isExpiredItem,isUseSoonItemandgetCookableInventory. Dry goods, 鸡蛋 and 牛奶 are never judged by days, as before.Tests
InventoryItemKindTests,ConversationDomainToolsTestsandQuickMealCandidateTests, each watched failing before the fix.ConversationContextAssemblerTests: two fixtures used expired rows as the "most urgent" example. They now use today and soon rows with the same ordering and truncation assertions, and one asserts the newexpiredarray.test/expired-food-priority.test.mjs(11 tests).Validation
KitchenManagerTestson the final tree, xcodebuild fallback on an iOS simulator: 2856 run, 0 failed, 5 skipped.node --test: 1678 run, 1665 passed, 13 failed. The same 12 files fail on the base tree in the same local environment becauseexpressandopenaiare not installed there; no new failure.Known limits
codex/km-prepared-workflowtree edits the same iOS files, so integrating that work will need a merge.🤖 Generated with Claude Code