Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

test(app-shell): measure whether a { group } form section reaches SchemaForm (#8725) - #8739

Merged
os-justin merged 2 commits into
mainfrom
claude/issue-8725-formsectionspec-group-reachability
Sep 9, 2026
Merged

os-justin merged 2 commits into
mainfrom
claude/issue-8725-formsectionspec-group-reachability

Conversation

@os-justin

Copy link
Copy Markdown
Collaborator

Part of #8725 — deliberately not Fixes. This PR delivers the card's first deliverable, the reachability measurement, and stops there. Neither half of the fix is here: the half that remains is the type widening plus a disposition for the three read sites, which is a behaviour ruling on a renderer. See "What this PR does not do".

Leg 1 — reachability: YES, and the card's guess about the inputs is false

The card was filed with reachability explicitly unmeasured and named that as its own gap. It guessed the inputs were "this repo's own *.form.ts create/edit schemas, which do not author group" — which would have made the defect latent.

Sweep. Population: 4,231 tracked .ts / .tsx files under apps/ and packages/ (git ls-files -- 'apps/**/*.ts' 'apps/**/*.tsx' 'packages/**/*.ts' 'packages/**/*.tsx' | wc -l). Lit control on the same command shape over the same population: 1,904 files match git ls-files -- '*.ts', and git grep -l "from 'react'" over packages/ apps/ examples/ lights 1,875 files. Against that non-empty population, git ls-files matches 0 files named *.form.ts and 0 files containing .form. at all. The premise names a file class this repository does not contain.

What the inputs actually are. A git grep for the JSX opening tag of SchemaForm over the whole tracked tree returns 13 production call sites; seven pass a form prop, and they take it from exactly two channels:

  1. A server document, untyped and uncast-checked. RichMetadataTypeEntry.form (useMetadata.ts:93) is a Record of string to unknown — the /meta/types registry response, deserialised in useMetadataTypes with no validation and no normalisation — and ResourceEditPage.tsx:2798 / :2822 hand it over as form={createMode && config.createSchema ? undefined : (entry?.form as any)}. EmbeddedItemEditor.tsx:76 does the same with subEntry?.form as any.
  2. Spec-bundled forms — getPageForm / getViewForm / getReportForm / getDashboardForm read pageForm and friends straight out of @objectstack/spec/ui, an upstream versioned document this repo does not author either.

So the REQUIRED fields on FormSectionSpec stands between a TypeScript author and this renderer, and between nothing else. On the channel that actually reaches ResourceEditPage, there is no compile-time barrier at all.

Premise re-measured against the installed @objectstack/spec 17.3.0 (root export is thin, so via the /ui subpath):

FormSectionSchema.safeParse({ group: 'contact_info' })  -> ACCEPT
   { collapsible: false, collapsed: false, columns: 1, group: 'contact_info' }
CONTROL FormSectionSchema.safeParse({ notAKey: 1 })     -> REJECT  ["unrecognized_keys"]

The control fires, so the accept is a real reading of a strict schema. Also measured on 17.3.0: none of pageForm / viewForm / reportForm / dashboardForm declares a group section or a section missing fields today — a property of one spec release, not a barrier.

The DOM reproduction, and one word the card has wrong

Reproduced in happy-dom through the same untyped channel. The render throws out of the component body; there is no partial tree and no per-section boundary could contain it. Container innerHTML is the empty string — the card's parent measurement (#8641) found a visible empty bordered card for its defect; this one leaves no DOM at all. A well-formed sibling section in the same document dies with it, and the tabbed arm dies identically.

The card predicts Cannot read properties of undefined (reading 'map'). That is not what fires. The observed throw is:

TypeError: s.fields is not iterable

SchemaForm.tsx:786 is for (const f of s.fields), inside SchemaFormBody's pre-flight "does this layout name any field the schema has" loop — upstream of SectionedSchemaForm, so the .map sites at :1030 and :1147 are never reached. Guarding only the two .map sites the card quotes leaves the crash exactly where it is. This is proved mechanically by ablation leg A below, not by reading.

What this PR does not do, and why

Nothing here widens FormSectionSpec.fields and nothing here touches a read site.

One thing the card could not know, measured here: the trap is real but loud, not silent. Widening fields to optional makes this package's own type-check report, immediately:

SchemaForm.tsx(786,23): error TS18048: 's.fields' is possibly 'undefined'.
SchemaForm.tsx(1030,20): error TS18048: 's.fields' is possibly 'undefined'.
SchemaForm.tsx(1147,9): error TS18048: 's.fields' is possibly 'undefined'.
form-spec.containers.test.tsx(117,60): error TS2537   (PIN D needs a NonNullable)
mergeServerFields.test.ts 69/82/128/160: error TS18048

So part 1 cannot ship without its author confronting every read. What strictNullChecks cannot do is stop them from typing ?? [] to silence it — which is precisely the ruling this card is holding open.

What landed

One new test file, packages/app-shell/src/views/metadata-admin/SchemaForm.groupSectionReachability-8725.test.tsx, plus an empty-frontmatter changeset. No source file, no type, no behaviour changes.

Its runtime pins assert what this renderer does today, which is to die. They are a measurement, not an endorsement: whoever rules on the disposition is expected to turn them into pins on the chosen behaviour, and their going red is the intended signal that the ruling landed.

pin kind asserts
T1 tsc the spec-legal { group } section is refused by FormSectionSpec (ts-expect-error, so it is two-way: widening fields reds this file and puts the runtime pins in front of the author)
T2 tsc the crashing shape is assignable to RichMetadataTypeEntry['form'] — the barrier guards one channel and not the reaching one
R1 vitest control / non-regression — a section that authors fields still renders them
R2 vitest the render throws a TypeError of the s.fields family and leaves no DOM
R3 vitest the read that fires first is the for…of, not a .map
R4 vitest one bad section destroys a well-formed sibling: the blast radius is the document
R5 vitest the tabbed arm dies at the same upstream read

T1 carries a positive control (group is a declared key, so T1's refusal is about the missing fields and not an unknown group).

Evidence

Every pin observed red. Five ablation legs, each run from a committed tree, each mutation line-preserving and proved on disk in both directions (anchor counts before and after, git hash-object differing from the HEAD blob, a line-total gate), each restored by state (git checkout HEAD -- ABSOLUTE_PATH, then git diff HEAD empty and the blob hash back to the HEAD blob), each under a trap ... EXIT INT TERM with absolute paths. Per-test classification read from vitest's JSON reporter, with file-level failureMessage (suite death) counted separately — it was 0 in every leg, so every result below is a failing assertion and not a suite death.

leg mutation result
A guard read site :786 only R3, R5 FAILED; R1, R2, R4 passed. Message becomes Cannot read properties of undefined (reading 'map') — the card's own quote, from :1030. Proves the ordering claim and that a two-site fix is a non-fix.
B guard all three read sites R2, R3, R4, R5 FAILED; R1 passed. The "fix landed" direction.
C caricature: every section resolves to no fields R1 FAILED, alone. The control is real.
D FormSectionSpec.fields widened to optional T1 FAILED (TS2578: Unused 'ts-expect-error' directive), plus the TS18048 inventory quoted above.
E RichMetadataTypeEntry.form retyped to FormViewSpec T2 FAILED (TS2322), and measured as the only error in the package — so T2 is a measurement, not a tautology.

Type-level pins are inside the checked program. tsc -p packages/app-shell/tsconfig.test.json --listFiles reads 4,474 files and the pin file is one of them (input #4,099). Legs D and E confirm behaviourally that the project judges it.

Non-regression, structurally. tsc -p packages/app-shell/tsconfig.json --noEmit --listFiles reads 3,697 files: the new file is not among them, and no *.test.tsx is (control: SchemaForm.tsx is). The emitting program's inputs are byte-identical to main, so nothing any form builds can have moved. R1 is the runtime half of the same claim.

Suites run (from the repo root with paths, per objectui#3378):

packages/app-shell/src/views/metadata-admin/   832 suites, 2559 tests, 0 failed, 0 suite deaths
packages/app-shell/src/views/studio-design/    168 suites,  323 tests, 0 failed, 0 suite deaths
pnpm --filter @object-ui/app-shell type-check  exit 0   (tsc --noEmit && tsc -p tsconfig.test.json)
eslint on the new file                          0 errors, 0 warnings
node scripts/check-control-bytes.mjs           exit 0   (6922 tracked text files)
node scripts/check-changeset-presence.mjs      exit 0   "Every one of them has an EMPTY frontmatter"
node scripts/check-changeset-no-major.mjs      exit 0

Declared narrowing. The full @object-ui/app-shell suite exceeds this container's foreground budget, so it was narrowed to the change's measured blast radius and the remainder is declared to CI. The radius is measured, not assumed: of 41 tracked files importing SchemaForm or form-spec, 39 are under views/metadata-admin/ and the other two are src/index.ts (a re-export) and views/studio-design/ObjectHooksPanel.tsx — both directories were run in full above.

Collisions

git ls-remote --heads origin 'gh-readonly-queue/*' at branch time listed PRs 8720, 8721, 8723, 8732, 8733. Diffing the queue tip against this branch's base gives 26 files; the intersection with this PR's two files is empty, and none of them is under views/metadata-admin/.

The decision this PR is asking for

{ group } can reach SchemaForm, so parts 1 and 2 have to land together. Part 2's disposition is the ruling:

  • A — ?? [] at the three read sites. Cheapest, no new dependency. It makes a group-referencing section render as an empty one: today's silent drop, no longer fatal. That is a behaviour ruling on a renderer, and it is what the compiler will tempt the next author into typing.
  • B — resolve the reference, importing resolveSectionGroupReferences from @object-ui/plugin-form (blocked on fix(console,plugin-form): render a form section that references a field group (#8641) #8727 landing). Correct, and the only route that does not re-implement an assembly rule here — but SchemaForm is not handed an object definition today, so it needs a new input threaded from ResourceEditPage / the inspectors.
  • C — put the barrier on the channel that actually reaches the renderer, by retyping RichMetadataTypeEntry.form (leg E measured this as the only error in the package) and dropping the as any casts. This does not fix the crash — a server document can still carry the shape at runtime — but it stops the type from claiming a guarantee it does not provide.

A and B are not exclusive with C.


Generated by Claude Code

…chemaForm (objectui#8725)

objectui#8725 was filed with reachability explicitly unmeasured. It is
reachable: the `form` document SchemaForm renders arrives from the
`/meta/types` registry as `RichMetadataTypeEntry.form`
(`Record<string, unknown>`, unvalidated) and is handed over as
`form={entry?.form as any}`, so the REQUIRED `fields` on `FormSectionSpec`
stands between a TypeScript author and this renderer and nothing else.

Pins the measurement without deciding either half of the fix: the render
throws a TypeError out of the component body and leaves no DOM, the whole
document dies with one bad section, and the read that fires first is
`SchemaFormBody`'s `for…of` pre-flight — not the `.map` sites the card
predicts, so guarding only those leaves the crash in place.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
…nothing

Empty frontmatter — the explicit exemption for a test-only change under a
published package's `src/`, per scripts/check-changeset-presence.mjs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 50 chunks) 3482.0 KB 3512.7 KB
Main entry chunk (gzip) 144.0 KB 350 KB
Entry file index-cErZLG2L.js —
Status PASS —

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 15.67KB 5.75KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.06KB 3.86KB
auth (ActiveOrganizationStorage.js) 25.05KB 9.16KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.18KB 10.59KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.15KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.65KB 2.22KB
auth (SocialSignInButtons.js) 9.61KB 3.89KB
auth (UserMenu.js) 3.41KB 1.23KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.21KB 10.80KB
auth (createAuthenticatedFetch.js) 8.46KB 3.43KB
auth (index.js) 3.19KB 1.44KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 11.08KB 4.58KB
collaboration (CommentThread.js) 26.08KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 499.42KB 114.32KB
core (index.js) 7.48KB 2.96KB
create-plugin (index.js) 10.12KB 3.28KB
data-objectstack (index.js) 198.39KB 55.29KB
fields (index.js) 244.96KB 61.76KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 1.22KB 0.64KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 6.57KB 2.76KB
i18n (index.js) 3.65KB 1.47KB
i18n (pickLocalized.js) 7.62KB 3.26KB
i18n (provider.js) 26.89KB 9.04KB
i18n (useDisplayLocale.js) 2.85KB 1.45KB
i18n (useObjectLabel.js) 34.34KB 9.17KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 38.84KB 10.94KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 4.39KB 1.66KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 13.52KB 4.88KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.24KB 2.16KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 8.39KB 3.10KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 15.16KB 3.68KB
plugin-calendar (index.js) 49.00KB 13.91KB
plugin-charts (index.js) 71.39KB 19.92KB
plugin-chatbot (index.js) 194.53KB 46.34KB
plugin-dashboard (index.js) 131.43KB 34.44KB
plugin-designer (index.js) 215.51KB 44.29KB
plugin-detail (index.js) 251.39KB 65.04KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 134.16KB 33.47KB
plugin-gantt (index.js) 167.16KB 40.99KB
plugin-grid (index.js) 208.18KB 56.62KB
plugin-kanban (index.js) 55.44KB 15.73KB
plugin-list (index.js) 112.73KB 27.69KB
plugin-map (index.js) 20.49KB 6.83KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 43.42KB 11.92KB
plugin-timeline (index.js) 30.10KB 8.74KB
plugin-tree (index.js) 9.33KB 3.25KB
plugin-view (index.js) 84.54KB 20.84KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.66KB 3.50KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 81.07KB 26.86KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.63KB 2.18KB
react (schema-input.js) 2.32KB 1.24KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 6.58KB 2.74KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 5.55KB 2.45KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (parse.js) 20.57KB 5.88KB
sdui-parser (provenance.js) 3.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 13.64KB 4.59KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 1.00KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 2.93KB 1.49KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (expression.js) 0.20KB 0.18KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 4.74KB 2.25KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 4.73KB 2.28KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (strict-authoring-face.js) 14.27KB 5.47KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@os-justin
os-justin marked this pull request as ready for review September 9, 2026 02:27
@os-justin
os-justin enabled auto-merge September 9, 2026 02:27

Copy link
Copy Markdown
Collaborator Author

Contract review — accepted, flipped out of draft, auto-merge armed. Green on 30 of 33 with three shards still running; nothing failed.

This is the decision tree's prescribed output, not a half-finished fix: reachability came back YES, so the card's own tree routes to "report with the measurement and STOP", and what ships is seven pins and an empty-frontmatter changeset — no source, no type, no behaviour.

Two of the card's own premises were falsified, and the second one would have shipped a non-fix.

The card guessed the inputs were this repo's *.form.ts schemas; there are zero such files (0 of 1904 tracked .ts, 0 containing .form. at all) against lit controls on the same command shape. The real wide channel is a server document — RichMetadataTypeEntry.form, a Record<string, unknown> handed over as (entry?.form as any). So the required fields guards a TypeScript author and nothing else.

⭐ And the card predicts Cannot read properties of undefined (reading 'map'), while the observed throw is TypeError: s.fields is not iterable from SchemaForm.tsx:786's for-of pre-flight loop — upstream of both .map sites the card names. Leg A settles it by ablation rather than by reading: guard :786 alone and R3/R5 go red with the card's own quoted message then surfacing from :1030. A fix written to the card's text would have looked complete and left the crash in place.

Three things I checked rather than took on trust.

  1. The pin file is inside a checked program, and not merely listed. tsc -p packages/app-shell/tsconfig.test.json --listFiles reads 4474 files with the pin at fix(templates): move generator dependency ranges with the dependabot wave (#4098) #4099 — but that alone would be the "excluded tests" trap in reverse. Legs D and E prove it behaviourally: mutations produce TS2578 and TS2322 from that file.
  2. ⭐ The non-regression argument is structural, which is stronger than a passing suite. tsc -p tsconfig.json --noEmit --listFiles reads 3697 files and the new test file is not among them, with SchemaForm.tsx as the control that is. The emitting program's inputs are byte-identical to main, so nothing any form builds can have moved — and R1 is the runtime half of the same claim. That is the right way to prove a test-only change is inert.
  3. Leg E's honesty. Retyping RichMetadataTypeEntry.form produced TS2322 as the only error in the package, which makes T2 a measurement rather than a tautology — and the comment in the file was corrected to say so instead of claiming the pin cannot fail. That correction is worth more than the pin.

The declared narrowing is acceptable because it is measured. The full app-shell suite hit the container's foreground budget (exit 124 — a budget stop, not a failure, and named as such), so the run was narrowed to the change's blast radius: of 41 tracked files importing SchemaForm or form-spec, 39 are under views/metadata-admin/ and the other two are a re-export and ObjectHooksPanel.tsx; both directories were run in full and the remainder declared to CI. Narrowed to a measured radius, not to a convenient one.

⚠️ Carried forward, and it is the thing most likely to be lost: these pins pin the crash. When the fix lands they go red and must be rewritten in the same commit, and what they protect — that this is a throw and not a silent drop — has to survive the rewrite. ⛔ Deleting them is not a resolution. Same shape as the #8071 pin on objectui#8730.

The ruling on the escalation is on objectui#8725: arm A fenced, arms B and C ruled in, parts 1 and 2 land together, and the unresolvable-group question is answered by consistency with plugin-form's resolver rather than by a second answer invented in SchemaForm. That card is blocked on #8727 (now in the merge queue) and gets re-dispatched as one unit when it lands.


Generated by Claude Code

@os-justin
os-justin added this pull request to the merge queue Sep 9, 2026
Merged via the queue into main with commit 32f1008 Sep 9, 2026
35 checks passed
@os-justin
os-justin deleted the claude/issue-8725-formsectionspec-group-reachability branch September 9, 2026 02:50
os-elon-musk pushed a commit that referenced this pull request Sep 28, 2026
…the shared resolver (objectui#8725)

Part 1: FormSectionSpec.fields becomes optional, matching @objectstack/spec's
FormSection, where `group` is the other way to declare a section's members.

Arm B: every read of a section's `fields` in SchemaForm now sees a resolved
section. A { group } section goes through @object-ui/plugin-form's
resolveSectionGroupReferences (the resolver ObjectForm and the console FormPage
already use) before the pre-flight loop that used to throw
"s.fields is not iterable". SchemaForm hosts carry no object definition, so it
is called with objectDef null and resolvable false: a group resolves empty and
the dangling key is reported, which is the resolver's defined answer. A section
declaring neither `fields` nor `group` still throws, now a TypeError naming it.

The measurement pins of PR #8739 went red with this change and are rewritten in
the same commit onto the ruled behaviour; the two type-level collaterals the
widening surfaced (PIN D and mergeServerFields.test.ts) read the optional key
through NonNullable and a non-null assertion.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN
akarma-synetal pushed a commit to akarma-synetal/objectui that referenced this pull request Sep 28, 2026
… of crashing, and the form-section types match the spec (objectui#8725) (objectstack-ai#10902)

Fixes objectstack-ai#8725
Clause-②: yes

Implements the PM ruling on objectui#8725 (comment 5594804560), relayed
by triage 5858999555 and claimed by the `domain:ui` seat 2 claim
5863212314. Session:
`https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN`.

## What changed

- **Part 1.** `FormSectionSpec.fields` is optional in `form-spec.ts`,
matching `@objectstack/spec`'s `FormSection`. In the spec, `group` is
the other way to declare a section's members.
- **Arm B.** `SchemaForm` resolves a form's sections once, in a new
module-private `resolveFormSections`, before any read of `fields`. The
pre-flight `for…of` in `SchemaFormBody` is one of those reads, and it
was the one that threw first. A `{ group }` section goes through
`@object-ui/plugin-form`'s `resolveSectionGroupReferences`, the resolver
`ObjectForm` and the console `FormPage` already use.
`SectionedSchemaForm` now takes the resolved sections, typed
`ResolvedFormSection` (`fields` present), so the simple and tabbed reads
cannot see an unresolved section. A section declaring neither `fields`
nor `group` still throws, now as a `TypeError` that names the section. ⛔
No `?? []` on any section's `fields`.
- **Behaviour change beyond the crash.** A section carrying both
`fields` and `group` (a shape `@objectstack/spec` 17.4.0 refuses at
parse, re-measured) now takes the resolver's answer for its `group`. In
a metadata-type editor that is an empty section plus the same
`console.error`, where it used to render its enumerated `fields`. Forms
none of whose sections carries a `group` key are unchanged: the resolver
returns such a list by identity.
- **Arm C, last.** `RichMetadataTypeEntry.form` is `FormViewSpec`
instead of `Record OF (string, unknown)`. Its JSDoc says this is a TYPE
on an unvalidated server document, not a check of it, and names the
measured shape gaps (below). The `as any` casts at the three
`ResourceEditPage` reads and the one `EmbeddedItemEditor` read are gone.
`EmbeddedItemEditor`'s fallback form slot takes the same type; no
fallback entry declares a form.
- **Pins.** The objectstack-ai#8739 crash pins went red with the fix and were
rewritten in the same commit (arm C's type pin moved with arm C).
Type-level collateral: `FormSectionSpec['fields'][number]` is now read
through `NonNullable` in `form-spec.containers.test.tsx` PIN D and in
the console's `FormPage.fieldSpec.test.ts`, and four
`mergeServerFields.test.ts` reads use `!`. The `!` throws; `?? []` would
have made their `not.toContain` legs vacuous.
- **Changesets.** `.changeset/8725-formsection-group-resolves.md` bumps
`@object-ui/app-shell` `minor` with a **BREAKING (types)** banner (see
the consumer sweep). The pending measurement entry
`.changeset/quiet-pans-repeat.md` gets a dated note, in the
objectui#10533 form, with byte-identical (empty) frontmatter.

### What object definition `SchemaForm` resolves against, measured

The resolver resolves `group` against the bound object's `fieldGroups`.
`SchemaForm`'s 13 production call sites are all metadata-type editors:
forms carrying `data: { provider: 'schema', schemaId }`. The
`/meta/types` entry carries a `schema` and a `form` but no field groups:
`RichMetadataTypeEntry` declares none, and objectstack's
`metadata-protocol`, `objectql` and `rest` sources have zero
`fieldGroups` hits. No host hands `SchemaForm` an object definition. So
the resolver is called with `objectDef: null, resolvable: false`. The
second is its own documented flag for "this form can never load an
object definition". Every `{ group }` section here is therefore the
ruling's "group that names no declared field group", and it gets the
resolver's defined answer for that case.

⚠️ This departs from the dispatch's first suggested pin ("renders the
resolver's fields, matching FormPage for the same document"). That pin
presupposes an object definition this component never has. Adding an
`objectDef` prop would put an input with zero producers on the published
component. The pin is written instead against the resolver called with
`SchemaForm`'s own inputs. That is the same answer `FormPage` gives for
the same section over an object that does not declare the group (H2 b).

## H1 to H3

**H1 (confirmed on base `45dbf1cba`).** A server-shaped form `{ type:
'simple', data: { provider: 'schema', schemaId }, sections: [{ group:
'contact_info' }] }` makes `SchemaForm` throw `TypeError: s.fields is
not iterable`. The `{ fields: ['a'] }` control renders `BasicsField A`.

**H2 (measured, resolver and `FormPage.buildSections` over a `ticket`
object declaring `contact_info` and `billing`).**

| case | `resolveSectionGroupReferences` | `FormPage.buildSections` |
|---|---|---|
| (a) `{ group: 'billing' }` | `{ name: 'billing', label: 'Billing
Details', fields: ['invoice_no','po_number'] }`, no diagnostic | label
`Billing Details`, fields `invoice_no, po_number` |
| (b) `{ group: 'no_such_group' }` | `{ fields: [] }` plus one
`console.error` naming the group, the object and `fieldGroups` | no
label, zero fields, one `console.error` |
| (b) no objectDef, `resolvable` default | `{ fields: [] }`, **no**
diagnostic (read as a load in flight) | n/a |
| (b) no objectDef, `resolvable: false` | `{ fields: [] }` plus the same
`console.error` | n/a (the arm `SchemaForm` takes) |
| (c) `{ fields: ['channel'], group: 'billing' }` | the billing section;
authored `channel` dropped, no diagnostic | `Billing Details` with
`invoice_no, po_number` |
| neither, `{ label: 'X' }` | returned untouched, by identity | label
`X`, zero fields, silent (FormPage's own `?? []`) |

**H3 (reader census).**
- *Typed reads of `FormSectionSpec.fields`, found by the compiler.* With
part 1 alone, the app-shell src program reports three TS18048 errors,
all in `SchemaForm.tsx`: the pre-flight `for…of`, the `renderSection`
`.map` and the tabbed `.some`. All three now read `ResolvedFormSection`
(arm B). The test programs report PIN D (TS2537) plus four TS18048 in
`mergeServerFields.test.ts`. The console test program reports TS2537 on
the `FormPage.fieldSpec.test.ts` element path, which cascades into its
excess-key directive. All are fixed as above.
- *Guarded or untyped reads, found by grep.*
`mergeServerFields.formDeclaredFields`, and the `dashboard-schema` /
`page-schema` / `report-schema` / `view-schema` adapters, read `s.fields
?? []` over the BUNDLED spec forms. These predate this change. Measured
against installed spec 17.4.0, 17 bundled metadata forms (75 sections,
222 field rows) carry no `group` section and no section without
`fields`, so these adapters see only enumerated sections.
`ResourceEditPage`'s issue-label lookup is `Array.isArray`-guarded. For
a `{ group }` section it falls back to the schema title, the same thing
`SchemaForm` shows after resolving the section empty. `FormPage`'s later
`sec.fields` reads take its `RenderableSection` rows, which
`buildSections` builds from the resolver's output. `ObjectForm` resolves
first (objectui#7051). `metadata-form-i18n` and `ViewPreview` guard with
`Array.isArray`. `ViewPreview` spreads the section, so `group` survives
and `ObjectForm`'s resolver still resolves it.
- *`RichMetadataTypeEntry.form`.* It has four reads, in
`ResourceEditPage` (two `SchemaForm` handoffs and the label lookup) and
`EmbeddedItemEditor` (one). All are typed now. `SchemaForm` is the only
renderer.

**Arm C's server-shape check.** The spec's parsed `FormView` type is not
assignable to `FormViewSpec`. A per-key probe finds 12 incompatible
positions. Section level: `label`, `visibleWhen`, `visibleOn`, `fields`.
Field level: `options`, `label`, `placeholder`, `helpText`, `colSpan`,
`visibleWhen`, `visibleOn`, `fields`. These are the narrowings
`form-spec.ts` already declares: `I18nLabel` versus `string`,
`ExpressionInput` versus `VisibilityPredicate`, and the 26-key converged
leaf. The values measured on the 17 bundled forms stay within
`FormViewSpec`. Every label is a string, every predicate is a string or
has `source`, and every `colSpan` is 1 to 4. The exceptions are keys
`FormFieldSpec` does not declare: `span` (the parse default `'auto'`, on
all 222 rows) and `keyField` (one `objectForm` row). Reported per the
ruling, not widened. Whether a live `/meta/types` response ever carries
a locale-map label is **NOT MEASURED** (no server in this run).

## Pins and ablation

The pin file `SchemaForm.groupSectionReachability-8725.test.tsx` has two
parts. Runtime (vitest, per-test JSON reporter):
- CONTROL (`fields` section renders)
- ORDER (resolver's fields, resolver's order, siblings intact)
- DIAGNOSTIC (a group naming no declared group renders empty AND
`console.error` names the group, the `schemaId` and `fieldGroups`)
- TABBED (the tabbed arm resolves and keeps its other tabs)
- REFUSAL ×2 (a section with neither key throws a `TypeError` naming it,
simple and tabbed)

Type-level (judged by `tsc -p packages/app-shell/tsconfig.test.json`):
- T1: `{ group }` compiles as `FormSectionSpec`, with a
`@ts-expect-error` negative control on `{ group: 42 }`.
- T2: `RichMetadataTypeEntry['form']` equals `FormViewSpec` and refuses
an undeclared key.

| leg | tree | result |
|---|---|---|
| head | `496c63c061` | 6/6 passed; app-shell `type-check` exit 0 |
| base: the five changed sources checked out at `45dbf1cba`, head pins
kept | proved on disk (5 blobs equal BASE, not HEAD); restored by state
(`git diff HEAD` empty, 5 blobs equal HEAD) | runtime 1 passed / 5
failed: CONTROL green; ORDER, DIAGNOSTIC and TABBED fail on `expected
TypeError: s.fields is not iterable to be undefined`; both REFUSAL pins
fail on `expected 's.fields is not iterable' to contain '"Contact"'`; 0
suite deaths. tsc: T1 TS2322 plus TS2344, T2 TS2344 plus TS2578 |
| leg 1: arm B's resolution reverted (the mapping reads `form.sections`
instead of the resolver's output) | anchor 1→0, injected 0→1, blob
changed, restored | exactly ORDER, DIAGNOSTIC and TABBED red; CONTROL
and both REFUSAL pins green |
| leg 2: the report silenced (`resolvable: false` becomes `true`) | same
proof | **first run NEGATIVE**: all green, because the test's own
resolver call also reported and the console was read after it. The pin
was fixed to read the console right after render (`b392cbd44f`). Rerun:
DIAGNOSTIC alone red |
| leg 3: arm-A caricature (a memberless section becomes `fields: []`) |
first attempt **VOID**: the replacement contained the anchor, and
`ablation-replace.mjs` refused it (anchor 1→1). Rerun with a disjoint
anchor landed | both REFUSAL pins alone red |

Each leg ran from a committed tree through `ablation-replace.mjs` WRAP
mode, with EXIT/INT/TERM restore on absolute paths and restore proven by
blob hash plus `git diff HEAD`. No build is needed: the pin imports
`./SchemaForm` relatively, and vitest aliases `@object-ui/plugin-form`
to its `src`, so no `dist` is on the path. Base leg and leg 1 were rerun
on the final head.

## Consumer sweep (a gate)

`git grep` for
`FormSectionSpec|FormViewSpec|RichMetadataTypeEntry|resolveSectionGroupReferences|\bSchemaForm\b`
over `packages/*/src/*` and `apps/*/src/*` returns 113 files. The
population is 5230 files; the control is
`metadata-admin/SchemaForm.tsx`, 1 hit. Of the 113, 56 are tests.
Outside `src`, the hits are changesets, CHANGELOGs, docs and one script
test. Every hit test was run, plus every `FormPage.*` test and the whole
`metadata-admin/` (inspectors included) and `studio-design/`
directories. All ran at `496c63c061`, under the verify lock, JSON
reporter, requested-versus-reported file counts reconciled:

| chunk | files | tests | result |
|---|---|---|---|
| console `FormPage.*` (23), plugin-form (2), core ratchet (1),
`scripts/__tests__/one-authority-per-exported-name-6273` (1) | 27 | 219
| 219 passed, 0 suite deaths |
| `packages/app-shell/src/views/metadata-admin/` (3 chunks) | 329 | 3935
| 3934 passed, 1 skipped (a pre-existing
`flow-node-config.spec-reconciliation` case), 0 suite deaths |
| `packages/app-shell/src/views/studio-design/` | 67 | 365 | 365 passed,
0 suite deaths |

Type-checks, after building the dependency closure `pnpm --filter
'@object-ui/console^...' build` (33 packages), all at `496c63c061`:
- `@object-ui/app-shell` exit 0.
- `@object-ui/console` exit 0.
- `@object-ui/plugin-form` exit 0.

The importers of these types are app-shell and the console. The `core`
and `react` hits name `SchemaForm` in comments only.

Reverse verification (console reads the REBUILT `.d.ts`): a temporary
console file typed `{ group: 'contact_info' }` as `FormSectionSpec`,
which compiled, and gave `RichMetadataTypeEntry['form']` an undeclared
key, which was refused with TS2353 (`does not exist in type
'FormViewSpec'`). The file was then removed.

**Semver.** Outside `SchemaForm`, whose three reads (TS18048 under part
1) are what this change fixes, no published source had to change to
compile. The other readers that changed were tests: two type-level test
pins (app-shell PIN D, console `FormPage.fieldSpec.test.ts`) and four
`mergeServerFields` assertions. That is exactly what an external reader
of `section.fields` faces, hence `minor` plus the **BREAKING (types)**
banner and the `!`. ⛔ Not `major`.

## Gates

All verdict lines were read with the exit code captured before any pipe,
at `496c63c061`:
- `check-changeset-presence` exit 0: "9 source file(s) of 2 released
package(s) changed, and this change declares 1 changeset(s)".
- `check-changeset-no-major` exit 0.
- `check-changeset-overwrite` exit 0. It reports `quiet-pans-repeat.md`
as modified (the dated note: case 2, prose correction, frontmatter empty
before and after).
- `check-changeset-claims` exit 0. Five pending changesets name touched
files (6247, 5596, 5542, 5040, 5595). Each paragraph was re-read and
none became false.
- `check-changeset-fixed` exit 0.
- `check:pending-changeset-literals` exit 0.
- `check:control-bytes` exit 0 (9149 files), plus a manual control-byte
scan of the 11 changed files: no hits.
- `check:new-line-citations`: "0 new citation(s)".
- `check:phantom-deps` and `check:unused-deps` exit 0.
`@object-ui/plugin-form` was already declared; `AppContent` and
`MetadataProvider` already import it statically, so the eager closure
gains no module.
- `check:spec-symbols` exit 0.
- `check:vi-mock-inherit` exit 0. Every app-shell `vi.mock` of
`@object-ui/plugin-form` spreads `importOriginal`.
- `check:test-path-roots`, `check:unreferenced-sources` and
`check-type-check-coverage` exit 0.
- `check-governed-queue-guard --test` on the 11 paths: NOT GOVERNED.

ESLint, declared narrowing: the 9 changed TS files, counted from
`--format json`, gave 0 errors and 90 warnings, all on pre-existing
lines. The four removed `as any` casts take their warnings with them.
The population is `eslint.config.js`'s `**/*.{ts,tsx}` blocks.
Type-aware linting is not configured there (no `parserOptions.project`
or `projectService`), so this diff cannot move a verdict on an untouched
file. The repo-wide `pnpm lint` is CI's.

NOT MEASURED:
- `check:eager-closure`, which needs a console `vite build`.
`performance-budget.yml` runs it.
- `check:readme-exports`: no export changed.
- The full `@object-ui/app-shell` suite outside `metadata-admin/` and
`studio-design/`: declared to CI. Every file that names these symbols is
inside the swept set.

## Serial

The open-PR file lists were re-read before the first edit (9 open PRs,
no overlap) and before the final push (5 open PRs). Nothing touches
`metadata-admin/form-spec.ts`, `SchemaForm*` or
`packages/plugin-form/src`, or any other file here. The one exception is
the release PR objectstack-ai#5400 (`changeset-release/main`), which deletes pending
changesets, `quiet-pans-repeat.md` among them. If it lands first, the
dated-note hunk becomes a modify/delete conflict, resolved by taking the
deletion. `git merge-tree --write-tree` against a fresh `origin/main`
(`244d516df4`) is clean. None of main's 226 files changed since the base
names a swept symbol. The merge queue was empty at branch time.

## Fix round 1 (contract review), head `e8422e785e`

One text-only commit, `e8422e785e`, on top of `496c63c061`:
- **Changeset, closing line.** Replaced. The "spec refuses at parse"
clause was re-measured on installed `@objectstack/spec` 17.4.0:
`FormSectionSchema` REJECTS `{ fields, group }` ("mutually exclusive"),
and `FormViewSchema` rejects it at `sections.0.group`. Controls: `{
group }` alone and `{ fields }` alone both ACCEPT.
- **Changeset, BREAKING paragraph.** It now says `SchemaForm`'s three
reads were the published source part 1 broke. The frontmatter is
byte-identical.
- **`RichMetadataTypeEntry.form` JSDoc.** Comment lines only; the typed
line `form?: FormViewSpec;` is byte-identical. `FormViewSpec` is not
widened.
- **REFUSAL pin.** `expect(html).toBe('')` is dropped. It could only
pass, because `html` was assigned only when nothing threw. `html` is
gone from the helper. The pin stays red on base for its stated reason
and red under the arm-A caricature.

Verdicts at `e8422e785e`, under the verify lock:
- **Pin file:** 6/6 passed.
- **Base leg** (the five changed sources at `45dbf1cba`, restored by
state): 1 passed, 5 failed. Both REFUSAL pins fail on `expected
's.fields is not iterable' to contain '"Contact"'`. 0 suite deaths.
- **Ablation leg 3** (arm-A caricature): both REFUSAL pins, and only
they, go red with `expected undefined to be an instance of TypeError`.
- **Changeset-reading tests:** 11 `scripts/__tests__` files, 369/369
passed. They are `check-changeset-claims`, `-presence`, `-overwrite`,
`-no-major`, `-fixed`, `check-pending-changeset-literals`,
`changeset-polarity-census`, `changeset-release-action-ref-pin`,
`render-changeset-claims-comment`, `check-spec-range-floors` and
`quick-reference-current-release-4143`.
- **`@object-ui/app-shell` type-check:** exit 0, after rebuilding its
dependency closure.
- **Gates**, all exit 0:
- `check-changeset-claims`: same 5 pending changesets named, none false.
- `check-changeset-presence`: "9 source file(s) of 2 released package(s)
changed, and this change declares 1 changeset(s)".
- `check-changeset-overwrite`: reports the `quiet-pans-repeat.md` dated
note.
  - `check-changeset-no-major`: "No changeset declares a `major` bump".
- `check-changeset-fixed`, `check:pending-changeset-literals`,
`check:control-bytes` and `check:new-line-citations` (0 new).

## Acceptance notes

- **Scope grew by three files beyond the claim's list.** Arm C's retype
lives in `useMetadata.ts`, and dropping its casts touches
`ResourceEditPage.tsx` and `EmbeddedItemEditor.tsx`. The console's
`FormPage.fieldSpec.test.ts` took the type collateral.
- `resolveSectionGroupReferences` silently drops authored `fields`
beside a `group` that resolves (H2 c). The resolver's own header says it
refuses "the shapes the spec refuses, out loud rather than silently",
and `GROUP_OWNED_SECTION_KEYS` does not list `fields`. The spec door
refuses that shape at parse. No reach was measured, so this is not
filed. In `SchemaForm` the group never resolves, so the dangling-group
`console.error` fires regardless. Carrier: none.
- `FormPage.buildSections` renders a section with neither `fields` nor
`group` as a silent empty card (its own `?? []`). The spec door refuses
that shape. Not touched here (objectstack-ai#8725's ruling covers `SchemaForm`).
Carrier: none.
- The bundled-form adapters (`view-schema` and its three siblings) would
drop a `{ group }` section of a BUNDLED spec form silently, because they
filter out sections whose `fields ?? []` is empty. No bundled form
authors one (measured above). Carrier: none.
- `requiredInGatedSection.sectionMemberNames` reads enumerated members
only, so that advisory does not examine a `{ group }` section's members.
This is a read-only inference; carrier: none.
- `SchemaForm` gains a module-level diagnostic: one `console.error` per
(schemaId, group) pair, from the resolver's own `reportOnce`.

---
_Generated by [Claude
Code](https://claude.ai/code/session_014mXUNuFomfj24w7s1pZzhN)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants