Skip to content

fix(app-shell): compile a reference typed into ConditionBuilder's value box as a reference - #6384

Merged
os-support-ai merged 1 commit into
mainfrom
claude/issue-6293-conditionbuilder-reference-quoting
Aug 25, 2026
Merged

fix(app-shell): compile a reference typed into ConditionBuilder's value box as a reference#6384
os-support-ai merged 1 commit into
mainfrom
claude/issue-6293-conditionbuilder-reference-quoting

Conversation

@os-support-ai

Copy link
Copy Markdown
Collaborator

Fixes#6293

fmtValue quoted anything that was not a number / true / false / null, and the row builder's value box is free text — so "this field differs from its prior value", the idiom that defines a change-detection predicate, compiled to previous == 'previous.status'. That parses, registers and evaluates, and is always false. Nothing objects at any layer: previous is a declared root, and a string literal's contents are deliberately not scanned for references by flow-ref-check or by the server-side validator.

The ruling: compile the reference

Of the two ruled arms — compile it, or refuse loudly — this takes compile. The measurement against the five consumers is below; no consumer breaks, and compiling is the better outcome because it makes the reference checkable: it is now an identifier the existing reference checkers can see, where a string literal's contents were invisible to them.

A value matching a declared root prefix now emits as the reference. The root set is record, previous, parent, user, current_user, org — this builder's own vocabulary:

  • record / user / org — exactly what the subject dropdown offers one control to the left (record.<field> from the field catalog, plus CONTEXT_SUBJECTS).
  • previous / parent — bound by evalFieldPredicate (packages/core/src/evaluator/fieldRules.ts) and by the server-side hook / validation evaluators.
  • current_user — the ADR-0068 spelling of the same identity object user names; which alias the author typed must not decide whether it reads as a reference.

Roots this builder never offers (data, os, app, features, input, vars, page) are excluded on purpose: data.csv is a plausible literal and datais bound at the shell surfaces, so capturing it would swap one silently-false predicate for another rather than for a loud one. Declaring which roots a mounting surface actually binds is caller-supplied vocabulary and belongs to objectui#6296 — see the note at the bottom.

The test is "a dotted path under a declared root", not "contains a dot": 1.2.3, filenames, and paths under unbound roots all stay literal text.

The five consumers — measured, one line each

