chore(local): smoke check and local stack README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-11-26 16:32:35 +08:00
1 parent b3fcb2883a
commit d72f48cbc0
5 files changed
+102 -5

No files matched your search

@@ -50,7 +50,11 @@ What Tastefully looks like today (commit `8bd93d15`):
- **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.
8. **Smoke check is `local/smoke.sh`.** It makes three calls and exits non-zero, naming the failing call, if any of them fails:
1. Admin login: `POST /auth/authenticate` on the gateway (auth → system → MySQL).
2. `GET /counter/event/findCurrentEvent` on the gateway, with the admin token (counter → MySQL).
3. `GET /api/public/messages/en_US` on mobile-api (mobile-api → gateway → system → MySQL).
- The originally planned `GET /api/event/upcomingEvent` returns a hardcoded URL and never reaches a service. mobile-api has no public endpoint backed by counter; its counter calls need a member token. That is why the counter call goes through the gateway directly.
9. **Dropped-service references.** HTTP calls to dropped services are strings; they compile and only fail if called, so they stay. Remove only these:
- gateway routes whose `uri` points at a dropped service (bonus, payment, inventory, stockist, wallet and similar);
@@ -65,13 +65,13 @@ The repository SHALL provide a documented command that deletes local data and re
### Requirement: End-to-end smoke check
The repository SHALL include a smoke check that calls a public mobile-api endpoint through the local stack and confirms a successful response backed by services-counter and MySQL.
The repository SHALL include a smoke check that logs in as the seeded admin through the gateway, reads from services-counter through the gateway, and calls a public mobile-api endpoint, confirming each succeeds against MySQL.
#### Scenario: Smoke check passes on a healthy stack
- **GIVEN** the stack is running and seeded
- **WHEN** the developer runs the smoke check
- **THEN** it exits with status 0 and prints the endpoint's HTTP status 200
- **THEN** it exits with status 0 and prints HTTP status 200 for each call
#### Scenario: Smoke check fails loudly
@@ -24,11 +24,11 @@ Run serially: every group touches build files or shared config.
- [x] 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.
- [x] 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. Result: `POST /auth/authenticate` through the gateway (`api-key` header) returns a JWT for `admin` / `colite-dev-admin`. A wrong password returns 200 with an empty body, which is existing Tastefully behaviour. MySQL runs with `--log-bin-trust-function-creators=1 --innodb-strict-mode=OFF` to load the dumped schema, and its healthcheck uses TCP so services wait for seeding to finish.
- [ ] 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.
- [ ] 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 rebuild one service and attach a debugger inside the stack. (This replaces the planned "run one service from an IDE": services address each other by container name, so a service outside Docker cannot join the stack.) 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.
## 5. Smoke check
- [ ] 5.1 Add `local/smoke.sh` (design decision 8). Verify on a healthy stack: exit 0 and prints `200`. Then `docker compose stop service-counter`: exit non-zero, with the failing URL printed.
- [x] 5.1 Add `local/smoke.sh` (design decision 8). Verify on a healthy stack: exit 0 and prints `200`. Then `docker compose stop service-counter`: exit non-zero, with the failing URL printed.
- [ ] 5.2 Integration: from a fresh clone in a scratch directory, run `mvn -T 1C verify`, `local/up.sh` and `local/smoke.sh`. Verify: all three succeed and `docker compose ps` shows every service running. Paste the outputs into the PR description.
## Workflow follow-up