feat: base food catalog (v1 phases 1-2) — schema, admin CLI, online endpoints, picker + barcode UI#247
Open
OrellBuehler wants to merge 18 commits into
Open
feat: base food catalog (v1 phases 1-2) — schema, admin CLI, online endpoints, picker + barcode UI#247OrellBuehler wants to merge 18 commits into
OrellBuehler wants to merge 18 commits into
Conversation
13-task plan covering Phase 1 (schema, dataset JSONL Zod, import/grant CLIs, pg_trgm GIN, drift guard, fixture) and Phase 2 (online search/barcode/save endpoints, picker source-badge, AddFoodModal pick-to-log, DayLog barcode flow). Proves end-to-end against a JSONL fixture; OFF/Migros adapters are follow-on plans, Coop is v1.1.
…og instantiate through it Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
Playwright E2E Results✅ All tests passed |
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
Ships v1 Phases 1-2 of the access-gated base food catalog (Swiss retail data). Lays the durable foundation users can pick from instead of hand-entering foods OFF lacks.
catalog_datasets,catalog_foods,catalog_access) in migration0037with hand-appendedpg_trgmGIN; drift-guard test enforces three-way equality withfoodsandALL_NUTRIENTS.scripts/catalog.ts) —import(batched insert + GIN drop/recreate + upsert-by-key, grants survive re-import),grant/revoke/list.src/lib/server/catalog/queries.ts) —catalogSearch,catalogByBarcode,instantiateCatalogFood. Access enforced authoritatively via SQLINNER JOIN catalog_access; copy-on-use goes throughcreateFood(refactored to accept an optionaldbOverride).GET /api/catalog/search,GET /api/catalog/barcode/{code},POST /api/catalog/{id}/save. Declared inopenapi.ts, regenerateddocs/openapi.json+src/lib/api/generated/schema.d.ts. CI'sapi:checkgate is clean.FoodPickersurfaces online catalog results with a source badge below local Dexie results;AddFoodModalhandles the newcatalogPickerSelectionvariant (pick → save → log);DayLogbarcode scan now checks personal → catalog → OFF..gitignore(data/catalog/,tests/fixtures/catalog/bad.jsonl) + a local prek hook rejecting committeddata/catalog/*.jsonl.src/lib/server/nutrient-extract.ts; OFF now uses it (behavior-preserving).Catalog rows are reached only through
/api/catalog/*and never enter/api/foodsor the Dexie offline mirror; an isolation integration test regression-locks this invariant.Out of scope (follow-on PRs)
bun run securityflags 3 transitive HIGHs (fast-uri3.1.0,kysely0.27.6,minimatch). This branch added zero dependencies; these predatemain. Handle in a dedicated deps-bump PR.Spec & plan
docs/superpowers/specs/2026-05-18-base-food-catalog-crawler-design.mddocs/superpowers/plans/2026-05-18-base-food-catalog-foundation-and-integration.mdTest plan
bun run checkexits 0bun run test— 1775/1775 passingbun run test:integration-db— 40/40 passing (catalog: schema 3, import/grant/revoke/list 4, endpoints + isolation 4)bun run api:checkexits 0 (CI's OpenAPI drift gate)