Repository navigation
Checklist mode for when the supermarket API is down - #447
Merged
Merged
Conversation
The API answers an Akamai 503 HTML page during its outage, and process_response_body raised a raw Poison.SyntaxError over it. Decode failure now keeps the body and process_response raises Supermarket.Error naming the status and the start of the body, so MCP tools and resolvers can report what actually came back. The fake can answer the same page via POST /__down and /__up. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
A `setting` row holds the shopping mode: "ah" keeps syncing the plan into the supermarket basket, "checklist" serves the same computed list from the database instead, so planning, ordering and reading the list keep working while the supermarket API is unreachable. `checklist_item` stores which ingredients are ticked off; Order overlays them onto the line and closing the order clears them. Switching back to "ah" pushes the accumulated list into the basket and reports whether that worked; a still-down supermarket does not block the switch. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Order gains a `mode` field, OrderItem a `checked` field, and the mutations setMode and checkItem drive them. A failed push back to the supermarket answers as a mutation error that still names the switch. Both mutations publish order_changed so open clients catch up. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The grocery agent switches modes and ticks items over the same tools: set_mode ah|checklist reports pushed_to_supermarket, check_item ticks an ingredient on or off, and get_shopping_list reports the mode and each item's checked state. Both writes publish order_changed; the payload is a placeholder since the subscription re-resolves the order. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In checklist mode each shopping-list row leads with a check circle that ticks the item off through checkItem, and ticked rows dim and strike through. A "Naar checklist" / "Naar supermarkt" line under the delivery day switches modes through setMode; in checklist mode the close-out button reads "Boodschappen gedaan". Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
reset-plan now also restores ah mode and drops the ticks, both rows a test would otherwise leave behind. The new spec switches to checklist mode over MCP, takes the supermarket fake down, ticks an item in the app and reads the same state back over MCP. The shop screenshots carry the extra mode line in the heading. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The tool table names set_mode and check_item, and the notes explain what get_shopping_list's mode field means and what switching back to the supermarket does with the accumulated list. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
The supermarket API is down (Akamai 503 HTML on every endpoint), which broke planning and the shopping list. Picape now has a second place the list can live, switched by a
settingrow:ah— unchanged: the plan syncs into the supermarket basket.checklist— the same computed list (planned recipes merged with manual quantities) served straight from the database. No supermarket call happens on the read path;Order.currentbuilds the line viaLineFromDband overlays the ticks.Six commits:
Poison.SyntaxError;Supermarket.Errornames the status and the first 200 chars of the body, so MCP tool calls and GraphQL report what came back instead of crashing. The fake can serve the same page viaPOST /__down.setting+checklist_itemtables,Picape.Settings,Picape.Checklist(tick/untick, refused outside checklist mode),Order.set_mode/1. Switching back toahpushes the accumulated list into the basket and reportspushed_to_supermarket; a still-down supermarket does not block the switch, the next sync retries. Closing an order clears the ticks.Order.mode,OrderItem.checked,checkItem(ingredientId:, checked:),setMode(mode:), both publishingorder_changed.set_modeandcheck_itemtools;get_shopping_listnow returnsmodeand per-itemchecked. The tool descriptions spell out when to use them, so the grocery agent can fall over to checklist mode on its own.reset-planalso restores ah mode and clears ticks; a new spec drives the whole loop over MCP with the fake down, ticks in the UI, and reads the state back over MCP.Impact
Expected runtime effect: while
api.ah.nlkeeps answering 503, switching to checklist mode (one MCPset_modecall) restores the shopping list, planning and ticking without any supermarket call; switching back pushes the list into the basket.Test plan
mix check— 133 passed (15 new: checklist domain, outage handling, MCP surface)cd frontend && npm run check— ESLint, Prettier, graphql:check, 13/13 Jestbin/e2e— 89 passed / 10 skipped; new checklist spec runs on all three projectscc @adri
Generated with Devin