Skip to content

fix(console): the named-form page sizes a field from its span, not only its colSpan - #37672

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-37559-form-page-span
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-37559-form-page-span

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #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.
Pins and ablation readings (head 7ea307d)
  • 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.
Type-check and gate readings (head 7ea307d)
  • 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 fix(console): a named or public form lays its sections out by the form view's own columns #37671, which shares FormPage.tsx, core.ts and index.tsx.

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 form layout: a repeater field on span: 'auto' gets one cell, though the spec says wide types reach the full row #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.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: TIER_DEFAULT
Head-sha: c2192006fe3bf5b21524fff803115d68421d9704
Local-runs: none

Face: declaration (Clause-②: yes (widening) on the PR body and the changeset; no published schema and no governed path in the tree). Inputs read: card #37559 body and all five comments (triage, claim 7198419752, os-dev-report 7200935606, claim amendment 7200954627, os-dev-report 7201706069), the PR body, its four files, the net diff against merge-base 05563a57f0, and the 52 check-runs on this head. All of them concluded success or skipped; none failed.

① Derived judgments

Accept-set and public-surface changes the diff implies:

  • @object-ui/plugin-form/core gains resolveColSpan. It is a new name on an exports-addressable subpath (./core, typed by ./dist/core.d.ts). The package root (src/index.tsx) exports applyAutoColSpan but not resolveColSpan, so this is the name's first publication from the package, not a re-export. The PR body's acceptance note and the changeset have this right. The amendment's parenthesis has it wrong (see F4). The judgment is right: one widening, nothing removed or renamed, and the signature (field: FormField, gridColumns: number, sectionColumns?: number), returning number, uses only an already-published type.
  • Is it the narrowest export that serves the page? Yes, at the right grain. The spec docblock on FormFieldSchema.span names resolveColSpan as the read point. The page builds one RenderableField row at a time, and resolveColSpan is the per-field primitive. Reusing applyAutoColSpan would need it on /core too (also a new /core name). It would also mean wrapping rows into a FormField[] and reading colSpan back off the result, so it is no narrower. Importing from the package root (option B) would pull the registering renderers into the /forms chunk. autoLayout.ts was already in /core's closure (inferColumns, isWideFieldType, containerGridColsFor), so the bundle split does not change.
  • The console's named-form page now reads FormFieldSchema.span. This is a renderer starting to honour a key the spec already declares. Nothing new can be authored, so the behaviour change sits under Metadata-protocol: none, which is right. It also starts clamping an authored colSpan to the section's column count, which the spec's colSpan describe already promises. Before, colSpan: 4 in a 2-column section emitted sm:col-span-4.
  • Does the page honour span exactly as the record form does? Almost, with one divergence (F2). span: 'full', an authored colSpan and the type-based wide default match: the type goes through mapFieldTypeToFormType with the effective multiple, as sectionFields.ts does. The page's grid has one multi-column tier (sm:grid-cols-N), so a single sm:col-span-N class is the whole row at every multi-column tier, which meets the spec's per-tier sentence.

Findings:

  • F1 · should-fix: ui/packages/plugin-form/src/core.ts header states the subpath's own invariant: "The same names are still exported from the package root, unchanged." Before this diff, every /core name was also a root name. The earlier precedent, FormOwnerLineContext, went to both. resolveColSpan is now the one /core name the root does not export, so the header is false at this head. Either add resolveColSpan to the root's ./autoLayout export block (still yes (widening), still patch; widen the changeset sentence to name both entry points), or rewrite the header sentence so it no longer claims root parity. The first keeps the documented rule and the precedent.
  • F2 · should-fix: FormPage.tsx passes the wide-default stash as field: { multiple: override.multiple ?? def.multiple }. The spec text (span describe, view.zod.ts) says "a file or image field whose object field declares multiple: true". autoLayout.ts's isWideFormField docblock says multiple is read off the object-field definition "and nothing else". The record form stashes the object field itself (sectionFields.ts fromObjectSchema, field: withFormObject(... field ...)). So for a file or image field whose form-view entry sets multiple differently from its object field, the two renderers disagree on span: 'auto'. A view restating multiple: true over a single-file object field goes full row here and stays one cell on the record form, and the reverse also holds. mapFieldTypeToFormType maps file to field:file whatever multiple is, so MULTI_FILE_FIELD_TYPES matches on both paths and only the stash decides. Fix: stash def.multiple (the object field's declaration). The type: argument keeps the effective multiple, as it does now. Add a pin for the multi-file arm, which has none: an object field with multiple: true takes the full row, and a view-only multiple: true over a single-file object field stays one cell.
  • F3 · nit: the changeset and the PR body claim that an authored colSpan is now "clamped to the section's column count", and no pin observes the clamp. The fourth case only checks colSpan: 2 in a 4-column section. A colSpan: 4 in a 2-column section expecting 2 cells would pin it.
  • F4 · nit: the PR body's Clause-②: line carries the amendment's parenthesis verbatim, "which is already public from the package root", and that is false at this head. The arm parses as widening either way, and the acceptance note corrects it. Still, the declaration line is the one a reader greps, so it should read true where it stands: drop or correct the parenthesis. The changeset already carries the bare arm.

