Skip to content

fix(app-shell): let a ConditionBuilder mount declare its CEL lint scope (objectui#8167) - #9494

Merged
os-tesla merged 1 commit into
mainfrom
claude/issue-8167-conditionbuilder-scope-prop
Sep 14, 2026
Merged

os-tesla merged 1 commit into
mainfrom
claude/issue-8167-conditionbuilder-scope-prop

Conversation

@os-tesla

Copy link
Copy Markdown
Collaborator

Part of objectui#8167 — the structural half plus the three SETTLED mounts. The card stays open: three mounts still carry an unanswered tier question and are deliberately untouched here (see the table below).

The defect

ConditionBuilder had no scope prop at all — not on its interface, not at its own CelPredicateField mount. Every mount therefore fell through to celAuthoring's own default, whose spelling is hint.scope ?? 'flattened', and no caller could override it. So a bare status == 'done' typed into an action's Visible when linted CLEAN and then never matched: usePredicateRecordContext binds record and nothing else, and objectui#5741 Phase 2 retired the bare shorthand on runtime record surfaces. rowPredicateCanon.ts in @object-ui/core names an action renderer's visible / disabled as a row surface in its own words.

This is objectui#7727's defect at a component objectui#7727 does not touch. PR objectui#8164 turned the same defect at the conditional-formatting mount; this is the same turn at two more surfaces.

What changed

  1. scope is now an optional prop on ConditionBuilder, forwarded verbatim to CelPredicateField. Omitting it forwards undefined, so the engine hint is exactly what it was and every mount that passes nothing is unchanged. It deliberately does not derive the scope from subjects.fieldPrefix — that would silently decide the mounts whose tier is still open.
  2. scope="record" on an action's Visible when / Disabled when (ActionDefaultInspector). Conformance, not taste: the canon names those two by name.
  3. scope="record" on an object validation rule's condition (ObjectValidationsPanel). See the departure note below — the basis is not the one the dispatch gave.

The row builder at all three mounts was already emitting record. + field name. This only makes the raw expression editor agree with the rows its own sibling mode produces.

⚠️ Departure from the dispatch — the ObjectValidationsPanel basis is falsified

The dispatch justified mount 3 with: "the draft-level validator for that same surface already runs scope: 'record' (clientValidation), so the editor and the validator currently disagree about the same expression." Verified on disk, as instructed, and it does not hold:

  • clientValidation's two scope: 'record' lint calls live in validateObjectFieldRules, which lints visibleWhen / readonlyWhen / requiredWhen and formula field expressions. That is a sibling surface — the word the filing card itself uses; the dispatch upgraded it to "that same surface".
  • Nothing validates a validation rule's condition at draft level at all. So there is no editor-vs-validator disagreement about that expression to point at.

The change is still right, on a stronger and independent basis found on disk:

  • objectql's rule validator evaluates a script / cross_field condition with { record, previous } and nothing else (its checkPredicate), and since objectstack#4649 an unevaluable predicate there is fail-CLOSED — it rejects the write. A bare reference authored in this editor therefore does not merely fail to match: it makes every write to the object fail, while the editor linted it green.
  • Counter-datum, recorded so it is not re-discovered as an objection: ObjectValidationEngine.scopeFor in @object-ui/core binds the bare field names and record, and says in its own comment that objectui's own rules have always been written bare. That engine is deprecated and deliberately unwiredvalidation-engine-stays-unwired.test.ts reddens if a production module imports it — so it is not an authority on what an author should type.

I proceeded rather than stopping because the dispatch's literal stop condition was "if the validator does not run record there", and it does run record at both cited call sites; what is wrong is the sentence's claim about which surface those call sites serve. Flag this for the seat: if the seat intended the stop to fire on the surface-identity claim rather than the citation, revert mount 3 alone — the other two and the prop stand on their own.

Two smaller transcription drifts, both harmless: the card's line addresses were taken at c14d3a090 / ff1d5ea and have since moved (the ConditionBuilder mount the card calls :368 is :371 on 6d5db7b; clientValidation's :792 / :806 are now the comment and two calls further down). Cited by content here per AGENTS.md commandment 11.

Deliberately OUT — effect-today scope recorded, as the ruling asked

All four pass no scope and therefore run the celAuthoring default, i.e. flattened, both before and after this change:

mount authors scope in effect today why untouched
PageBlockInspector page block visibleWhen flattened node tier — unanswered
widgets.tsx ConditionWidget any schema-driven predicate key flattened its surface is whatever the host schema points it at — unanswered
HookDefaultInspector hook condition flattened server-trigger tier — unanswered
FlowNodeConfigField flow node condition flattened marked CORRECT by the card; flow tier is not a row surface (objectui#5738 stand-down 3)

None were "tidied" with an explicit flattened: an explicit value is a claim, and the claim is what is unsettled.

Pins — before / after, from real run output

New file ConditionBuilder.mountScope.test.tsx, running against the real @objectstack/formula (no stub — a stub would let the suite stay green while asking the engine the wrong question, which is the failure being pinned). The red leg types the bare shorthand, not a "did the prop arrive" probe.

Engine verdicts measured directly on the installed engine, both directions:

scope 'flattened' · status == 'done'         -> ok:true,  no findings          <- the defect
scope 'record'    · status == 'done'         -> ok:false, "bare reference `status` … Write `record.status`."
scope 'record'    · record.status == 'done'  -> ok:true,  no findings

AFTER (fix in place), commit 179d4c6:

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

BEFORE (ablation — the scope="record" WIRING removed at all three mounts, the prop itself kept, so this measures the wiring and not the prop):

scope="record" occurrences: ActionDefaultInspector.tsx=3  ObjectValidationsPanel.tsx=2   <- fixed tree
scope="record" occurrences: ActionDefaultInspector.tsx=0  ObjectValidationsPanel.tsx=0   <- ablated
ConditionBuilder still declares the prop: 1

Test Files  1 failed (1)
     Tests  3 failed | 5 passed (8)

× rejects the bare shorthand in "Visible when" and names the record.FIELD fix
× rejects the bare shorthand in "Disabled when" and names the record.FIELD fix
× rejects the bare shorthand in a rule condition and names the record.FIELD fix

Exactly the three red-leg cases fail; the three canonical-spelling cases and both controls stay green. Restoration was verified by an empty git diff HEAD, not by an exit code, and the occurrence counts came back to 3 / 2.

Controls — "unchanged" made falsifiable, not asserted. A hook guard (a real OUT mount) still lints the bare shorthand clean, and a bare ConditionBuilder with no scope still lints it clean. Both go red if the default is ever changed, or derived from subjects.fieldPrefix.

No existing pin needed updating. The whole ConditionBuilder.*.test.tsx family is green unchanged; none of them encoded the old flattened behaviour at a mount this changes.

Checks run locally, all on 179d4c6

check result
pnpm exec vitest run packages/app-shell/ Test Files 704 passed (704) · Tests 6897 passed | 1 skipped (6898) · exit 0
pnpm --filter @object-ui/app-shell type-check (tsc --noEmit && tsc -p tsconfig.test.json) exit 0
eslint . in packages/app-shell 0 errors over 1165 files (count read from --format json, not estimated); 3023 warnings, all pre-existing
check:control-bytes · check:new-line-citations · check:vi-mock-specifiers · check:vi-mock-inherit · check:vi-mock-override-shape · check:test-path-roots · changeset:check · check:changeset-claims · check:unreferenced-sources all exit 0
check-changeset-presence.mjs exit 0 — "4 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s)"
check-governed-queue-guard.mjs --test NOT GOVERNED — 5 paths checked, none matched

The two lint warnings on the changed files (react-hooks/exhaustive-deps on the first-mount-only init memo; react-hooks/set-state-in-effect in the panel) are both on lines outside every hunk of this diff — pre-existing.

Lint narrowing, declared. pnpm lint is turbo run lint across every package; what ran here is packages/app-shell's own eslint . — the complete CI unit for the only package this diff touches, not a file subset. The invariance that makes that a measurement rather than a gap: this repo does not enable type-aware linting (eslint.config.js extends tseslint.configs.recommended, and carries no projectService and no project:), so a change inside app-shell cannot move the verdict on a file in any other package. .changeset/*.md is not in eslint's population at all. CI runs the full farm regardless.

Not owed, stated so silence is not read as a pass. scripts/pm/check-half-states.mjs is a board patrol over issue state, not a diff gate — nothing in this diff moves its input. An earlier invocation of it from the wrong path exited 1 with MODULE_NOT_FOUND; that is a mistyped path, not a red gate, and it is not reported as a measurement either way.

Scope and clause 2

  • File surface held exactly: inspectors/ConditionBuilder.tsx, inspectors/ActionDefaultInspector.tsx, views/studio-design/ObjectValidationsPanel.tsx, one new member of the ConditionBuilder.*.test.tsx family, and the changeset.
  • Clause-2: no still holds. ConditionBuilder is not exported from packages/app-shell/src/index.ts and is not exported here; no published type moves; nothing changed about what celAuthoring ACCEPTS — only which scope three call sites ask for.
  • No overlap found with objectui#7727: it is on ConditionalFormattingEditor.tsx, a different file, already correct via PR objectui#8164, and untouched by this branch.

Session (as prose, so it survives a body rewrite): https://claude.ai/code/session_011QreXiyMEqKLN4U5daMPVa


Generated by Claude Code

The builder's raw expression editor had no `scope` prop, so every mount fell
through to `celAuthoring`'s `hint.scope ?? 'flattened'` default and no caller
could override it. A bare `status == 'done'` typed into an action's "Visible
when" therefore linted clean and never matched — `usePredicateRecordContext`
binds `record` and nothing else, and Phase 2 of the row-predicate canon retired
the bare shorthand on runtime record surfaces.

`scope` is now an optional prop forwarded verbatim to `CelPredicateField`;
omitting it forwards `undefined`, so every mount that passes nothing keeps the
engine default byte for byte. It is deliberately not derived from
`subjects.fieldPrefix`, which would silently decide the mounts whose tier is
still open.

Three mounts declare `record`: an action's `visible` and `disabled` (named as a
row surface by `rowPredicateCanon.ts` in its own words), and an object
validation rule's `condition` (the server's rule validator binds
`{ record, previous }` and fail-closes on an unevaluable predicate, so a bare
reference there rejected every write while the editor stayed green).

