Repository navigation
fix(console): a named or public form lays its sections out by the form view's own columns - #37671
Conversation
…columns FormPage resolves each section's fields-per-row through plugin-form's sectionedGridLayout, the rule the Setup canvas, the dialog and the record form share: the form view's columns is the grid width and caps a section's count, and an undeclared section takes the form's count. Claude-Session: https://claude.ai/code/session_01Q4EjjQ8nXPvFqzfN7vdwxR Co-authored-by: Claude <noreply@anthropic.com>
…and liveness citation Claude-Session: https://claude.ai/code/session_01Q4EjjQ8nXPvFqzfN7vdwxR Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
What this run could not see
Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
…out's readers Claude-Session: https://claude.ai/code/session_01Q4EjjQ8nXPvFqzfN7vdwxR Co-authored-by: Claude <noreply@anthropic.com>
|
epic:#5027#1 · hotlong · session_01Q4EjjMUfmNYTem26rXLFUf 维护者速读
Seat opinion: land. 席位核对Seat L1 verdict: ACCEPT · head
|
|
epic:#5027#1 · hotlong · session_01Q4EjjMUfmNYTem26rXLFUf Landing · 2026-11-26T20:39Z · head
State change: ready + auto-merge; |
…ly its colSpan (objectstack-ai#37672) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuBUGgrNWoBUQKbyS4GaX5vM)_ Fixes objectstack-ai#37559 Clause-②: yes (widening: `@object-ui/plugin-form` exports `resolveColSpan` from its root and its `/core` subpath) Metadata-protocol: none ## 维护者速读 - 在具名表单页上填表的用户会看到:标为整行的字段和多行文本类字段占满一整行,不再挤在一格里。 - 不属于任何 epic;替按表单视图配置字段宽度的应用作者兑现规格里已经声明的宽度规则。 - 出错时只影响该页字段的宽度排布,不影响数据与提交,回退本次合并即可撤回。 - 无 ## What changes - `ui/apps/console/src/components/FormPage.tsx`: each row's width is resolved by the record form's own resolver, `resolveColSpan`, against the section's column count. Before, the row read `colSpan` alone. The precedence is the FormFieldSchema `span` contract: `span: 'full'` comes first, then an authored `colSpan` clamped to the grid, then the `span: 'auto'` wide-type default (textarea, markdown, html, richtext, and a multiple file or image field). The type goes through `mapFieldTypeToFormType` with the effective `multiple`, the same way the record form's `sectionFields.ts` does it. This page's grid has a single multi-column tier (`sm:grid-cols-N`), so one `sm:col-span-N` class is the whole row at every multi-column tier. - `ui/packages/plugin-form/src/core.ts` and `ui/packages/plugin-form/src/index.tsx`: add `resolveColSpan` to the side-effect-free `/core` subpath, so the console can reach it without loading the form renderers. It is also added to the package root's `./autoLayout` export group, which keeps core.ts's header rule (every `/core` name is also a root name) true, following the `FormOwnerLineContext` precedent. The seat's contract review added `index.tsx` to the file surface. - The wide default reads only the OBJECT field's `multiple`, as the spec and `sectionFields.ts` do. A form-level `multiple` still decides the widget, through the `type` argument, but no longer decides the default width. `autoLayout.ts` is already in that subpath's closure and in the `plugin-form-core` chunk group, so the bundle split does not change. - `.changeset/37559-form-page-field-span.md`: patch for `@object-ui/console` and `@object-ui/plugin-form`. Read first, by risk: 1. `FormPage.tsx`, the `colSpan:` entry in the section builder. This is where the precedence is decided. 2. `core.ts`, the export list. This is the new public name. 3. `FormPage.fieldSpan-37559.test.tsx`, which pins the rendered class. ## Tests New file `ui/apps/console/src/components/FormPage.fieldSpan-37559.test.tsx` drives the real `/forms/:name` route and reads the rendered `sm:col-span-N` class on each row: - a `span: 'full'` field and a textarea each take 2 cells in a 2-column section; - the same two take 3 cells in a 3-column section; - CONTROL: a plain text field stays one cell; - CONTROL: an authored `colSpan` wins, so a textarea with `colSpan: 1` stays one cell and `colSpan: 2` renders 2 cells in a 4-column section; - `colSpan: 4` in a 2-column section clamps to 2 cells; - a file field whose object field declares `multiple: true` takes the whole row on `span: 'auto'`; - CONTROL: a form-level `multiple: true` over a single-file object field stays one cell. <details><summary>Pins and ablation readings (head 7ea307d)</summary> - `vitest run --maxWorkers=2` on `FormPage.fieldSpan-37559.test.tsx`, `FormPage.maxLength.test.tsx`, `FormPage.test.ts` and `FormPage.fileField.test.tsx` (ui root, under the verify lock): `VERDICT command-exit 0`, Test Files 4 passed (4), Tests 93 passed (93). - Ablation 1, the pre-fix line: the `resolveColSpan` call was replaced on disk with `colSpan: override.colSpan ?? 1` and the pin re-run: `VERDICT command-exit 1`, 4 failed and 3 passed (7). The two span pins, the clamp pin and the multi-file pin went red (`expected 1 to be 2`, `expected 1 to be 3`, `expected 4 to be 2`, `expected 1 to be 2`). The three CONTROLs stayed green. - Ablation 2, the stash: the wide-default stash was put back to `override.multiple ?? def.multiple` and the pin re-run: `VERDICT command-exit 1`, 1 failed and 6 passed (7). Only the form-level-multiple CONTROL went red (`expected 2 to be 1`). - After each ablation the file was restored with `git checkout HEAD --`, and the porcelain status was empty. </details> <details><summary>Type-check and gate readings (head 7ea307d)</summary> - I built the closure with `turbo run build --concurrency=2 --filter='@object-ui/console^...'` (Tasks: 79 successful, 79 total). Then `pnpm --filter @object-ui/plugin-form type-check` and `pnpm --filter @object-ui/console type-check` both ran, and the lock printed `VERDICT command-exit 0`. - `dispatch-gates --commands` derives the same 38 families as at c219200. At c219200 all 38 ran with exit 0 (`--ran`: 38 of 38, a derived zero). At 7ea307d I re-ran a declared narrowing of 11, each with exit 0: the changeset gates (adr-0087-registration, changeset-no-major, empty-changeset), sdui-manifest, published-files, the type-check-coverage and type-check-debt ratchets, undeclared-dep-imports, cross-package-test-inputs, test-source-alias and nul-bytes. The other 27 are left to CI on this head. - `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0`. It merges cleanly with origin/main and with objectstack-ai#37671, which shares FormPage.tsx, core.ts and index.tsx. </details> ## Acceptance notes - Follow-up reading: after this lands, re-score platform-checklist `records-forms` acceptance[2] (the width half, knownGaps[2]). - Not in this PR (filed by the seat as objectstack-ai#37677): on `span: 'auto'`, a repeater resolves to one cell on both form renderers. The spec docblock on `FormFieldSchema.span` says a repeater reaches the full row through the `field:grid` widget, but `mapFieldTypeToFormType` now maps repeater to `field:object`, which is not in `WIDE_FIELD_TYPES`. This was read from the code and has not been reproduced. - Noted, not filed: the app-shell authoring type `FormFieldSpec` declares `colSpan` but not `span`, so this page reads the served entry's `span` through a cast, the same way `resolveColSpan` does. ## Verification Two-minute check: run `pnpm exec vitest run apps/console/src/components/FormPage.fieldSpan-37559.test.tsx` from `ui/`. Expected: 4 passed. In the showcase app, open `/forms/showcase_task.form` and set Priority to Urgent. The Notes field appears (`span: 'full'`) and spans the whole row of its two-column section. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgWAbKPqt7vTgX5qgUn --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Jack · project thread
Fixes #37665
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
ui/apps/console/src/components/FormPage.tsx:buildSectionsresolves each section's fields per row through@object-ui/plugin-form'ssectionedGridLayout, the rule the Setup canvas, the record dialog, the record form and the tabbed / wizard layouts share. Under the ruling ([Decision] FormViewSchema.columns (form-level) is read only by the Setup preview: enforce it on the form page, or retire it #37638, letter A, ruling comment 7200681767) the form view'scolumnsis the grid width and caps a section's count, and a section that declares none takes the form's count. The hand-rollednormalizeColumns(default 2) is gone;declaredSectionColumnsreads only the spec's'1'–'4'string arm as the number its parse gives, and defaults nothing.ui/packages/plugin-form/src/autoLayout.ts:SectionedGridLayoutgainssectionColumns(declared), the count one section draws (the clamplayOutalready used, now exposed).FormPagedraws each section on a grid of its own, so it reads this count rather than the shared field grid.ui/packages/plugin-form/src/core.tsandindex.tsx: exportsectionedGridLayoutand its type. The console imports plugin-form through/core, which did not export it. (File surface widened from the order'sautoLayout.ts; accepted by the seat on the card.)packages/spec/liveness/view.json: theform.columnsrow re-cited toFormPage#buildSectionsand the Setup preview (ViewPreview.tsx#buildFormPreviewSchemaintoObjectForm), both throughsectionedGridLayout. TheModalForm/DrawerFormcitation was stale..changeset/37665-form-page-form-columns.md(@object-ui/plugin-form,@object-ui/console: patch).No spec or contract change: the spec still accepts any integer from 1 for the form's
columnsand the renderer clamps at 4, left as found.Tests
FormPage.formViewChrome-26843.test.tsx(the page's form-view-key harness, both routes): new top-leveldescribeon a named form (/forms/:name) and a public form (/f/:slug): formcolumns: 1+ sectioncolumns: 2draws one column; formcolumns: 3+ undeclared sections draws three; CONTROL, no formcolumns: acolumns: 1section draws one, an undeclared one two.FormPage.test.ts:buildSectionscounts for the same cases plus a declared section narrower than the form;declaredSectionColumnsreplaces thenormalizeColumnsblock.Acceptance notes
sm:tiers) and its row spans. Moving it onto the container-query twelve-track field renderer the dialog uses would also change forms without a form-levelcolumns(breakpoints, wide fields taking the row), which this card keeps as they are. Only the count per section comes from the shared rule.columnsof 5 or more drew 2 and now draws 4 (the clamp every other host applies); a non-numeric string other than'1'–'4'still reads as undeclared. The spec refuses both at parse.Verification
Local runs, worktree on `origin/main` 05563a5, head 4077b92
pnpm --dir ui exec vitest run apps/console/src/components/FormPage.test.ts apps/console/src/components/FormPage.formViewChrome-26843.test.tsx→ 2 files, 95 passed (79 + 16).packages/plugin-form/src/__tests__/mixedSectionColumns-12548.test.tsxandundeclaredSectionDensity-12592.test.tsx→ 4 files, 133 passed.buildSectionsfed the form'scolumnsas undeclared, i.e. section-only): 7 failed / 88 passed, exactly the threebuildSectionscount cases and the four named/public route cases; the CONTROL cases stayed green. Restored withgit restore --source=HEAD --staged --worktree, tree clean, re-run green.pnpm exec turbo run type-check --filter=@object-ui/plugin-form --filter=@object-ui/console→ 81/81 tasks, exit 0.eslinton the six changed ui files → 0 errors (warnings are pre-existing in those files).pnpm --filter @objectstack/spec check:liveness→ exit 0;pnpm --dir ui run check:new-line-citations→ 0 new;node scripts/check-nul-bytes.mjs→ OK.Read first:
FormPage.tsxbuildSections(thesectionedGridLayoutcall),autoLayout.tssectionedGridLayout(sectionColumns: density).Two minutes:
pnpm --dir ui exec vitest run apps/console/src/components/FormPage.formViewChrome-26843.test.tsx→ 16 passed; the six#37665cases cover both routes.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4EjjQ8nXPvFqzfN7vdwxR