② Semver level

  • Clause-②: yes (widening) is right: one new published name (resolveColSpan on @object-ui/plugin-form/core), nothing narrowed. With F1's root-export fix it stays yes (widening).
  • Metadata-protocol: none is right: the spec already declares span and colSpan. A renderer honouring them changes nothing an author can write.
  • The level is right: patch for @object-ui/plugin-form and patch for @object-ui/console. AGENTS.md (Post-Task Checklist step 3) says a none kind takes patch, and a non-protocol widening ships patch. Both packages are released (neither is private), and each package that moves has its changeset line. skip-changeset would have been wrong and was not used. Check Changeset concluded success.
  • Clause-②: yes (widening) — the declared line and the arm match what the diff publishes, and the PR body and the changeset agree on value and arm. F4 is about the PR body's parenthesis only.

③ Boundary flags

  • open_questions (report 7200935606), the /core reach A/B/C: answered by amendment 7200954627, which chose A. I concur, for the reasons in ①. The second report (7201706069) has open_questions: [].
  • Dev flag: repeater on span: 'auto' resolves to one cell on both form renderers. Escalated to the seat to file as a card. I confirmed it by reading: ui/packages/fields/src/field-type-alias.ts maps repeater: 'field:object', which is not in WIDE_FIELD_TYPES. The spec's span describe says repeater "reaches it through the wide field:grid widget it maps to", so a declared default is not delivered. This is a contract the runtime does not honour (Prime Directive 10), so it needs a card, not "noted, not filed". It predates this diff and affects both renderers, so it is not a finding on this PR.
  • Dev flag: app-shell FormFieldSpec declares colSpan but not span. Accepted as noted. The page reads the served entry's span through a narrow cast, the way resolveColSpan itself reads it. No producer stores through that type, so no card is needed for this PR's correctness. If the seat wants the type honest, it is an optional follow-up.
  • SQL push-down (Prime Directive 5): no finding. The diff adds no data access, no id materialisation and no in-app join. It changes only a pure per-row width computation over already-loaded metadata.
  • Security-touching: no.
  • The author is objectstack-fleet[bot], so no author note is owed.

Implemented-by: claude/issue-37559-form-page-span
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: PASS

The declaration face holds: Clause-②: yes (widening), Metadata-protocol: none and patch are right for this diff. F1 and F2 are should-fix and stay open. Per the landing pre-check, this head does not land until a delta closes them and that delta is read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 7ea307df8ac1b6be6961b65f21159989e042d8c8
Local-runs: none

Delta round on the declaration face (Clause-②: yes (widening) on the PR body and the changeset; no published schema and no governed path in the tree). The earlier record is 7202175363 at head c2192006fe. Inputs read: card #37559 body and all six comments (the new one is os-dev-report 7202598631), the PR body, its five files, the net diff against merge-base dedc16c103, the PR-file delta c2192006fe..7ea307df8a (four files: changeset, pin, FormPage.tsx, index.tsx; core.ts unchanged), and the 56 check-runs on this head. Every one concluded success or skipped; none failed. Test UI (16 shards), Type Check UI, Lint UI, Build & E2E UI, Live E2E UI and Check Changeset are all success.

① Derived judgments

