Repository navigation
Commit 2cbe559
test(ui): live master-detail spec asserts the server stored the parent and child, not only that the batch was sent (#27759)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg4i9JiKjEjwtuVzd4gKy9hB)_
Fixes #27551
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:`Live E2E UI` 必跑的主从表单用例,原来只检查「点了创建后发出了 batch 请求」;现在还检查服务端回
2xx,并通过数据 API 把保存下来的项目(名称、客户、状态)和任务(指向该项目)读回来比对。
- 为什么改:实测 main 上第二个用例一直是「假绿」:它选了状态 `active`,而项目状态机只允许以 `planned` 创建,服务端回
400、什么都没存,用例照样通过。
- 风险与回滚:只改一个 e2e 文件,不碰产品代码、不改服务端鉴权;该步骤耗时实测反而从 29.0 秒降到约 25 秒。回滚 = revert
本 PR。
- 先看:`ui/e2e/live/master-detail.spec.ts` 的 `batchResults` / `readBack`
两个辅助函数,以及第二个用例改选 `planned` 的那一行。
- 两分钟验证:本 PR 的 `Live E2E UI` 检查为绿,日志里两个用例名为 "Create stores …" / "Create
with a task line stores …"。
- 需要你做的:无,席位落地。
## What changes
`ui/e2e/live/master-detail.spec.ts` only. Both tests now:
1. wait for the `POST /api/v1/batch` **response** the click on Create
provokes (replaces the discarded `waitForRequest` plus the fixed
`waitForTimeout(500)`);
2. keep the request-shape assertions on
`response.request().postDataJSON()` (they name WHICH half broke: the
form or the server);
3. assert the batch answered 2xx with a `results[]` body; the failure
message carries the status and the server's body;
4. read the stored rows back through `GET /api/v1/data/OBJECT/ID` with
the `request` fixture (the storageState's better-auth session cookie):
parent `name`, `account` (equal to the id the form sent), `status`;
child `title` and `project` equal to the parent id.
The second test now picks status `planned` instead of `active`.
`showcase_project`'s `project_status_flow` declares `initialStates:
['planned']` with `insert` in its events, so `active` on create is
refused. The header now says what the spec proves; the stale "bearer
token cannot write /batch" premise is gone.
`ui/e2e/live/global-setup.ts` is unchanged: the harness session already
writes.
## Tests
All runs on a local stack built the way the `Live E2E UI` job builds it
(same turbo filters, `vite build` with `VITE_BASE_PATH=/`,
`start-backend.sh`, `vite preview` proxying to the backend), tree
`481ade61` (main) and `f2e8b8ee` (this branch).
<details><summary>Re-measure of the card's premise (Task 1)</summary>
- On main, after one `test:e2e:live:ci` run, the data API listed the
first test's project (`E2E Project …`, account set, status `planned`):
the page's batch write succeeds under the harness session. The header's
premise was stale.
- The same run stored NO `E2E MD …` project and NO `E2E Task A` task,
while both tests read green.
- With the new assertions and the old `active` pick, test 2 fails: `POST
/api/v1/batch answered 400: {"error":"Projects start as Planned, and
then move only along the declared status
flow.","code":"VALIDATION_FAILED","fields":[{"field":"status","code":"invalid_initial_state",…,"constraint":{"allowed":"planned"},"value":"active"}]}`.
This is the red leg: the new assertions catch a refused batch that the
old spec read green.
</details>
<details><summary>Step time, before and after (#27550 budget: the spec
step under 2 minutes)</summary>
`pnpm --dir ui run test:e2e:live:ci --retries 0` (the CI step's
command), local 4-core shared box:
- before (main `481ade61`): 5 passed (29.0s); master-detail 5.1s + 5.7s
- after (`f2e8b8ee`), three consecutive runs: 5 passed (25.1s) · (25.7s)
· (24.6s); master-detail 4.4s + 5.2s · 4.4s + 5.6s · 4.3s + 4.4s
Faster because the fixed 500 ms sleep after the click is gone; the
response wait replaces it.
</details>
<details><summary>Gates</summary>
Head `f2e8b8ee`. `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 17 commands; each run and its exit
code recorded before any pipe; `--ran` reconciliation: `17 derived, 17
run, 0 NOT-MEASURED, 0 UNRUN`. `check:query-options-erasure` first hit a
280 s local timeout (exit 124) and was re-run to completion (exit 0, 363
s); `check:new-line-citations` is a `ui/` script and first ran from the
root (exit 254, script not found), then from `ui/` (exit 0, `0 new
citation(s)`). Final readings:
```text
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
pnpm --dir ui check:new-line-citations :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm --dir ui run type-check:e2e :: exit 0
```
Everything CI runs beyond this subset: the PR's check-runs.
</details>
## Acceptance notes
- `ui/tsconfig.e2e.json`'s header cites this file for the
`waitForRequest` predicate that was always true. That predicate was
already deleted before this PR; this PR also removes the comment that
explained the deletion, so the tsconfig sentence now points at a spec
that no longer shows it. Past-tense history, outside this card's file
surface; left as is.
- The master-detail create form offers every `status` option, while the
state machine admits only `planned` on create. A user who picks another
value gets a 400 on Create. The showcase's own wizard page documents the
same gap and leaves the general fix (a create form deriving allowed
values from the object's state machine) to the Console. Reported to the
seat, not fixed here.
## Verification
The `Live E2E UI` check on this PR runs the changed spec against HEAD's
backend.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01Utp6Cb84KtqCdPhzVBAUzB
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6Cb84KtqCdPhzVBAUzB)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2dc69d7 commit 2cbe559
1 file changed
Lines changed: 79 additions & 53 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
20 | 49 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
29 | 55 | | |
30 | 56 | | |
31 | 57 | | |
32 | 58 | | |
33 | 59 | | |
34 | 60 | | |
35 | 61 | | |
36 | | - | |
37 | | - | |
| 62 | + | |
38 | 63 | | |
39 | 64 | | |
40 | 65 | | |
41 | 66 | | |
42 | 67 | | |
43 | 68 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 69 | + | |
60 | 70 | | |
61 | | - | |
62 | | - | |
| 71 | + | |
63 | 72 | | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
67 | 84 | | |
68 | 85 | | |
69 | | - | |
70 | | - | |
| 86 | + | |
71 | 87 | | |
72 | 88 | | |
73 | 89 | | |
74 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
75 | 93 | | |
76 | 94 | | |
77 | 95 | | |
| |||
86 | 104 | | |
87 | 105 | | |
88 | 106 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 107 | + | |
94 | 108 | | |
95 | | - | |
96 | | - | |
| 109 | + | |
97 | 110 | | |
98 | 111 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
103 | 129 | | |
0 commit comments