docs: record the deferred promotion-window invariant and test-isolation rules

Add the shared promotion-window EXCLUDE-constraint idea to the deferred designs
so the flash/group overlap ordering problem has a recorded structural fix.

Note in AGENTS.md that suite assertions must be scoped to fixtures the test
created, that a list endpoint warrants two consecutive green runs, and that a
piped test command hides the real exit code.
This commit is contained in:
2026-09-18 13:11:37 +00:00
parent c93bff28b0
commit 705cbe249a
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -116,6 +116,13 @@ transaction rules before implementation.
- [ ] **Withdrawals / 提现** — model a payout request with account, amount minor, fee minor,
destination snapshot, and `requested → approved | rejected | paid` transitions. Funds must
be frozen and released or debited atomically with the transition.
- [ ] **Promotion window exclusivity as a database invariant** — flash sales and group buying
currently keep one SKU out of overlapping activity windows with cross-table queries, and the
flash-sales guard stays inert until the group-buying table exists. A shared
`promotion_windows(sku_id, kind, starts_at, ends_at)` table with
`EXCLUDE USING gist (sku_id WITH =, tstzrange(starts_at, ends_at) WITH &&)` would make an
overlap impossible to insert and remove the creation-order problem. Deferred because it
retrofits the archived flash-sales schema; revisit if a third timed activity type appears.
## Deliberately out of scope — does not block deleting this file