#ConsumerReading
1views/metadata-admin/inspectors/HookDefaultInspector.tsx (hook condition)Safe, and the canonical case. Hook conditions bind previous — the showcase app ships previous.done != true && record.done == true — so previous.status now compiles to the comparison the author meant, on the surface the defect was measured on.
2views/metadata-admin/widgets.tsx (ConditionWidget → field visibleWhen / readonlyWhen / requiredWhen)Safe.evalFieldPredicate binds record, previous, and the scope extra (parent) — every emitted root this surface can see. A root it cannot see resolves to a not-ok verdict that is reported (warnPredicateFailure + the onFault passback), never a silent false.
3views/metadata-admin/inspectors/PageBlockInspector.tsx (block visibleWhen)Safe. Binds record (via RecordContextProvider, per page.zod.ts's "Binds record, current_user, page.<var>") plus the shell's predicate scope; a record.* value is the same identifier the subject dropdown already emits. previous is not bound here, but an unbound root is a loud not-ok verdict, not the silent always-false it replaces.
4views/metadata-admin/inspectors/ActionDefaultInspector.tsx (action visible + disabled, two mount sites)Safe. Same shell predicate scope — ExpressionProvider binds current_user / user / ctx.user / os.user / app / data / features — plus record from the record context. Identical reading to #3.
5views/studio-design/ObjectValidationsPanel.tsx (validation rule condition)Safe. Change detection (record.x != previous.x) is the defining validation-rule idiom; the panel stores the emitted CEL through the same writeExpressionSource envelope as the other four and post-processes nothing.

Two facts hold across all five, and both are pinned by tests:

  • The emitted reference round-trips.record.status != previous.status re-opens in ROW mode, so the builder does not flip to the raw editor the moment the author reopens what they just authored. (It could not round-trip before this change.)
  • Nothing already stored is rewritten. A persisted previous == 'previous.status' no longer round-trips byte-for-byte, so the component's existing safety rule hands it to the raw CEL editor rather than reinterpreting it — the author sees both readings and decides. No stored predicate's meaning changes.

No consumer-side tolerance is added anywhere: the repair is at the authoring surface, where the ambiguity is.

Ghost-assertion guard — both readings

Tests mount the real component and read what onCommit emits; the commit path above fmtValue is part of the defect, so a unit test of the formatter alone would not cover it.

Before — the new test file alone, on unmodified origin/main (2e11c8c5b), source untouched:

Test Files 1 failed (1)
Tests 4 failed | 4 passed (8)
× compiles a value under a declared root as the REFERENCE it plainly is
Expected: "previous == previous.status"
Received: "previous == 'previous.status'"
× compiles `record.<field>` on the value side as a reference too
Expected: "previous == record.status"
Received: "previous == 'record.status'"
× the emitted reference round-trips — reopening it stays in ROW mode
AssertionError: expected <textarea …(9)></textarea> to be null
× is NOT retroactive — an already-stored quoted literal opens in RAW mode
AssertionError: expected null not to be null

The Received line on the first assertion is the card's measurement, reproduced.

After — same file, with the repair:

Test Files 1 passed (1)
Tests 8 passed (8)

The other four assertions are the probe and the controls, and they pass on both readings by design — that is what makes them controls, and what makes the reading attributable to the input rather than to a constant: the row-mode probe (previous == null opens with a live value box), the literal control (doneprevious == 'done'), the number control (42previous == 42, unquoted), and an undeclared-root control (foo.bar and 1.2.3 stay quoted).

Gates run locally

Union re-run on the final commit b43eca6f3:

  • pnpm exec vitest run over all five consumers' suites (metadata-admin/inspectors/, ResourceEditPage.celGate, CelPredicateField.labelBinding, EmbeddedItemEditor.preview, studio-design/ObjectValidationsPanel.celGate) — 62 files, 662 passed, 1 skipped, 0 failed.
  • pnpm --filter @object-ui/app-shell run type-check (tsc --noEmit && tsc -p tsconfig.test.json) — clean. Confirmed the program actually contains both edited files via tsc -p tsconfig.test.json --listFiles (1 hit each), so "typecheck clean" is a statement about this diff.
  • eslint . over the whole @object-ui/app-shell package — 966 files, 0 errors. The one warning on ConditionBuilder.tsx is the pre-existing react-hooks/exhaustive-deps on the // first mount onlyuseMemo, present unchanged on origin/main (line 151 there).
  • check-changeset-presence, check-changeset-no-major, check-control-bytes — all green.
  • Fixture sweep: grepped packages/ and apps/ for any fixture pinning a quoted reference-shaped literal on a comparison — zero hits outside the new test file.

Scope

.changeset/6293-conditionbuilder-reference-value.mdpatch, @object-ui/app-shell. flow-ref-check, the server-side expression validator and packages/spec are untouched, and no predicate's meaning changes anywhere else.

objectui#6296 (the first-class "another field" value control) is not built here, not even partially. The repair does make it easier: REFERENCE_ROOTS is now the single place this builder states which prefixes read as references, which is exactly the seam a caller-supplied subject vocabulary would replace — a surface that declares its roots would feed that constant instead of the builder assuming them. objectui#6296 remains open and is out of scope for this PR.


Generated by Claude Code

…ue box as a reference
`fmtValue` quoted anything that was not a number / `true` / `false` / `null`, and
the row builder's value box is free text — so "this field differs from its prior
value", the idiom that defines a change-detection predicate, compiled to
`previous == 'previous.status'`. Valid CEL, `previous` is a declared root, and a
string literal's contents are deliberately not scanned for references by
`flow-ref-check` or the server-side validator: the predicate parsed, registered,
evaluated, and was always false with no author-time signal at any layer, at all
five surfaces that mount this builder.
A value matching a declared root prefix now emits as the reference it plainly is.
The root set is this builder's own vocabulary — `record` / `user` / `org` are what
its subject dropdown offers one control to the left, `previous` and `parent` are
bound by `evalFieldPredicate` and by the server-side hook / validation evaluators,
and `current_user` is the ADR-0068 spelling of the identity `user` also names.
Roots this builder never offers are excluded on purpose: `data` IS bound and
`data.csv` is a plausible literal, so capturing it would swap one silently-false
predicate for another rather than for a loud one.
The test is "a dotted path under a declared root", not "contains a dot": `1.2.3`
and paths under unbound roots stay literal text, and the literal / number controls
are unchanged. Nothing already stored is rewritten — a persisted
`previous == 'previous.status'` no longer round-trips, so the builder's existing
safety rule hands it to the raw CEL editor instead of reinterpreting it.
Pinned by mounting the real component and reading what `onCommit` emits, because
the commit path above `fmtValue` is part of the defect.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SfZeFWrhGLHmfq61xbz4q
@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Eager closure (gzip, 52 chunks)3224.3 KB3266.6 KB
Main entry chunk (gzip)154.1 KB350 KB
Entry fileindex-DlTNzAru.js
StatusPASS

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

PackageSizeGzipped
app-shell (consoleActionDispatch.js)0.20KB0.19KB
app-shell (index.js)10.96KB4.16KB
app-shell (runtime-config.js)18.10KB6.51KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)10.06KB3.86KB
auth (ActiveOrganizationStorage.js)25.05KB9.16KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)2.07KB1.00KB
auth (AuthProvider.js)40.18KB10.59KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.15KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.65KB2.22KB
auth (SocialSignInButtons.js)9.61KB3.89KB
auth (UserMenu.js)3.41KB1.23KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)40.21KB10.80KB
auth (createAuthenticatedFetch.js)8.46KB3.43KB
auth (index.js)3.19KB1.44KB
auth (invitation-status.js)1.22KB0.70KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)5.30KB1.02KB
auth (useWorkspaceAdminStatus.js)5.13KB2.35KB
collaboration (CommentThread.js)26.08KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.68KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)505.84KB114.57KB
core (index.js)5.30KB2.13KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)173.18KB47.97KB
fields (index.js)238.89KB60.02KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (fallbackInterpolation.js)6.25KB2.77KB
i18n (i18n.js)4.28KB1.75KB
i18n (index.js)3.44KB1.39KB
i18n (pickLocalized.js)7.62KB3.26KB
i18n (provider.js)26.89KB9.04KB
i18n (useDisplayLocale.js)2.85KB1.45KB
i18n (useObjectLabel.js)33.40KB8.71KB
i18n (useSafeTranslation.js)5.60KB2.33KB
layout (index.js)38.95KB10.97KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.75KB
mobile (index.js)1.55KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.72KB0.42KB
mobile (useResponsiveConfig.js)1.37KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)9.53KB3.38KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)4.64KB1.50KB
permissions (evaluator.js)5.12KB1.74KB
permissions (index.js)0.93KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.53KB
permissions (usePermissions.js)1.93KB0.88KB
plugin-ai (index.js)15.75KB3.80KB
plugin-calendar (index.js)46.66KB12.84KB
plugin-charts (index.js)64.66KB18.32KB
plugin-chatbot (index.js)188.21KB44.67KB
plugin-dashboard (index.js)133.46KB34.48KB
plugin-designer (index.js)211.95KB42.75KB
plugin-detail (index.js)245.10KB62.31KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)128.11KB31.17KB
plugin-gantt (index.js)164.14KB39.87KB
plugin-grid (index.js)201.66KB54.55KB
plugin-kanban (index.js)52.87KB14.57KB
plugin-list (index.js)112.63KB27.45KB
plugin-map (index.js)20.09KB6.62KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)43.49KB11.93KB
plugin-timeline (index.js)26.70KB7.69KB
plugin-tree (index.js)9.26KB3.13KB
plugin-view (index.js)84.55KB20.74KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.66KB3.50KB
providers (index.js)0.45KB0.23KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.62KB2.34KB
react (LazyPluginLoader.js)4.47KB1.63KB
react (SchemaRenderer.js)54.84KB18.43KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.35KB0.70KB
react (schema-input.js)2.32KB1.24KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)5.41KB2.34KB
sdui-parser (dashboard-widget-options.js)3.08KB1.30KB
sdui-parser (index.js)4.93KB2.24KB
sdui-parser (input-type.js)2.84KB1.40KB
sdui-parser (parse.js)12.13KB3.65KB
sdui-parser (provenance.js)3.66KB1.82KB
sdui-parser (types.js)0.28KB0.23KB
sdui-parser (validate.js)7.54KB2.63KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)2.74KB1.41KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)3.75KB1.85KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-inflight.js)8.87KB3.73KB
types (http-retry.js)4.32KB2.02KB
types (icon-key-migration.js)4.26KB1.63KB
types (index.js)4.72KB2.24KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (spec-ui-namespace.js)0.20KB0.19KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)6.28KB2.87KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

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

@os-support-ai
os-support-ai marked this pull request as ready for review August 25, 2026 19:13
@os-support-ai
os-support-ai added this pull request to the merge queueAug 25, 2026
Merged via the queue into main with commit 780efc0Aug 25, 2026
28 checks passed
@os-support-ai
os-support-ai deleted the claude/issue-6293-conditionbuilder-reference-quoting branch August 25, 2026 19:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants

@os-support-ai@claude