diff --git a/CLAUDE.md b/CLAUDE.md index fc55e92..3b024fb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -17,3 +17,5 @@ Pre-design. No code has been ported yet. Repo layout, module list and the portin - Admin screens call JSON admin APIs (`/api/admin/**`) in `mobile-api`. - New tables carry a company id so a later multi-company move is a migration, not a rebuild. - When porting a module, list the old screen's business rules first and turn them into tests before building the new screen. +- Exception to the SQL-placement rule: runnable local seed files live in `local/seed/` (loaded by docker-compose on an empty volume). Schema and DDL changes for real environments still go in the OpenSpec change folder. +- Never copy Tastefully customer data (members, users, attendance, orders) into this repo or a local database. Seeds use schema-only and reference-table dumps. diff --git a/openspec/changes/add-repo-foundation-local-stack/design.md b/openspec/changes/add-repo-foundation-local-stack/design.md index 4e81f2a..473c593 100644 --- a/openspec/changes/add-repo-foundation-local-stack/design.md +++ b/openspec/changes/add-repo-foundation-local-stack/design.md @@ -47,7 +47,8 @@ What Tastefully looks like today (commit `8bd93d15`): 2. `02-reference.sql`: reference-table rows (roles, modules/menus, system_property, location_hierarchy and other lookup tables, chosen per table). 3. `03-colite.sql`: one company and one admin user, with a bcrypt hash of a dev-only password documented in `local/README.md`. - Reset is `docker compose down -v`. - - **Location:** under the user's SQL-placement rule these live in this change's `sql/` folder. That folder moves when the change is archived, so a permanent compose mount needs `local/seed/` instead. This is pending the user's decision (see Open Questions). + - **Location:** `local/seed/`. Decided by the user: runnable dev seed files are a documented exception to the SQL-placement rule (see `CLAUDE.md`), because the change folder moves when the change is archived and would break the compose mount. + - **Source:** the user supplies a schema-only dump and a reference-table data dump, not a full dump. Customer data from Tastefully never enters this repo or the local database. 8. **Smoke check is `local/smoke.sh`.** It runs `curl -fsS` against `http://localhost:8080/api/event/upcomingEvent` (mobile-api → gateway → service-counter → MySQL), prints the status code, and exits non-zero on failure. The task confirms the endpoint is public; if it is not, the task picks another public counter-backed endpoint and records the choice here. @@ -67,7 +68,3 @@ What Tastefully looks like today (commit `8bd93d15`): ## Migration Plan None. This is a new repo with nothing deployed. Rollback is reverting the commits. - -## Open Questions - -- Where do the seed SQL files live permanently? Option A: this change's `sql/` folder, with the compose mount moved to the archive path at archive time. Option B, recommended: `local/seed/`, as a documented exception to the SQL-placement rule for executable dev fixtures. This changes only the file path in tasks 4.x. diff --git a/openspec/changes/add-repo-foundation-local-stack/tasks.md b/openspec/changes/add-repo-foundation-local-stack/tasks.md index 2c94f21..f245856 100644 --- a/openspec/changes/add-repo-foundation-local-stack/tasks.md +++ b/openspec/changes/add-repo-foundation-local-stack/tasks.md @@ -22,7 +22,7 @@ Run serially: every group touches build files or shared config. ## 4. Seed (needs the user's Tastefully dump) -- [ ] 4.1 Ask the user for the dump, giving them this exact command: `mysqldump --no-data --routines --triggers --skip-add-drop-table --databases service-system service-counter service-member service-log service-email > 01-schema.sql`, plus a data dump of an allow-list of reference tables. Build the allow-list from the services-system entities: role, module, system_property, location_hierarchy and the other lookup tables, each checked for personal data before it is listed. Put the files at the location the user chose in design Open Questions. Verify: grep the files for `INSERT INTO \`(member|user|event_attendance|orders)` and it is empty. +- [ ] 4.1 Ask the user for the dump, giving them this exact command: `mysqldump --no-data --routines --triggers --skip-add-drop-table --databases service-system service-counter service-member service-log service-email > 01-schema.sql`, plus a data dump of an allow-list of reference tables. Build the allow-list from the services-system entities: role, module, system_property, location_hierarchy and the other lookup tables, each checked for personal data before it is listed. Put the files in `local/seed/`. Verify: grep the files for `INSERT INTO \`(member|user|event_attendance|orders)` and it is empty. - [ ] 4.2 Write `03-colite.sql`: one company row and one admin user with the Administrator role, a bcrypt hash of the documented dev password, and the column set matching the dumped `user` table. Verify: after `docker compose down -v && local/up.sh`, `SELECT count(*) FROM \`service-system\`.user` returns 1. The admin can log in through `POST /auth/...` via the gateway (endpoint confirmed from services-auth) and gets a token. - [ ] 4.3 Write `local/README.md`: prerequisites (JDK 21, Maven, Docker, registry login), build/up, reset (`docker compose -f local/docker-compose.yml down -v`), the dev login, and how to run one service from an IDE (stop its container, run with profile `local` and `.env` exported). Verify: a second developer follows it on a clean clone without help. If no second developer is available, re-run the documented commands verbatim on a fresh clone in a scratch dir.