The page-block, hook and schema-driven ConditionWidget mounts are left passing
nothing on purpose — their tier is an open question and an explicit value would
be a claim about it.

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

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 329 chunks) 3062.0 KB 3104.5 KB
Main entry chunk (gzip) 145.7 KB 350 KB
Entry file index-0aqmVghj.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) 16.69KB 6.21KB
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) 544.93KB 130.50KB
core (index.js) 8.52KB 3.41KB
create-plugin (index.js) 27.94KB 9.51KB
data-objectstack (index.js) 213.54KB 59.33KB
fields (index.js) 249.20KB 62.88KB
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) 8.87KB 3.64KB
i18n (index.js) 5.22KB 2.26KB
i18n (pickLocalized.js) 9.86KB 3.95KB
i18n (provider.js) 32.15KB 10.49KB
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.83KB 10.95KB
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) 14.81KB 3.63KB
plugin-calendar (index.js) 49.92KB 14.22KB
plugin-charts (index.js) 71.33KB 19.90KB
plugin-chatbot (index.js) 195.34KB 46.51KB
plugin-dashboard (index.js) 131.44KB 34.65KB
plugin-designer (index.js) 215.94KB 44.33KB
plugin-detail (index.js) 252.48KB 65.61KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 136.71KB 34.16KB
plugin-gantt (index.js) 167.62KB 41.26KB
plugin-grid (index.js) 212.83KB 57.97KB
plugin-kanban (index.js) 46.63KB 14.53KB
plugin-list (index.js) 112.67KB 27.68KB
plugin-map (index.js) 21.48KB 6.99KB
plugin-markdown (index.js) 13.88KB 4.80KB
plugin-report (index.js) 43.41KB 11.93KB
plugin-timeline (index.js) 30.07KB 8.74KB
plugin-tree (index.js) 10.58KB 3.72KB
plugin-view (index.js) 84.36KB 20.78KB
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) 99.04KB 32.62KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.63KB 2.18KB
react (schema-input.js) 4.25KB 2.04KB
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.66KB 2.50KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (kanban-quick-add.js) 3.89KB 1.87KB
sdui-parser (parse.js) 25.28KB 7.80KB
sdui-parser (provenance.js) 3.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 14.82KB 4.99KB
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.04KB 5.36KB
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-tesla
os-tesla marked this pull request as ready for review September 14, 2026 11:35
@os-tesla
os-tesla added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit e80d371 Sep 14, 2026
38 checks passed
@os-tesla
os-tesla deleted the claude/issue-8167-conditionbuilder-scope-prop branch September 14, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants