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

fix(fields): a readonly BooleanField says Yes / No only for a real boolean - #8597

Merged
os-justin merged 1 commit into
mainfrom
claude/issue-8593-booleanfield-readonly-truthiness
Sep 8, 2026
Merged

os-justin merged 1 commit into
mainfrom
claude/issue-8593-booleanfield-readonly-truthiness

Conversation

@os-justin

Copy link
Copy Markdown
Collaborator

Fixes #8593

What

BooleanField's readonly branch read the value by truthiness (value ? 'Yes' : 'No'), so the string 'false', the string '0', {} and [] all said Yes, and 0, '', null and undefined all said No. It now says "Yes" / "No" only for a real boolean and draws the shared EmptyValue affordance (an em-dash with the accessible name "No value") for anything else.

This is objectui#8582's defect one surface over. The direction was ruled there, on @objectstack/spec's bare z.boolean() for boolean / toggle, BOOLEAN_VALUE_TYPES, NON_TEXT_STORED_VALUE_TYPES, and the producer-side truth tables (objectql's coerceBooleanFields / invalid_boolean, rest's parseBooleanCell), and it is not re-derived here: a non-boolean is no value, and a widget-side truth table would be the AGENTS.md #0.1 second dialect. The guard is the one 09fab31d1 put in BooleanCellRenderer: typeof value !== 'boolean'.

Measured on 21529629c by rendering (LEG A below):

stored value readonly widget said says now
'false', '0', 'no', {}, [] Yes the EmptyValue affordance
'true', '1', 1 Yes the affordance
0, '' No the affordance
null, undefined No the affordance
a real true / false Yes / No unchanged

The one open question: what a readonly widget draws for no value

EmptyValue — because it is this directory's own convention, not because the cell renderer uses it. Every sibling in packages/fields/src/widgets/ with a readonly branch and a nullable value renders EmptyValue for the absent case: NumberField (value == null ? EmptyValue : the value), CurrencyField, PercentField, DateTimeField, EmailField, PhoneField, RadioField, ObjectField, ObjectRefField, CodeField, LocationField, QRCodeField, MultiSelectField, CheckboxesField, CapabilityMultiSelectField, RecipientPickerField, ImageField, AddressField, GeolocationField. validation-feedback.test.tsx already pins that dash in readonly mode for six of them. The widgets that draw something else are the ones with a domain-specific shape (MasterDetailField's "No related records", FilterConditionField's refusal text, PasswordField's mask, AvatarField's initials). BooleanCellRenderer happens to use the same component, so the two surfaces agree by convention rather than by import. The bare-element form (NumberField's) is used rather than a text-sm span around it, matching the majority.

The second direction

Checked. The widget has the fabricated falsehood: 0, '', null and undefined said "No" (LEG A: 8 "fabricated false" failures). It does not have the louder shape objectui#8582 found in the cell renderer: the readonly branch is one text span with no field-name conventions and no destructive badge, so a fabricated "No" weighed exactly what a fabricated "Yes" weighed. Both directions land on the same affordance.

Evidence: ablation legs

Subject packages/fields/src/widgets/BooleanField.tsx, 136 lines at HEAD (blob 035cdf27c). The test file imports it by relative source path, and vitest.config.mts aliases @object-ui/components to packages/components/src (line 505), so no dist/ is on the resolution path and no rebuild sits between legs. Every leg: mutate, prove on disk (removed-text count, injected-text count, line total, blob hash), run packages/fields/src/__tests__/booleanField.readonlyNonBoolean-8593.test.tsx (33 tests), restore with git checkout HEAD -- ABSOLUTE_PATH under a trap on EXIT INT TERM, prove the restore by state (git diff HEAD empty AND git hash-object equal to the HEAD blob). All five restores verified. Instrument: per-test classification from vitest's JSON reporter (each failed test's first failure line: AssertionError sentence, or a harness death).

leg mutation on-disk proof result
0 HEAD hash == 035cdf27c 33 passed
A, the defect the 21529629c blob (c8325fff6, 108 lines) typeof-guard 0, EmptyValue 0, truthiness ternary 1, lines 108, hash == BASE blob 23 failed / 10 passed: 12 "fabricated true" (10 THE DEFECT + 2 THE HOST PATH), 8 "fabricated false", 3 "coercion the spec assigns"; 0 harness deaths; all 8 POPULATED and the 2 HOST PATH false cases green
B, the caricature value !== true in place of typeof value !== 'boolean' guard 0, marker 1, lines 136, hash differs 6 failed / 27 passed: all six "a real false must still say No" (4 POPULATED + 2 THE HOST PATH); every THE DEFECT / THE OTHER DIRECTION / THE RULING case green — the caricature satisfies them, and only the populated false cases refuse it
C, empty element the readonly branch returns a bare span guard 0, marker 1, lines 136 33 failed: 23 "affordance must be present", 6 "must still say No", 4 "must still say Yes", and 0 "fabricated" sentences — the locators see only the widget's own output
D, empty file 0 bytes, hash == e69de29bb lines 0, bytes 0 33 failed: 29 harness deaths (Element type is invalid) against 4 assertions (the THE HOST PATH cases, where FieldEditWidget renders its own fallback for an undefined widget)

Instrument correction, stated rather than smoothed: the first run counted grep -c hits over the text reporter for the death signatures the brief listed (Cannot read properties of null, Unable to find, TypeError, is not a function) and read LEG D as 0 deaths / 4 AssertionErrors. React's death for an empty module is Element type is invalid, and vitest prints one block per distinct message, so 29 identical deaths appeared once. The per-test JSON classification above is what told 29 from 4; the first run's counts are not relied on.

Verification on c303b681d

  • pnpm exec vitest run on the new file plus standard-widgets.test.tsx, validation-feedback.test.tsx, readonly-host-plumbing-e2e.test.tsx: 4 files, 201 passed
  • pnpm exec vitest run packages/fields/: 141 files, 2432 passed
  • pnpm exec vitest run packages/plugin-form/ packages/plugin-detail/: 228 files, 2129 passed, 1 skipped
  • pnpm --filter @object-ui/fields type-check: both programs (tsc --noEmit && tsc -p tsconfig.test.json) green after pnpm --filter '@object-ui/fields^...' build; tsc -p tsconfig.test.json --listFiles lists the new test (1 hit)
  • eslint, a measured narrowing: pnpm exec eslint on the two .tsx files with --format json: 2 files, 0 errors; 0 warnings on the test, 1 pre-existing no-explicit-any warning at BooleanField.tsx:11 (config = field as any, untouched). Population: eslint.config.js files: ['**/*.{ts,tsx}'] minus its ignores (dist, .next, node_modules, public, .source) over 4397 tracked ts/tsx. Invariance: the config sets no parserOptions.project / projectService (0 hits; control files: 7 hits) and its ratchet rules are per-file error promotions, not repo-wide counters, so this diff cannot move any untouched file's verdict.
  • Gates: check-control-bytes OK (6783 files); check-changeset-no-major, check-changeset-presence (2 source files, 1 changeset), check-changeset-overwrite, check-changeset-fixed OK; check-doc-fence-languages, check-doc-component-types, check-doc-links OK; a Python zero-width / control-character scan of the four changed files, with a lit control, 0 hits; check-governed-queue-guard --test on the four paths: NOT GOVERNED.
  • NOT MEASURED, declared: check-doc-snippet-types exits 2 ("could not run": eight packages' dist/ absent), and the docs diff adds prose only (0 new fences; control: 4 fences in the file). pnpm lint repo-wide, pnpm check, and the other 19 CI-affected packages from turbo ls --affected against 21529629c (app-shell, console, plugin-grid, plugin-kanban, the examples, ...) are CI's; git grep finds no test outside packages/fields that pins the readonly boolean's Yes / No text.

Scope notes

  • The edit branch's checked={!!value} is untouched: the card scopes to the readonly branch and records the edit branch as the lesser. An editable Switch has no "no value" state, so what it should show for a non-boolean is a decision, not a sweep. Left for the PM.
  • origin/main moved one commit (d02942b0e, packages/types tests) after this branch was cut, with no file overlap, so main was not merged in; PR fix(fields): only a real boolean is a value of a boolean cell — a non-boolean scalar drew a checked box #8594's edit to content/docs/fields/boolean.mdx is in the Cell Renderer section, this one adds a separate Read-only Display section above Use Cases, and the two hunks do not touch.

Written under session_01YBWFb5YgMU5dw8p2VKj16S; generic placeholders in this body are spelled as capitalised words because GitHub strips tag-shaped fragments from bodies, backticks included.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S


Generated by Claude Code

…olean

`BooleanField`'s readonly branch read the value by truthiness, so the string
'false', the string '0', {} and [] said "Yes" and 0, '', null and undefined
said "No". Only a real boolean is a value of a boolean field
(@objectstack/spec's bare z.boolean(); the truth table lives at the
producer boundaries), so a non-boolean now draws EmptyValue, the affordance
every sibling widget in this directory renders for an absent value. A real
true still says Yes and a real false still says No.

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

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 50 chunks) 3476.3 KB 3512.7 KB
Main entry chunk (gzip) 143.9 KB 350 KB
Entry file index-4uFxJwhM.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) 498.93KB 114.12KB
core (index.js) 7.48KB 2.96KB
create-plugin (index.js) 10.12KB 3.28KB
data-objectstack (index.js) 192.72KB 53.55KB
fields (index.js) 243.58KB 61.50KB
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) 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.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) 213.21KB 43.63KB
plugin-detail (index.js) 250.72KB 64.81KB
plugin-editor (index.js) 2.23KB 1.05KB
plugin-form (index.js) 131.01KB 32.32KB
plugin-gantt (index.js) 167.16KB 40.99KB
plugin-grid (index.js) 208.30KB 56.63KB
plugin-kanban (index.js) 55.40KB 15.71KB
plugin-list (index.js) 112.74KB 27.70KB
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 (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 8, 2026 15:17
@os-justin
os-justin added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit 64f1cf1 Sep 8, 2026
35 checks passed
@os-justin
os-justin deleted the claude/issue-8593-booleanfield-readonly-truthiness branch September 8, 2026 15:34
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.

finding(fields): BooleanField's readonly branch reads the value by truthiness — the string 'false' and {} say "Yes"

2 participants