Repository navigation
test(plugin-form): wait for the captured grid before reading it in the master-detail members pin - #36514
Conversation
…e master-detail members pin Every read of a section's captured grid props now waits for that grid to be captured, and gridOf finds a section's grid by a sentinel the capturing mock writes into the section, so a partial render pass can no longer hand back another section's props or undefined. Claude-Session: https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf L1 ACCEPT · head 维护者速读
席位核对
|
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC Contract reviewServed-tier: Inputs read: card #36500 (body and its three comments: the scope note 7081127197, the claim 7081224132 and the triage note), the PR #36514 body and its one comment (the seat's L1 note, read as input only), the one-file net diff against ① Derived judgmentsThe diff changes one file, The race cause is real. In The new lookup removes the cause instead of hiding it. The mock gives each mounted grid a No assertion was removed or weakened. Every Every bare read after a heading wait now waits for the grid capture. Case 1 puts both column-order reads in one The card's third done-when item, about the siblings, holds. At the head, Check-runs on the head: 58 runs, 40 ② Semver level
③ Boundary flagsThe dev raised no flag and listed no SQL push-down: nothing to check. The diff adds no id materialisation and no in-app join. It is a test mock and its lookup. Note on case 6, not a finding: the No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC Landing (seat 7, 2026-11-22T16:36Z): head |
… rating (objectstack-ai#36043) (objectstack-ai#36392) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_ Fixes objectstack-ai#36043 repo:objectstack#7 · zhuangjianguo · session_01QsR2jTbWpneBrqq7SJvrNt Clause-②: yes (widening) Metadata-protocol: semantic Skills-docs: none — no skill names the inline grid column `type` values or keys (`git grep` of `skills/` for `inlineColumns` and the column type list: one passing mention in `objectstack-data/rules/relationships.md`, which lists no types) ## 维护者速读 - 表单里的明细表(主从表单的行项目表格)中,人员格子可以直接搜索选人,多选格子可以选多个选项,标签格子可以加标签,勾选格子是复选框,评分格子是星星;以前这些都是普通文本框,人员要手填用户编号,多选只能填一个值。 - 属于列表页重做专题的单元格编辑那一组,替在主从表单里录入明细行的用户解决「人员、多选填不进去」的问题。 - 已有表单的明细表会直接变样:布尔字段从「是/否」下拉变成复选框,评分字段从数字框变成星星;作者在列上明确写了类型的不受影响;出错时最坏是这几类格子不好用,已存的数据不受影响,可直接撤回。 - 无 ## What changes The card's words map onto the enum by the spec's existing rule that every column type is spelled as its namesake field type (the `inline-grid-column-carriers` probe and the `field.json` liveness note rely on it): people = `user`, multi-select = `multiselect`, tags = `tags`, check = `boolean`, rating = `rating`. **Spec (`packages/spec/src/data/field.zod.ts`).** `InlineGridColumnSchema.type` gains `user`, `multiselect`, `tags`, `boolean` and `rating` (nine → fourteen). The column gains one optional key, `max`: the star count of a `rating` cell (default 5), because a column carries no field definition and a `max: 10` rating would otherwise draw five stars. `options` and `multiple` describe what the new cells read from them. `inline-grid-columns.ts` (`deriveInlineGridColumns`' cell-type mirror) maps the same way, and each new cell type keeps the fill priority its field types had before, so which derived columns are visible by default does not change (the existing budget pins stay green unchanged). Liveness ledger: the `type` note lists fourteen types, and a `max` child row. Regenerated: reference docs, `authorable-surface/data.json` (one new key), liveness state counts. **Derivation (`ui/packages/plugin-form/src/deriveMasterDetail.ts`).** `fieldTypeToColumnType` maps `user` → `user`, `multiselect` / `checkboxes` → `multiselect`, `tags` → `tags`, `boolean` / `toggle` → `boolean`, `rating` → `rating`. A derived or hydrated column carries `multiple` from a multi-person field, `max` from a rating field, and the child's options on `multiselect` columns. A `tags` column takes no options: its cell holds free-form tags and reads no option list. A `boolean` column keeps the two options it carried as a select (`'true'` / `'false'`, labelled with the session's words through `booleanLabel`): they are the words its read-only and list-mode cells read as, so `booleanLabel` stays live. A column that declares its `type` is left alone, as before. **Cells (`ui/packages/fields/src/widgets/grid-field/GridFieldWidget.tsx`, `gridCellPanels.tsx`).** The cells reuse the main list's in-cell faces rather than forking them: - `GridPanelCell` (new, beside S5's `GridSelectCell`) is a panel shell under the cell that hosts a widget's own `inCell` face over a draft: a click outside or Tab writes the draft, Esc writes nothing, and a face that ends on one pick calls `commit`. The cell keeps drawing its value while the panel is open. - `multiselect` hosts `MultiSelectField inCell`, `tags` hosts `TagsField inCell`, and `user` hosts `UserField inCell` (the main list's person picker: searchable list, recents, Clear; a single pick writes and closes). - `boolean` is the `Checkbox` primitive (click / Space), writing `true` / `false`. - `rating` draws `RatingField inCell` (a click on a star sets it); a digit key on the cell sets that many stars, 0 clears, a digit above `max` does nothing. - Read-only table and list mode: people by name (`UserField readonly`), a rating as its stars, a multi-select's option labels, a check cell as its option word (else the session's yes/no word). - A required cell holding an empty list (multi-select, tags, several people) reads invalid, as an empty scalar does. - A multi-select, tags or several-people cell that is emptied writes `null`, not `[]`: the save path counts only `null` / `''` as blank (`isBlankRow`), and a cleared multi-value field stores `null` elsewhere too. An emptied cell reads `—`. Item 2 of the card (interim read-only columns) is not built: the seat reads it as superseded once item 1 ships, and this PR ships item 1. **Visible change on existing master-detail forms** (named in the changeset): a derived `boolean` / `toggle` column is a checkbox instead of the yes/no select and writes booleans instead of the strings `'true'` / `'false'` (the server's write normalisation reads both the same); a derived `rating` column is stars instead of a number box; `user`, `multiselect`, `checkboxes` and `tags` columns are no longer plain text boxes. ## Tests - `ui/packages/fields/src/widgets/GridField.test.tsx`, new top-level `describe` "the cells that edit as in the main list": multi-select (labels, several picks staged then written on leaving, Esc writes nothing, empty list reads invalid when required), tags (a new tag added from the list, Tab writes and moves to the next cell), check (checkbox over `true` and `'false'`, click writes a boolean, read-only reads the option word), rating (five stars by default, a click sets, digit keys set and 0 clears, a digit above the stars sets nothing, `max: 10` draws ten), people (the person picker opens under the cell; its Clear writes and closes). An emptied multi-select and an emptied tags cell each write `null` (both pins go red with the fix taken out), and the emptied tags cell reads `—`. - `ui/packages/plugin-form/src/deriveMasterDetail.test.ts`: the five mappings with their neighbours as controls; a new `describe` pinning the extras on both the derive and the hydrate path (`multiple`, options on a multi-select and none on a tags column, the check column's two words, `max` from the field and none when the field declares none), and that an authored column, a `type: 'select'` over a boolean field included, keeps its type and extras. - `deriveMasterDetail.booleanOptions-12924.test.tsx`: the derived boolean column is now `type: 'boolean'` with the same two session-language options; the editable grid pins read checkbox states instead of picker text; the language-switch pin now re-labels the read-only table (the editable check cell shows no word). - `MasterDetailForm.lateCatalogue-12924.test.tsx`: the late-catalogue re-label is read where the grid still draws a boolean's word, a second detail in `inlineMode: 'form'`; the editable `Lines` detail keeps the unsaved edit and its checkboxes through the catalogue landing. - `deriveMasterDetail.inlineGridColumns-11345.test.ts`: the "output unchanged" corpus moves its one derived boolean column (`gift`) from `select` to `boolean`, marked where it sits; nothing else in the corpus moves. ## Deviations Four files outside the claim's surface, each a direct consequence of the widening. Seat 7 counts them inside the card. - `packages/metadata-core/src/object-schema-fls-references.ts`: `INLINE_COLUMN_POSITIONS` classifies the new `max` key as `keep` (a number, never a field name). `object-schema-fls-references.test.ts` refuses an unclassified `InlineGridColumnSchema` key, so it was red in Test Core 3/10 at `10767ef3`. - `ui/packages/types/src/__tests__/strict-face-read-keys-11070.test.ts`: the refused-column-type row used `boolean`, which is now a cell type, so it moves to `toggle`, which is still refused. It was red in Test UI 12/16 at `10767ef3`. - `ui/packages/types/src/form.ts`: a docblock no longer counts "nine" cell controls. - `content/docs/data-modeling/field-types.mdx`: the inline grid bullets list the fourteen cell types and the checkbox booleans, and add the people, multi-select, tags and rating cells. The changeset adds `'@objectstack/metadata-core': patch` and `'@object-ui/types': patch` for the first two packages. ## Acceptance notes - A click outside a multi-select / tags / people panel writes through the popover's own dismiss (`onOpenChange`). The jsdom pins leave the panel through Tab, because that harness's pointer events do not reach the dismiss. The click outside is measured live below. ## Live click-through Showcase app (`objectstack dev --seed-admin`, fresh database) plus the Console from source (Vite), Chromium through Playwright. To host the three cells, the run added, without committing, `inlineEdit: 'grid'` and `inlineColumns` (`name`, `f_multiselect`, `f_tags`, `f_users`) to `showcase_field_zoo.f_master_detail`, and a `fieldGroups` entry placing that child on `showcase_project`. The edits were reverted afterwards. Project "Website Relaunch", Edit, row 0 of the zoo grid. "Outside" is a click on the dialog's "Edit Project" heading. | Step | Multi-select | Tags | People (multiple) | | --- | --- | --- | --- | | Stored before | `["red","green"]` | `["alpha","beta"]` | `null` | | Pick | Blue | type `gamma`, Enter | Dev Admin | | Panels open after the click outside | 0 | 0 | 0 | | Cell after the click outside | Red, Green, Blue | alpha, beta, gamma | Dev Admin | | Stored after Update | `["red","green","blue"]` | `["alpha","beta","gamma"]` | `["<Dev Admin's user id>"]` | | Cell after a page reload and Edit again | Red, Green, Blue | alpha, beta, gamma | Dev Admin | | Emptied, click outside, Update: cell / stored | — / `null` | — / `null` | not run | The run found one defect, fixed in `2197dbdd`: an emptied tags cell drew nothing instead of `—`. The display helper now reads an empty list as empty for every type. It is pinned in `GridField.test.tsx`, and the final row above was read with the fix served. - `rating` cells keep `RatingField`'s one button per star, so Tab visits each star; the arrows and digit keys work from any of them. ## Verification Final head `6185caed`. It adds three commits to `f73a4351`: - `6e74cfe0`: the review rework. Metadata-protocol is `semantic`; a `tags` column takes no options; an emptied multi-value cell writes `null`; the stale "twenty keys" and liveness prose is fixed. - `2197dbdd`: the emptied tags cell reads `—`, found by the live run. - A merge of `origin/main` at `07b17542` (objectstack-ai#36523, objectstack-ai#36478, objectstack-ai#36522, objectstack-ai#36514, objectstack-ai#36508), and `6185caed`, which regenerates `content/docs/references/ui/component.mdx` from the merged tree. The merge had taken that page's `mobileMaxVisible` line from one side. Checks at the final head: - `dispatch-gates --ran` at `6185caed`: 120 derived families accounted for, 120 run, 0 NOT MEASURED, every one exit 0. That includes `check:generated` and `check:liveness` after a spec rebuild, and `pnpm --dir ui exec vitest run scripts/` run alone under the verify lock. - `ui/packages/fields/` + `ui/packages/plugin-form/` (whole packages) at `6185caed`: 567 files, 7,629 tests passed, 8 skipped. - The new pins were ablated: both "emptied, it writes null" pins and the tags `—` pin go red with their fix taken out. - `overlap-check` at `6185caed`, verdict read before the push. It merges cleanly with `origin/main` `a10987ae` and with 6 of 7 open PR heads. objectstack-ai#36543 conflicts only in `packages/spec/liveness/state-counts/field.md`, a generated count: whichever lands second regenerates it with `gen:liveness-counts`, not a hand merge. - Earlier heads: at `10767ef3`, `pnpm --filter @objectstack/spec test` (871 files, 27,909 tests) and `test:repo` (92 files, 1,562 tests) passed. CI was green at `f73a4351`. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jTbWpneBrqq7SJvrNt)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01QsR2jTbWpneBrqq7SJvrNt <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jTbWpneBrqq7SJvrNt --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #36500
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Test-only. One file:
ui/packages/plugin-form/src/__tests__/masterDetailDetailsMembers-8071.test.tsx. No product code, no published file moves (@object-ui/plugin-formshipsdist, README, CHANGELOG and LICENSE only), so the PR carriesskip-changeset.Cause:
MasterDetailFormdraws a section's heading before its columns load, so the heading can exist while the grid is still on "Loading columns...". Case 1 waited for the headings, then read the captured grid props right away, and the oldgridOf(gridProps.slice(-sections)[index]) gave backundefineduntil every section's grid had been captured.gridOfis keyed by section, not by slice index. The capturingLineItemsFieldmock now gives each mounted grid a per-instance id (useId), keeps that grid's latest props in a map under the id, and draws a hidden sentinel span carrying the id beside the real grid.gridOf(heading)finds the section by its heading, reads the one sentinel inside it, and returns that grid's latest props. It throws (rather than returningundefinedor another section's props) when the section has no captured grid yet, so a caller insidewaitForretries. A render pass that re-renders only some grids can no longer misalign it. The flatgridPropslist stays, because case 7 asserts it is empty.waitForSteps, configuredread waits for that grid'sfieldWider formandCells onlywait for their grids, the same wayAs a listalready didNotesvalue assertion is insidewaitFor, the same wayLinesalready wasundefinednow gets a named error fromgridOf, retried bywaitForuntil it times out, so a wrong value still fails.Sibling
*Members-8071files: per the scope note on the card, none defines or usesgridOf/gridProps, so they are not affected.Read first (by risk): the
vi.mock('@object-ui/fields', ...)factory (the sentinel and the per-instance map), thengridOf, then case 1.Tests
9abc732132a(origin/main), the file was looped 10 times fromui/. 6 of 10 runs failed, every one in case 1 withTypeError: Cannot read properties of undefined (reading 'field')at thegridOf('Lines').fieldread. The other 4 runs passed 9/9.28dd844ac5b, the same file passed 20 runs in a row, 0 failures,Tests 9 passed (9)on every run.cd ui && pnpm exec vitest run packages/plugin-form/gaveTest Files 244 passed (244),Tests 2750 passed | 1 skipped (2751).pnpm --filter @object-ui/plugin-form run type-check(tsc --noEmit && tsc -p tsconfig.test.json; the test project includessrc/**/*.test.tsx) exited 0.Acceptance notes
Verification
Two-minute check:
cd ui && pnpm exec vitest run packages/plugin-form/src/__tests__/masterDetailDetailsMembers-8071.test.tsxshould printTests 9 passed (9), and keep printing it when looped.Run counts and gate readings (objectstack-ai/objectstack, head 28dd844, merge base 9abc732)
× 1. each member is its own section, in AUTHORED order ..., withTests 1 failed | 8 passed (9).fails=0in the loop, andTests 9 passed (9)on all 20.node scripts/pm/dispatch-gates.mjs --commandsderived 27 families for this one path. All 27 were run locally, every one exiting 0, andpnpm --dir ui exec vitest run scripts/gave 172 files passed, 2 skipped.--ranreconciliation:27 derived, 27 run, 0 NOT-MEASURED, 0 UNRUN, a derived zero with every exit code recorded.pnpm --dir ui run check:vi-mock-specifiersandcheck:vi-mock-inheritboth OK, andcheck:new-line-citationsfound 0 new citations.🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jTeURPvEm465RcoYEC