Repository navigation
Commit 32409a9
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuWrjronJ2on8T4hXL4F5MV7)_
Fixes #35940
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户在主对象的新建/编辑表单里点「添加明细」,新行直接带上子对象的默认值(如状态「已提交」),点保存之前必填格不再一出来就标红;记录页编辑态同样如此。
- 属于「记录详情页重做」专题的衍生问题:主表单和记录页的新增明细行行为原本不一致,这次对齐。
- 加了一行却一个格都没动,保存照常成功,不会写入这行,并提示「1 行空白明细未保存」(按你选的「跳过并提示未保存」);这是纯前端行为,回退本
PR 即恢复原样。
- 要你做什么:无。
## What changes
On a parent object's create / edit form (`MasterDetailForm` →
`LineItemsField`), a new detail line now behaves the way the record
page's edit state already does (#35937):
- **Starts on the child's defaults.** `MasterDetailForm` builds each
child's static defaults with `schemaDefaultValues` (the values a create
form of the child seeds) and passes them as `newRowValues`. A default
the server resolves at insert (`NOW()`, CEL) is left to the server.
- **Not red before a save is tried.** `newRowRequiredShown` is false
until a save of the form is tried; a stored line is flagged as before.
- **Seeding context.** Both the form and `RecordBodyTableEditor` now
read the defaults with the session facts `ObjectForm` threads
(`currentUserId`, `homeCurrency`, `homeTimeZone`), so a field defaulted
to the acting user starts on that user. The editor's `childSchema` cast
is gone (rider 1 and 2 of comment 7051917540).
- **A line added and left untouched (ruling 7056413638, 「跳过并提示未保存」).** A
line Add started on its defaults that nobody edited is skipped at save
(as before), and the save now says so:
`form.lineItems.untouchedNotSaved` ("1 blank line was not saved" / "N
blank lines were not saved"), on the form (also when the host supplies
`onSuccess`) and on the record page's edit state. Such a line is never
red, before or after a refused save (`GridField`: `isUntouchedNewRow` ⇒
the row waits). Once the user edits any cell, or applies the line from
the row editor, it is input: saved and flagged like any other new line.
On an edit form that stays open, the skipped line leaves with the save.
A line typed into and then cleared stays blank and is skipped without
the notice. The count is of marked lines only. A line Enter appends on
the last line (#35998) starts and is marked the same way.
- **Live spec in CI (rider 4).** `record-page-polish-35745.spec.ts`
joins `test:e2e:live:ci`; its "not stored" check asks the server with
`$filter` on `expense_report`, and it now asserts the notice.
- Pack key in all 11 built-in locales (each locale's plural set) plus
the `formChrome.ts` defaults rows.
<details><summary>Read first (risk order) and the two-minute
check</summary>
1. `ui/packages/plugin-form/src/MasterDetailForm.tsx`: the `saveTried`
flips (set in `handleSave` and `submitViaBatch`, cleared in
`handleSaved`), the `untouchedSkippedRef` count in `sendBatch`, and the
edit-mode post-save `filter((r) => !isUntouchedNewRow(r))`.
2. `ui/packages/fields/src/widgets/GridField.tsx`: `newRowWaits` now
also holds for a marked row.
3. `ui/packages/app-shell/src/views/recordEditState.tsx`: the notice
after `finish()` on both the no-op and success paths.
Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-form/src/MasterDetailForm.test.tsx` → 17 passed,
including the "ruling 7056413638" block.
</details>
## Tests
- `MasterDetailForm.test.tsx`: new describe "a new line starts on the
child's defaults and waits to read red": defaults shown and red only
after the try; CONTROL stored line flagged at once; acting user written;
Add then row-editor Apply is written. Nested "ruling 7056413638": create
skip + notice with a host `onSuccess`; a refused save flags the edited
row, not the untouched one; edit mode drops the skipped line after save.
- `RecordBodyTableEditor.seedContext-35940.test.tsx` (new): acting user
seeded; CONTROL with no known user the field starts empty.
- `GridField.test.tsx`: a marked row is never red; its first edit makes
it input.
- `RecordDetailView.harness.test.tsx`: the page notice plus a
parent-update-only batch; CONTROL no notice.
<details><summary>Ablations (each applied on disk to the committed head
with <code>scripts/ablation-replace.mjs</code>, file restored
after)</summary>
| Ablation | Result |
|---|---|
| `GridField` `isUntouchedNewRow` term removed | GridField 1 failed;
MasterDetailForm 1 failed |
| `newRowRequiredShown` prop deleted (MDF) | 1 failed |
| `newRowValues` prop deleted (MDF) | 6 failed |
| MDF seed context removed | 1 failed |
| RBE seed context removed | 1 failed |
| row-editor Apply keeps the untouched mark | 1 failed |
| MDF notice removed | 2 failed |
| MDF edit-mode drop removed | 1 failed |
| page notice removed | 1 failed |
A form-mode Add seed (row editor) ablated stayed green: the row editor's
`ObjectForm` already seeds defaults through its own create detection, so
that code was removed (96501c2) rather than kept untested.
</details>
## Acceptance notes
- Form-mode Add (row editor) gets its defaults from the editor's own
create seeding; no separate seed here.
- `minRows` is out of scope (seat facts, 23:18Z).
- Merged with main twice (K = 23 at the seat's ask, then a conflict
after #35998). #35998 draws no trailing entry line, so the second merge
commit (b08c7f5) also moves this PR's tests and the live spec to read
the new line as the one Add appends: `addSeededLine` waits for the child
schema and sees the line start on 'Pending'; the harness counts lines
before and after Add; the live spec skips the empty state's row; one
GridField pin adds Enter-append. Conflicts were two append-only test
blocks (both kept) and one import line (union).
- Branch name is the harness name `claude/project-thread-c6vkj1`.
## Verification
Post-merge on b08c7f5: `vitest run` MasterDetailForm, GridField,
RecordBodyTableEditor*, RecordDetailView.harness → Test Files 5 passed,
Tests 173 passed; GridField alone 71 passed with the Enter-append pin;
`@object-ui/fields` and `@object-ui/plugin-form` type-check exit 0
(closure rebuilt); `check:nul-bytes`, `check:i18n-keys` exit 0. The live
spec's new row reading is left to CI's Live E2E UI on this head.
Earlier readings, all on head e642739:
- CI: 46 check runs success, 13 skipped by their own rules, 0 failed.
- Unit tests under the verify lock: `vitest run packages/fields
packages/i18n packages/plugin-form` → Test Files 655 passed | 1 skipped,
Tests 9356 passed | 21 skipped; `vitest run
packages/app-shell/src/views` → Test Files 1575 passed, Tests 14926
passed | 1 skipped. Declared narrowing: app-shell outside `src/views`
was left to CI (one run of all four packages passed 40 minutes on this
4-core box and was stopped).
- Type-check: `@object-ui/fields`, `@object-ui/i18n`,
`@object-ui/plugin-form`, `@object-ui/app-shell` (after building its
closure) all exit 0.
- Derived gates: `dispatch-gates --ran` → 56 derived, 56 run, 0
NOT-MEASURED, 0 UNRUN, every exit 0. `check:type-check-debt` first
queue-timed out (exit 3, not measured) and was re-run under the lock:
OK, 0 raw tsc errors above the ledger. ui `check:i18n-keys`,
`check:i18n-drift`, `check:i18n-dead-keys` exit 0.
<details><summary>Real browser on the live stack (workspace showcase
backend :4010 + built console preview)</summary>
- `playwright test --config=playwright.live.config.ts
record-page-polish-35745.spec.ts` → 1 passed (5.8s).
- Create form, showcase Expense Report: Add line → line 1 reads Category
"Other", Line Status "Submitted"; 0 cells flagged (`line-items-invalid*`
count 0). Create → toast "1 blank line was not saved" beside the created
toast; the server holds the report and 0 lines for it (`$filter` on
`expense_report`).
- Record page edit state: Add line → defaults, 0 flagged; Save → "1
blank line was not saved"; 0 lines stored.
- Screenshots kept with the seat's evidence for this card.
</details>
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgWYi6WWWnJAmc7Jtpu
<!-- signed: repo:objectstack#1 · os-sales ·
session_01L6bhgWYi6WWWnJAmc7Jtpu -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 907b378 commit 32409a9
24 files changed
Lines changed: 551 additions & 24 deletions
File tree
- .changeset
- ui
- e2e/live
- packages
- app-shell/src/views
- fields/src/widgets
- i18n/src/locales
- plugin-form/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
104 | | - | |
| 105 | + | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
109 | | - | |
| 110 | + | |
110 | 111 | | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
117 | 123 | | |
118 | 124 | | |
119 | | - | |
| 125 | + | |
120 | 126 | | |
121 | 127 | | |
122 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
2941 | 2942 | | |
2942 | 2943 | | |
2943 | 2944 | | |
2944 | | - | |
| 2945 | + | |
| 2946 | + | |
2945 | 2947 | | |
2946 | 2948 | | |
2947 | 2949 | | |
| |||
2960 | 2962 | | |
2961 | 2963 | | |
2962 | 2964 | | |
2963 | | - | |
| 2965 | + | |
2964 | 2966 | | |
2965 | 2967 | | |
2966 | 2968 | | |
| |||
2973 | 2975 | | |
2974 | 2976 | | |
2975 | 2977 | | |
2976 | | - | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
2977 | 2984 | | |
2978 | 2985 | | |
2979 | 2986 | | |
| |||
3196 | 3203 | | |
3197 | 3204 | | |
3198 | 3205 | | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
3199 | 3236 | | |
3200 | 3237 | | |
3201 | 3238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5671 | 5671 | | |
5672 | 5672 | | |
5673 | 5673 | | |
| 5674 | + | |
5674 | 5675 | | |
5675 | 5676 | | |
5676 | 5677 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
178 | 185 | | |
179 | 186 | | |
180 | 187 | | |
| |||
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
| 208 | + | |
201 | 209 | | |
202 | 210 | | |
203 | 211 | | |
| |||
294 | 302 | | |
295 | 303 | | |
296 | 304 | | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
297 | 311 | | |
298 | 312 | | |
299 | 313 | | |
300 | 314 | | |
301 | 315 | | |
302 | 316 | | |
| 317 | + | |
303 | 318 | | |
304 | 319 | | |
305 | 320 | | |
| |||
312 | 327 | | |
313 | 328 | | |
314 | 329 | | |
| 330 | + | |
315 | 331 | | |
316 | 332 | | |
317 | 333 | | |
| |||
323 | 339 | | |
324 | 340 | | |
325 | 341 | | |
326 | | - | |
| 342 | + | |
327 | 343 | | |
328 | 344 | | |
329 | 345 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
850 | 890 | | |
851 | 891 | | |
852 | 892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
702 | 702 | | |
703 | 703 | | |
704 | 704 | | |
705 | | - | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
706 | 708 | | |
707 | 709 | | |
708 | 710 | | |
| |||
1698 | 1700 | | |
1699 | 1701 | | |
1700 | 1702 | | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
1701 | 1706 | | |
1702 | | - | |
| 1707 | + | |
| 1708 | + | |
1703 | 1709 | | |
1704 | 1710 | | |
1705 | 1711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
236 | 243 | | |
237 | 244 | | |
238 | 245 | | |
| |||
0 commit comments