tag-registry-product-link: seed 100 real preset IDs (seed-registry cmd), products/orders schema + tag linkage, fix case-sensitive tag-code bind
This commit is contained in:
@@ -12,7 +12,7 @@ The system SHALL provide a `seed-registry` command that reads `db/preset_tag_ids
|
||||
- **THEN** no duplicate `tag_code` errors occur and the registry is unchanged
|
||||
|
||||
### Requirement: Registry-only claimable codes
|
||||
Only codes present in the `tags` table (the registry) SHALL be claimable. A code not in the registry SHALL be rejected (existing bind behaviour).
|
||||
Only codes present in the `tags` table (the registry) SHALL be claimable. A code not in the registry SHALL be rejected (existing bind behaviour). Tag codes SHALL be treated as case-sensitive (preset base64 IDs are mixed-case; the bind handler SHALL NOT normalise case).
|
||||
|
||||
#### Scenario: Real ID claimed
|
||||
- **WHEN** an owner enters one of the 100 real preset IDs
|
||||
@@ -22,6 +22,10 @@ Only codes present in the `tags` table (the registry) SHALL be claimable. A code
|
||||
- **WHEN** an owner enters a made-up code
|
||||
- **THEN** binding is rejected with "Tag not found, or already claimed"
|
||||
|
||||
#### Scenario: Mixed-case ID not uppercased
|
||||
- **WHEN** an owner enters a preset ID containing lowercase letters
|
||||
- **THEN** the bind matches the exact (case-sensitive) registry row
|
||||
|
||||
### Requirement: DEV test codes coexist
|
||||
The existing `TEST000001..25` seed SHALL remain available for local development, separate from the real registry seed.
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
## 1. Schema
|
||||
|
||||
- [ ] 1.1 `db/schema.sql`: add `products` and `orders` tables; add idempotent `ALTER TABLE tags ADD COLUMN IF NOT EXISTS product_id BIGINT REFERENCES products(id)` and `order_id BIGINT REFERENCES orders(id)`; run `make db-up`
|
||||
- [ ] 1.2 `make generate` (sqlc adds `Product`/`Order` models, extends `Tag`); verify build
|
||||
- [x] 1.1 `db/schema.sql`: add `products` and `orders` tables; add idempotent `ALTER TABLE tags ADD COLUMN IF NOT EXISTS product_id BIGINT REFERENCES products(id)` and `order_id BIGINT REFERENCES orders(id)`; run `make db-up`
|
||||
- [x] 1.2 `make generate` (sqlc adds `Product`/`Order` models, extends `Tag`); verify build
|
||||
|
||||
## 2. Registry Seed
|
||||
|
||||
- [ ] 2.1 `frontend/cmd/seed-registry/main.go`: read `db/preset_tag_ids.txt` (skip comment lines), `InsertTag` each ID, skip unique-violations, report counts
|
||||
- [ ] 2.2 Makefile `seed-registry` target (cwd frontend, schema path aware); README note
|
||||
- [x] 2.1 `frontend/cmd/seed-registry/main.go`: read `db/preset_tag_ids.txt` (skip comment lines), `InsertTag` each ID, skip unique-violations, report counts
|
||||
- [x] 2.2 Makefile `seed-registry` target (cwd frontend, schema path aware); README note
|
||||
|
||||
## 3. Verification
|
||||
|
||||
- [ ] 3.1 `make seed-registry` on fresh DB → 100 tags; re-run → no errors (idempotent)
|
||||
- [ ] 3.2 Bind a real ID (register owner, add tag with one of the 100 IDs) → bound; made-up code → rejected
|
||||
- [ ] 3.3 Existing suites still pass (`/tmp/verify.sh` Phase 1 + `/tmp/verify2.sh` Phase 2) with TEST codes
|
||||
- [ ] 3.4 `openspec validate tag-registry-product-link`; commit
|
||||
- [x] 3.1 `make seed-registry` on fresh DB → 100 tags; re-run → no errors (idempotent)
|
||||
- [x] 3.2 Bind a real ID (register owner, add tag with one of the 100 IDs) → bound; made-up code → rejected
|
||||
- [x] 3.3 Existing suites still pass (`/tmp/verify.sh` Phase 1 + `/tmp/verify2.sh` Phase 2) with TEST codes
|
||||
- [x] 3.4 `openspec validate tag-registry-product-link`; commit
|
||||
|
||||
Reference in New Issue
Block a user