Accept-set and public-surface changes the net diff implies:

  • @object-ui/plugin-form publishes resolveColSpan from two entry points: the root . (./dist/index.d.ts) and ./core (./dist/core.d.ts). Both are exports-addressable. This is one new name and nothing is removed or renamed. The signature (field: FormField, gridColumns: number, sectionColumns?: number) returns number and uses only an already-published type. The judgment is right. The root addition joins the existing ./autoLayout group, which already pulls that module, so the root's closure and the plugin-form-core chunk group do not change.
  • The console's named-form page now reads FormFieldSchema.span, and it clamps an authored colSpan to the section's column count. A renderer now honours keys the spec already declares, which is right under Metadata-protocol: none. The call passes cols (the section's normalised column count), and resolveColSpan clamps to it (autoLayout.ts, Math.min(..., grid)). The as 1 | 2 | 3 | 4 cast is sound, because clampGrid caps the grid at 4.
  • The wide default now reads only the object field's multiple. The stash is field: { multiple: def.multiple }, and the type: argument still carries the effective multiple. This matches the spec's span text ("a file or image field whose object field declares multiple: true"), isWideFormField (field.field?.multiple === true) and sectionFields.ts. The two form renderers now agree on span: 'auto' for file and image. Right.

Findings from the earlier record:

  • F1: closed. ui/packages/plugin-form/src/index.tsx exports resolveColSpan in its ./autoLayout group, next to applyAutoColSpan. I read every value and type name in core.ts's export list at this head against the root (18 names), and each one is also a root export. The header sentence "The same names are still exported from the package root, unchanged" is true again, following the FormOwnerLineContext precedent. The changeset sentence now names both entry points.
  • F2: closed. FormPage.tsx stashes def.multiple and has a comment on why. Two pins cover it. attachments (an object field with multiple: true) on span: 'auto' takes 2 of 2 cells. The CONTROL receipt (a single-file object field with a form-level multiple: true) stays 1 cell. The dev's ablation 2 (stash put back to override.multiple ?? def.multiple) turns only that CONTROL red, so the pin observes the stash and not the widget type.
  • F3: closed. The new case { field: 'owner', colSpan: 4 } in a 2-column section expects 2 cells. Ablation 1 reads it red as expected 4 to be 2, so it observes the clamp.
  • F4: closed. The PR body's line now reads Clause-②: yes (widening: @object-ui/plugin-form exports resolveColSpan from its root and its /core subpath). That is true at this head, and the arm is unchanged.

New finding:

  • F5 · nit: the PR body is stale in two places. Under ## Verification it says "Expected: 4 passed", but the pin file now has 7 cases. "Read first, by risk" item 2 names only core.ts as "the new public name", but the name is now also on the root through index.tsx. This is prose on the PR body only. It does not affect correctness or the contract, and the changeset and ## What changes are right.

The rowOf helper's wait moved from getByLabelText to getByText(label, { selector: 'label, label *' }), so the upload widget's group-labelled control can be found. Every case still reads the span class off the label's grid cell, so no earlier assertion is weaker.

② Semver level

  • Clause-②: yes (widening) is right. One new published name sits on two exports entries, and nothing is narrowed. The PR body and the changeset agree on the value and the arm.
  • Metadata-protocol: none is right. span and colSpan are already declared, and nothing new can be authored.
  • The level is right: patch for @object-ui/console and patch for @object-ui/plugin-form (AGENTS.md, Post-Task Checklist step 3: none takes patch, and a non-protocol widening ships patch). Both packages move, and each has its line. skip-changeset is not used, and it would be wrong here. Check Changeset concluded success.
  • Clause-②: yes (widening) — the declared line and the arm match what the diff publishes (resolveColSpan on @object-ui/plugin-form and @object-ui/plugin-form/core).

③ Boundary flags

Implemented-by: claude/issue-37559-form-page-span
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: PASS

F1 and F2 (should-fix) are closed at this head, and so are nits F3 and F4. The only open item is the nit F5, so this is the final round. F5 is recorded as an accepted deviation on PR prose; correcting it touches only the body. No should-fix or must-fix finding is open.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head 7ea307d · card #37559 · area s2-ux-S · 2026-11-26T20:46Z

L1 checklist

Tier: S. Landing: ready + auto-merge by this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 20:47
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit fbcfdfb Nov 26, 2026
57 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37559-form-page-span branch November 26, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

console: the named-form page (/forms/NAME) ignores a form field's span, so span: 'full' and the wide-type default render one cell wide

2 participants