Supply run API, item toggles and the Push to Calendar hook (Feature 17) #133

2 Commits
Author SHA1 Message Date
dev_agentandClaude Opus 5.5 a31bbce1dc Make the Supply run from the plan revision Push to Calendar pushed
CI / ci (pull_request) Successful in 5m40s
CI / ci (push) Successful in 5m6s
A plan edit landing between a successful Push and the Generate that
followed it made the Supply run from the newer plan while the push answer
reported supply_run generated, so the list could hold a dinner Calendar
never showed (MQ-133-01).

Push now returns the revision it pushed, and the push hook calls
shopping.GeneratePushed, which checks inside its transaction that the
week's plan is still at that revision (week_plans.revision, as the draft
path does) and otherwise fails with ErrPlanChanged, leaving the Supply run
as it was. The push answer then reports supply_run failed with error
plan_changed (retryable: push again), logged as a warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:59:16 -04:00
dev_agentandClaude Opus 5.5 6aa5113488 Add the Supply run API, item toggles and the Push to Calendar hook
CI / ci (push) Successful in 4m51s
CI / ci (pull_request) Successful in 4m49s
GET /api/v1/shopping/{weekStart} reads the week's Supply run with its
week label, counts and groups by plan day; POST
/api/v1/shopping/{weekStart}/generate makes or remakes it through
shopping.Generate; PATCH /api/v1/shopping/items/{id} sets an item's
needed flag and answers with the list's new counts, 409 archived once
the list is in the Supply archive and 404 for an unknown item.

A successful Push to Calendar now makes the pushed week's Supply run.
Generation runs after the push is recorded and never fails or undoes
it: the 200 answer reports supply_run generated, archived or failed,
and a failure is logged as an error.

Maestro task d076480c-6c59-4c57-9023-6941badb4520.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 04:28:16 -04:00