Skip to content

Conversation

oliveror
Copy link
Member

Changes

  • Replaced the generated "A homemade … recipe featuring flavorful ingredients…" filler with a hand-written description for each of the 51 demo recipes. Each was checked against the recipe's ingredients and steps (several earlier drafts claimed things like glazes or spices that are not in the recipe and were corrected). Seeding now throws if a recipe has no description.
  • Four demo taster accounts (sharing SEED_PASSWORD) give deterministic 3–5 star ratings to ~80 % of the public demo recipes, so Highest rated has data. Private recipes are not rated. Re-running the seed adds nothing.
  • The seed test checks descriptions and ratings.

Validation

Remaining work (needs the team / VM)

  • Delete the "4" test recipe from the production database.
  • Re-run npm run db:seed on the VM (it updates the descriptions in place and adds the ratings).

AI usage

Written with Claude Code (Anthropic) during the final-delivery review. The change was implemented and tested by the AI agent and pushed from my account. Please review the diff as you would any other contribution.

Refs #75

- Replace the generated "A homemade … recipe" filler with a hand-written
  description for each of the 51 demo recipes, checked against their
  ingredients and steps. Seeding now fails if a recipe has none.
- Add four demo taster accounts that give deterministic 3-5 star ratings
  to about 80 % of the public demo recipes, so Highest rated sorting has
  data. Private recipes are not rated. Re-running the seed adds nothing.

Not done here (needs the team and VM access): deleting the "4" test
recipe from production and re-running the seed on the VM.

Refs #75
@oliveror oliveror requested a review from a team as a code owner November 16, 2026 13:50
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes

A few issues worth addressing before merging, particularly around seed reliability and regression coverage:

  • seedData.ts:241–260 — Email conflicts can break seeding. ON CONFLICT DO NOTHING silently skips a taster if its email already exists under another ID, but ratings still reference the expected ID. This causes a foreign-key error and rolls back the entire seed. Consider detecting this conflict explicitly. Consider preventing registration of reserved demo addresses.

  • test-recipe-api.ts:914 — Description test checks input, not database. The assertion checks recipe.description from the seed data rather than the persisted value. It won't catch failures to update existing descriptions. Assert against the database value instead.

Review on #94:
- If another account already uses a taster address, the seed now skips
  that taster's ratings with a warning instead of failing a foreign key
  and rolling back the whole seed.
- Registration refuses the reserved demo addresses (demo@ and
  demo-taster-N@example.invalid), answered like an existing email.
- The seed test checks descriptions stored in the database, after first
  setting them to stale text, so it catches failed updates; it also
  covers a pre-existing account on a taster address.

Refs #75
@oliveror
Copy link
Member Author

Thanks, both fixed in the latest commit:

  • Email conflicts: after inserting a taster, the seed looks up who owns the address. If it is another account, that taster's ratings are skipped with a warning, so the seed no longer fails on the foreign key and rolls back. Registration now refuses the reserved demo addresses (demo@example.invalid, demo-taster-N@example.invalid) with the normal "email already exists" error (unit test added).
  • Description test: it now reads description from the database. Between the two seed runs it sets every demo description to stale text, then asserts the second run restored each one. The test also inserts an account on demo-taster-2@example.invalid before seeding and checks the seed succeeds without ratings from that address.

npm run check and test:api pass.

@oliveror oliveror merged commit 0d0eaf7 into dev Nov 16, 2026
2 checks passed
@oliveror oliveror deleted the chore/data-production-cleanup branch November 17, 2026 00:30
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants