Commit Graph
2 Commits
Author SHA1 Message Date
steveandClaude Opus 4.8 02e66f462f Address Gadfly review on #12: helper naming + FK-backstop test
Build image / build-and-push (push) Successful in 5s
- Rename test helper intPtr → ptrInt to match the package's ptrBool sibling
  (2/5 reviewers flagged the naming inconsistency).
- Add a store-level test that drives DeletePlant into the ON DELETE RESTRICT
  foreign key so the isForeignKeyViolation string-match (→ ErrPlantInUse) is
  pinned; a driver-message change now fails here, not as a prod 500.

Skipped (advisory, non-blocking): the parseNullableInt/parseNullableString
generic-helper refactor (cosmetic, touches working code) and the documented
LIMIT 5000 backstop.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdQpdYYsTgtkJBxbcpAszi
2026-07-18 21:47:54 -04:00
steveandClaude Opus 4.8 78dbadf95c Add plant catalog backend: CRUD + seeded built-ins (#12)
Build image / build-and-push (push) Successful in 5s
Gadfly review (reusable) / review (pull_request) Successful in 10m32s
Adversarial Review (Gadfly) / review (pull_request) Successful in 10m32s
Extends the plants store (which had only the /full read side) with full
catalog CRUD, adds a service layer with visibility/immutability rules, REST
endpoints, and a seed migration of ~32 built-ins.

- 0003_seed_plants.sql: 32 built-in plants (owner_id NULL, read-only), seeded
  once by the version-tracked migration runner.
- store: ListPlantsForActor (built-ins + own), Get/Create/Update/Delete +
  CountPlantingsForPlant; isForeignKeyViolation backstop for the RESTRICT FK.
- service: built-ins are read-only (ErrForbidden); another user's plants are
  invisible (ErrNotFound); delete of a referenced plant → ErrPlantInUse (409);
  validation mirrors the schema (category enum, spacing>0, hex color, icon).
- api: GET,POST /plants and PATCH,DELETE /plants/:id with the version guard.
- Made the migration-count store tests derive their expectation from the files
  so future migrations don't break them.

Service + API tests cover visibility, built-in immutability, validation,
version conflict, and delete-in-use.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdQpdYYsTgtkJBxbcpAszi
2026-07-18 21:33:12 -04:00