Make supplement tracking read-only
Summary
- make the web and mobile supplement stack and dose history read-only
- remove manual supplement save and dose-recording procedures and persistence paths
- preserve provider-synced supplements, historical occurrences, safety content, and read APIs
Validation
pnpm lintpnpm typecheckpnpm tsc --noEmitcd packages/server && pnpm tsc --noEmitcd packages/web && pnpm tsc --noEmitpnpm test:changed— 22 files, 442 tests passed- focused web/mobile supplement tests — 7 tests passed
- retained
supplements.listrouter smoke — 1 test passed - supplement dose database integration — 2 tests passed
EXPO_PUBLIC_SENTRY_DSN=https://public-key@sentry.example/project-id pnpm knip
Integration note
The full Compose integration startup could not initialize Redpanda because the local host's asynchronous I/O event limit was exhausted. The approved service-minimal Postgres validation passed without changing production behavior, timeouts, or retry settings.
Summary by Sourcery
Make supplements read-only across web, mobile, and server by removing manual stack editing and dose-recording APIs while preserving provider-synced data and read-only views.
New Features:
- Expose supplements as read-only lists and occurrence histories on web and mobile, backed by existing provider-synced data.
Enhancements:
- Simplify SupplementsRepository to only support listing supplements and querying dose occurrences, removing unused write paths.
- Tighten supplement and dose-events tests to focus on read projections, cached refresh behavior, and provenance while keeping Postgres-backed validation.
- Refine UI copy for nutrition supplements pages and screens to emphasize synced, provider-recorded data rather than manual tracking.
Documentation:
- Add design and implementation plan documents describing the move to read-only supplements and the required code and testing changes.
Tests:
- Update web and mobile unit tests and Storybook stories to reflect read-only supplement behavior and ensure list/occurrence queries and integration coverage remain intact.
Summary by CodeRabbit
- Changes
- Supplement stacks are now view-only across web and mobile.
- Removed controls for adding, editing, deleting, reordering, and saving supplements.
- Dose history is view-only; recording “Taken” or “Skipped” doses is no longer available.
- Retained synced supplement details, nutrient information, safety context, historical records, loading states, errors, and empty states.
- Updated labels to clarify synced definitions and provider-recorded dose history.
Summary by cubic
Makes supplement tracking read-only across web and mobile by removing manual save and dose-recording. Previously users could edit stacks and record doses; now clients only read provider-synced supplements and dose occurrences. supplements.save and supplements.recordDose no longer exist; supplements.list items now include a stable id.
Changes
- Server (
packages/server): Removedsupplements.saveandsupplements.recordDoseprocedures and write persistence; retainedsupplements.listandsupplements.occurrences; addedidtosupplementSchemaand enforced in tests; introducedinsertSupplementDefinitionForTestto seed definitions in integration tests. - Web/Mobile (
packages/web,packages/mobile): Converted stack and history to query-and-render only; removed add/edit/reorder and take/skip controls; updated stories/tests to use onlysupplements.occurrencesand expectid; refined copy to emphasize synced, read-only data. - Tests/Docs: Pruned mutation tests and coverage; tightened router data coverage to list-only; added design and plan docs.
Required migration
- Stop calling
supplements.saveandsupplements.recordDose; these procedures were removed. - Remove client-side write paths for supplements and dose events; rely on provider sync for updates.
- If you validate
supplements.listitems, include theidfield.