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:
@@ -32,6 +32,8 @@ pnpm --filter @vmall/<改动过的前端> build
|
|||||||
```
|
```
|
||||||
|
|
||||||
- 修 bug:先复现,修完确认复现不再触发;有价值的场景补成集成测试(放 `apps/api/tests/`,复用 `tests/common/mod.rs` 夹具)。
|
- 修 bug:先复现,修完确认复现不再触发;有价值的场景补成集成测试(放 `apps/api/tests/`,复用 `tests/common/mod.rs` 夹具)。
|
||||||
|
- 测试隔离:测试库不截断,夹具靠唯一 slug/email。**断言不要假设全局集合为空或恰好 N**——只对自己创建的 id 过滤后断言。新增列表/发现类接口时,`cargo test -p vmall-api` 需**连跑两次**都全绿(单次可能只是库恰好干净)。
|
||||||
|
- 管道跑测试时注意退出码:`cargo test | grep` 返回的是 grep 的状态,用 `set -o pipefail` 或显式取 `$?`,否则会漏掉 `FAILED`。
|
||||||
- UI 变更:起 dev server 用浏览器实际点一遍改动路径,视觉确认才算完成。
|
- UI 变更:起 dev server 用浏览器实际点一遍改动路径,视觉确认才算完成。
|
||||||
- 不要跑与改动无关的全仓命令(`pnpm -r build`、lint 全仓等)。
|
- 不要跑与改动无关的全仓命令(`pnpm -r build`、lint 全仓等)。
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,13 @@ transaction rules before implementation.
|
|||||||
- [ ] **Withdrawals / 提现** — model a payout request with account, amount minor, fee minor,
|
- [ ] **Withdrawals / 提现** — model a payout request with account, amount minor, fee minor,
|
||||||
destination snapshot, and `requested → approved | rejected | paid` transitions. Funds must
|
destination snapshot, and `requested → approved | rejected | paid` transitions. Funds must
|
||||||
be frozen and released or debited atomically with the transition.
|
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
|
## Deliberately out of scope — does not block deleting this file
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user