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

test(app-shell): pin the flow-node label at the producer, not the reader - #6979

Merged
os-sam merged 1 commit into
mainfrom
claude/issue-6331-flow-node-label-producer-census
Aug 31, 2026
Merged

os-sam merged 1 commit into
mainfrom
claude/issue-6331-flow-node-label-producer-census

Conversation

@claude

@claude claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #6331

The census, and the number first

Six flow-node literals across five producer call sites. Every one already writes a label. So this lands the fork's first arm: a producer-boundary pin plus the recorded reason the reader type stays optional. No live defect to grade as a Bug.

Pathspec bound — the census is not "I grepped around". Three complementary searches over the tracked tree at 7a5da1414 (git ls-files = 5885 files; 4692 under the source/data extensions), each carrying a hot control:

search bound control (a producer I already knew sets a label)
typed literals: : (FlowDesignerNode|FlowNodeLike|FlowNode) = { all tracked *.ts,*.tsx,*.js,*.mjs,*.cjs found FlowCanvas.tsx:273 addNode ✅
every write into a nodes array (nodes: [, .nodes.push(, [...nodes,, appendArray(nodes, spliceArray(nodes) same found FlowCanvas.tsx:281 + FlowPreview.tsx:144 ✅
node-type literals (type: '<one of the 20 FLOW_BUILTIN_NODE_TYPES>') same, plus *.json,*.yml,*.yaml (0 hits — no flow fixtures on disk) found apps/console/src/preview-samples.ts ✅

The third search is the one that earned its keep: it surfaced buildFlowSkeleton, which a head-capped grep had hidden from me a step earlier. A zero from a truncated pipe reads exactly like a zero from a clean tree.

The producers, and what enforces each

# producer writes a label as enforced by
1 FlowCanvas.addNode — palette pick and the + append handle defaultNodeLabel(type, locale) ⚠️ nothing — accident
2 FlowCanvas.insertOnEdge — "Insert node here" defaultNodeLabel(type, locale) ⚠️ nothing — accident
3 FlowCanvas.addReviseLoop — the ADR-0044 one-click loop tr('engine.flowCanvas.awaitingRevision') ✅ flow-canvas-seeds.spec-parse.test.tsx clicks the real button and safeParses the emitted node
4 FlowPreview.handleAddNode — the empty-flow seed defaultNodeLabel('start', locale) ⚠️ nothing — accident
5 buildFlowSkeleton — Studio "New flow" (mints 2 nodes) required positional startLabel / endLabel ✅ omitting one does not type-check, and createConformance.test.ts parses the whole draft

Not producers, checked and excluded with the reason:

  • FlowCanvas.persistPosition, deleteNode, and flow-nested-selection.ts's nested writes — all re-spread an existing node ({ ...node, position }) or filter. They cannot be where a label is first written, and cannot drop one: FlowNodeInspector.patchNode is { ...node, ...updates }.
  • anchors.ts flow createDefaults — seeds nodes: []. No node.
  • flow-region-view.tsx — nested regions render read-only ("no drag / insert"), so there is no nested-node producer.
  • Paste — the card lists it; there is none for spec flows. The only paste producer in the repo is ProcessDesigner's BPMN clipboard, and that is BPMNNode from @object-ui/types (a different shape, label already required there) with no path to a flow save.
  • Import — the card lists it; there is no metadata-import surface in this repo (0 hits).
  • apps/console/src/preview-samples.ts — read-only gallery data, not an authoring path.

⭐ "They all happen to" vs "something prevents otherwise" — measured, not argued

That distinction is the whole value of the census, so it was taken as a measurement on origin/main, before any change here. Deleting the label line from insertOnEdge and from FlowPreview.handleAddNode (mutation proved on disk in both directions: anchor counts 1→0, replacement marker 0→1, and blob hashes moved) left everything green:

VITEST_EXIT=0    Test Files  3 passed (3)   Tests  58 passed (58)
TSC_EXIT=0
ESLINT_EXIT=0    ✖ 7 problems (0 errors, 7 warnings)

Three of five producers were held only by every current author happening to write the line. That is the finding, and it is why the pin is at the producer.

Why not the reader type — do not re-litigate

FlowNodeSchema requires label; FlowDesignerNode makes it optional. That is a layer difference the repo already adjudicated in that interface's own doc comment — a canvas holds nodes the user has dropped but not finished. #6287 measured making it required on the reader side: tsc exit 0, zero errors, because every node arrives through as FlowNodeLike[] casts out of Record<string, unknown> and a cast bypasses a required member. It is also mildly harmful: node.label ?? '' and node.label || node.id are guards the optional type forces. So this PR touches no declared type — Clause-② stays no. The reasoning is now recorded on FlowDesignerNode.label itself, which is what stops the question being opened a third time.

What the pin is

flow-node-producers.label.test.tsx, in two halves, because neither is enough alone:

  1. Observed output. Each producer is driven through the affordance a user clicks, and the node it emitted is safeParsed whole against the spec. ⛔ Never a hand-composed node — the sibling seeds file composes { id, type, label: defaultNodeLabel(type), ...defaultNodeExtras(type) } itself, which is right for its subject (the seed extras) and is exactly why it stayed green through the ablation above: it supplies the label, so it can never see a producer drop one.
  2. A census ratchet over source. The render half can only speak for producers it renders. The scan enumerates node literals from source across previews/, inspectors/ and studio-design/ and refuses one that writes no label, with a hot control so a scan that matches nothing fails loudly instead of reading as clean. Its blind spot (an untyped literal assembled elsewhere and cast in) is stated in the file.

Two-world proof, on the committed pin, restoring by hash equality:

mutation before this PR with the pin
addNode drops label (blob efc46c8f, byte-identical run) 58/58 green, tsc 0, eslint 0 errors 2 failed — FlowCanvas.addNode + the census ratchet
insertOnEdge + FlowPreview.handleAddNode + buildFlowSkeleton drop label 58/58 green 4 failed — all three producers by name, plus the ratchet listing 3 offenders

Question 3 — what the server does

⚠️ Cited from the schema, not from a run. No server was booted. Measured against the installed @objectstack/spec@17.2.0 (lockfile-resolved) by probe:

FlowNodeSchema.safeParse({ id, type: 'start', label: 'Start' })  → success
FlowNodeSchema.safeParse({ id, type: 'start' })                  → invalid_type at path ["label"]
FlowSchema.safeParse({ …flow, nodes: [{ id, type: 'start' }] })  → invalid_type at path ["nodes", 0, "label"]

So a label-less node is refused at the flow level too. Two related readings, both stated so they are not mistaken for the pin's subject:

  • The same schema runs live in the client (clientValidation.ts maps flow → FlowSchema, on both the create and edit doors), and flow-problems.ts maps a nodes.<n>.… path onto that node — so the refusal already surfaces as an on-canvas badge and a Problems-panel row while the author types.
  • FlowNodeSchema accepts label: '', and the inspector's Label field commits patchNode({ label: v }) — so clearing it yields an empty string, never an absent key. Noted, not changed: making non-empty a rule would be a second de-facto contract this card did not ask for.

Verification

All on the final commit 8cf0859a6, exit codes captured before any pipe, each result quoted from the gate's own verdict line.

  • Dependency closure built first (pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build, exit 0) — the worktree had no dist anywhere, and an unbuilt run reads as a false red.
  • vitest, root-relative, 8 paths in → 8 files reported, so no silent wrong-package run: Test Files 8 passed (8) / Tests 146 passed (146).
  • tsc -p packages/app-shell/tsconfig.test.json --noEmit → exit 0. --listFiles confirms both changed files are in the checked program (1 hit each), so the green is a measurement rather than an exclusion.
  • eslint . over the whole packages/app-shell package, unnarrowed — population read from eslint's own config via --format json: 1026 files, 0 errors, 2798 pre-existing warnings, and both of this PR's files contribute 0 errors and 0 warnings.
  • Gates: check:control-bytes OK (5802 files) · check:spec-symbols 0 untriaged collisions · check:vi-mock-specifiers OK · check:vi-mock-inherit OK · check:i18n-keys OK · check:phantom-deps OK · check-changeset-presence OK (1 changeset, empty frontmatter — the explicit "releases nothing" exemption) · check-changeset-no-major OK.

Changeset carries an empty frontmatter: a test plus a comment, no runtime behaviour and no published type changed.


Generated by Claude Code

FlowNodeSchema requires `label`; the designer's FlowDesignerNode makes it
optional, and that is a layer difference, not drift. Both hold only if
something guarantees a node acquires a label before save.

Census of every flow-node construction path: six node literals across five
producer call sites, all already writing a label — but three of the five were
enforced only by accident (deleting the label line from insertOnEdge and from
FlowPreview.handleAddNode left vitest, tsc and eslint all green on main).

Adds flow-node-producers.label.test.tsx: each producer driven through its real
affordance with the emitted node safeParse'd whole against the spec, plus a
source census that refuses a node literal writing no label. Records on
FlowDesignerNode.label why the reader-side type stays optional (a cast bypasses
a required member; the optional type forces two real absent-label guards).
@github-actions github-actions Bot added the tests label Aug 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 45 chunks) 3180.2 KB 3222.7 KB
Main entry chunk (gzip) 143.6 KB 350 KB
Entry file index-BAL6K3Gv.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) 12.46KB 4.71KB
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) 5.13KB 2.35KB
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) 512.09KB 116.42KB
core (index.js) 5.30KB 2.13KB
create-plugin (index.js) 10.08KB 3.26KB
data-objectstack (index.js) 177.67KB 49.45KB
fields (index.js) 243.65KB 61.63KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 4.28KB 1.75KB
i18n (index.js) 3.44KB 1.39KB
i18n (pickLocalized.js) 7.62KB 3.26KB
i18n (provider.js) 26.89KB 9.04KB
i18n (useDisplayLocale.js) 2.85KB 1.45KB
i18n (useObjectLabel.js) 33.40KB 8.71KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 38.95KB 10.97KB
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.55KB 0.62KB
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 (useResponsiveConfig.js) 1.37KB 0.63KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 11.71KB 4.29KB
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) 5.12KB 1.74KB
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.75KB 3.80KB
plugin-calendar (index.js) 46.92KB 12.93KB
plugin-charts (index.js) 64.68KB 18.35KB
plugin-chatbot (index.js) 190.53KB 45.18KB
plugin-dashboard (index.js) 133.48KB 34.51KB
plugin-designer (index.js) 212.87KB 43.19KB
plugin-detail (index.js) 247.26KB 63.17KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 133.11KB 32.61KB
plugin-gantt (index.js) 165.21KB 40.37KB
plugin-grid (index.js) 202.08KB 54.61KB
plugin-kanban (index.js) 53.14KB 14.64KB
plugin-list (index.js) 113.15KB 27.59KB
plugin-map (index.js) 20.20KB 6.66KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 43.51KB 11.94KB
plugin-timeline (index.js) 29.05KB 8.37KB
plugin-tree (index.js) 8.98KB 3.08KB
plugin-view (index.js) 85.79KB 21.10KB
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) 76.75KB 25.49KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 3.11KB 1.48KB
react (schema-input.js) 2.32KB 1.24KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 5.41KB 2.34KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 4.93KB 2.24KB
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) 10.35KB 3.60KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 2.74KB 1.41KB
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 (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.72KB 2.24KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
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 (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 3.40KB 1.71KB
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

Merged via the queue into main with commit 348724e Aug 31, 2026
31 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

1 participant