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

fix(fields): only a real boolean is a value of a boolean cell — a non-boolean scalar drew a checked box - #8594

Merged
os-justin merged 3 commits into
mainfrom
claude/issue-8582-boolean-cell-non-boolean-scalars
Sep 8, 2026
Merged

os-justin merged 3 commits into
mainfrom
claude/issue-8582-boolean-cell-non-boolean-scalars

Conversation

@os-justin

Copy link
Copy Markdown
Collaborator

Fixes #8582

What

BooleanCellRenderer (packages/fields/src/index.tsx) read every non-boolean scalar by truthiness. The string 'false', the string '0' and {} drew a checked, disabled checkbox (a completion field its green "Completed" indicator; an active-style field skipped its "Off" badge) — an affirmative answer the record never gave — while 0 and '' drew an unchecked box (a status field its "Off" badge), a false the record never stored either. The guard is now typeof value !== 'boolean': only a real boolean is a value of a boolean column; everything else renders the shared EmptyValue affordance. A real true / false renders exactly as before.

Why this reading — the spec decided it, on four instruments

The card and the dispatch brief listed three readings (a declared truth table / only real booleans / surface the raw text) and asked for @objectstack/spec to be read first. It settles the question:

  1. packages/spec/src/data/field-value.zod.ts, valueSchemaFor: the boolean / toggle arm is a bare z.boolean() — the runtime value contract admits nothing else.
  2. Same file, BOOLEAN_VALUE_TYPES: "Value is a JS boolean on the wire (driver read-coercion repairs SQL 0/1)" — the 0/1 repair is assigned to the driver. objectql implements it: coerceBooleanFields (packages/objectql/src/validation/record-validator.ts) runs on the engine's read-presentation paths (engine.ts: result rows and hook contexts).
  3. Same file, NON_TEXT_STORED_VALUE_TYPES: a boolean column's stored value "is never text on any backend" — 'true' / 'false' are never a stored boolean.
  4. The truth table already lives at the ingest boundaries, once per boundary: objectql's write-path validator accepts the six spellings and refuses the rest with invalid_boolean; packages/rest/src/import-coerce.ts parseBooleanCell reads the spec's IMPORT_BOOLEAN_TRUE_TOKENS / IMPORT_BOOLEAN_FALSE_TOKENS and refuses 'maybe' / 2 with invalid_boolean.

So a non-boolean that reaches this renderer is a producer that skipped its repair. Reading 1 (a renderer-side truth table) would be a second copy of an instrument the platform already owns at the producer — the renderer-side dialect AGENTS.md #0.1 forbids. Reading 3 (raw text) would invent an affordance no renderer in this file has; the file's own convention for a value it cannot read as its type is already EmptyValue (DateTimeCellRenderer for an unparseable date). Reading 2 is what the spec says, and it is the same statement objectui#8490 made for []: "No value" is a statement about the field's TYPE — the record holds no boolean here.

Declared, not smoothed. {} and 'false' now land on the same affordance for the same reason, and neither is "checked". The affordance does not say WHICH wrong-typed value the column holds; the platform's instrument for surfacing that is the write-path refusal, not the read renderer. One legitimate path was checked and excluded: a dataset measure over a boolean field yields a number, but packages/core/src/utils/dataset-format.ts formats it as text and never routes through getCellRenderer, so no number reaches this renderer by design. A consumer with a backend of its own that fed this renderer 1 / 0 or 'true' / 'false' now sees the affordance instead of a box; the changeset says to coerce at the data source, where the platform does.

Before / after (measured by rendering on 2a38862f5, the objectui#8490 head this branch started from)

stored value before now
'false', '0', 'no', {} checked checkbox affordance
'false' on completed green "Completed" indicator affordance
'false' on active checked checkbox, no "Off" badge affordance
0, '' unchecked checkbox affordance
0 on active destructive "Active — Off" badge affordance
'true', '1', 1 (spellings an ingest boundary accepts) checked checkbox affordance — the renderer owns no truth table
true / false checked / unchecked (indicator, badge by field name) unchanged
null, undefined, [] affordance (objectui#8490) affordance, unchanged

Files

  • packages/fields/src/index.tsx — the guard; value === false for the badge; checked={value}. isEmptyMultiValue's docblock loses its boolean caller (the typeof guard answers [] for the same reason).
  • packages/fields/src/__tests__/booleanCell.nonBooleanScalar-8582.test.tsx — new, 29 cases.
  • packages/fields/src/__tests__/cellRenderers.fabricatedValue-8490.test.tsx — the one pin that recorded "a scalar 0 still draws an unchecked box by truthiness" now records that the two rulings agree at their seam; its header sentence about untouched scalar coercions points here.
  • content/docs/fields/boolean.mdx — the "Cell Renderer" section claimed green/gray badges while the renderer has drawn a disabled checkbox (indicator / badge by field name); replaced with what it draws and the ruling (AGENTS.md Add automated testing infrastructure and CI/CD workflows #2). The stale badge claim was pre-existing and is corrected in place because it is the very section this change alters.
  • .changeset/8582-boolean-cell-non-boolean-scalar.md — @object-ui/fields patch.

Evidence — the legs were run, not predicted

All legs ran on commit 09fab31d1 (the fix commit). objectui#8490 landed on main as 21529629c while this branch was in flight, so main was merged into the head as 32c4398ab (no force-push); the merge carries the same five blobs, verified per file by git rev-parse. Each leg: mutate on disk → prove the mutation (injected-text count, deleted-text count, LINE TOTAL, blob hash) → run pnpm exec vitest run on the 8582 and 8490 files from the repo root → restore with git checkout HEAD -- path and prove it BY STATE (git hash-object equals git rev-parse HEAD:path AND git diff HEAD empty), trapped on EXIT INT TERM with absolute paths. Harness-death signatures (Cannot read properties of null, Unable to find, TypeError, is not a function) are counted separately from AssertionError lines.

leg mutation (proven on disk) result failing sentences (the MODE) harness deaths
A — the unfixed tree 2a38862f5's index.tsx written whole: 3402 lines (want 3402), blob b4d6dfe… equal to git rev-parse 2a38862f5:path 20 failed / 38 passed "a checked checkbox is a fabricated true", "an unchecked checkbox is a fabricated false", "a green Completed indicator is a fabricated true", "an Off badge is a fabricated false", "a Not-completed indicator is a fabricated false", "the renderer owns no truth table", "a scalar 0 draws no checkbox since objectui#8582" — every POPULATED case passed 0
B — the caricature (value !== true) injected 1, typeof guard 0, 3421 lines (= HEAD), blob fc5afba… not HEAD's 6 failed / 52 passed ONLY "must still draw its checkbox" (false on boolean and toggle), "must still draw its Off badge", "must still draw its Not-completed indicator" — every THE DEFECT / THE OTHER DIRECTION / THE RULING case passed, which is exactly why the populated false block is load-bearing 0
C — draws nothing (an empty span returned first) injected 1, 3422 lines (= HEAD + 1), blob 579914c… not HEAD's 38 failed / 20 passed "the shared EmptyValue affordance must be present" (26), "must still draw its checkbox / Off badge / Not-completed / Completed indicator" — no "fabricated" sentence fired: the locators find their targets by the affordance and the box, not by the thing being changed 0
D — an EMPTY index.tsx (the objectui#8490 accident, reproduced on purpose) 0 lines, 0 bytes, blob e69de29… (the empty blob) 58 failed / 0 passed none — 0 AssertionError lines 37 — the counter separates harness death from assertion failure
HEAD — the restored tree blob ebe7542… equal to git rev-parse HEAD:path, 3421 lines 58 passed — 0

Every discriminating assertion was observed to fail in the leg it was written for. (The sentence "the renderer owns no truth table" also heads a describe block, so its raw occurrence count includes title echoes; the mode reading is unaffected.)

Verification

  • pnpm exec vitest run packages/fields/src/__tests__/booleanCell.nonBooleanScalar-8582.test.tsx packages/fields/src/__tests__/cellRenderers.fabricatedValue-8490.test.tsx — 2 files, 58 passed, vitest exit=0 (exit captured by redirect, never through a pipe).
  • pnpm --filter @object-ui/fields type-check — both programs (tsc --noEmit && tsc -p tsconfig.test.json) after building the dependency closure (turbo run build --filter='@object-ui/fields^...', 9 tasks) — type-check exit=0, script name echoed.
  • pnpm exec vitest run --maxWorkers=2 packages/fields/ packages/plugin-grid/ — 257 files, 3464 tests passed, vitest exit=0, 467 s.
  • pnpm --filter @object-ui/fields lint — 0 errors (937 pre-existing warnings; the new file's are the same as any cast the 8490 suite carries).
  • Gates: check:control-bytes OK (6772 files); check-changeset-no-major and check-changeset-fixed OK; check:doc-fences OK; a Python scanner for control and zero-width code points over the five changed files: 0 hits, lit control fires (the brief is right that grep -P with a wide \x{} class fails outright on this container).
  • The ratchet re-run on the merge head 32c4398ab: the same two files, 58 passed (29 + 29, verbose reporter), vitest exit=0; type-check exit=0 on both programs.

Declared narrowing. turbo ls --affected (base 2a38862f5) lists 20 packages. Run locally: @object-ui/fields and @object-ui/plugin-grid (the read-mode cell consumer). Declared to CI: the other 18 (app-shell, console, plugin-detail, plugin-kanban, plugin-list, plugin-view, plugin-form, plugin-dashboard, plugin-designer, plugin-calendar, plugin-gantt, plugin-map, plugin-report, runner, site, three examples). Checkable reason: the only behaviour that moved is what this renderer draws for a NON-boolean input, so a consumer test can turn red only if it feeds one; a census over every test file in the affected packages that declares a boolean / toggle field (48 files) found 4 fixtures assigning a non-boolean to such a key, all in app-shell metadata-admin — three JSON-schema schema: {} fragments and one summary filter's billable: '' form value — none rendered by a read-mode cell renderer (the lit control fired on a synthetic is_active: 1). check:doc-snippets is NOT MEASURED locally (it exits 2 asking for a scoped 34-package build; this diff removes one ts fence from boolean.mdx and adds none).

No exported type changed (BooleanCellRenderer's signature is the same), so no cross-package .d.ts reverse check applies.

Out of scope

Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S

🤖 Generated with Claude Code

https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S


Generated by Claude Code

os-justin and others added 3 commits September 8, 2026 13:19
…fabricated one

objectui#8481 repaired the shared read renderers whose output for `[]` was
blank. These are the other half of that census — the renderers whose output
for `[]` was not blank but WRONG, a value the record does not hold. Re-measured
by rendering every registered field type on e411c3e (after 639ca9d, which
moved none of them): `boolean`/`toggle` drew a CHECKED checkbox, the number /
currency / percent family printed a `0` (and a 0% progress bar), `email` /
`url` / `phone` wrapped nothing in a live `mailto:` / `tel:` / empty-href
anchor, `color` drew a swatch with no colour, and `date` drew `formatDate`'s
hand-rolled em-dash with no accessible name.

The ruling is per renderer, not one predicate. `[]` holds no boolean, so a
boolean column holding it holds NO value — not `false`; only `[]` moves there
(`isEmptyMultiValue`), a real `false` is still an unchecked box. The number
family's `0` was `Number('')`, a coercion artefact, so its guard is on the
coerced text (`isBlankCellText`) and deliberately also sweeps a stored `''`.
The link family draws no anchor with nothing to link to; `color` no swatch
without a colour string; `date` reaches the shared affordance instead of a
private dash. `{}` is untouched everywhere; `json` and `file` keep the
objectui#8481 fence. A consumer pin in plugin-grid covers both grid widths.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
`BooleanCellRenderer` read every non-boolean scalar by truthiness: the
string `'false'`, the string `'0'` and `{}` drew a CHECKED, disabled
checkbox (a completion field its green "Completed" indicator, an
`active`-style field skipped its "Off" badge) — an affirmative answer the
record never gave — while `0` and `''` drew an UNCHECKED box (a status
field its "Off" badge), a `false` the record never stored either.

The ruling is the spec's. `@objectstack/spec`'s runtime value contract for
`boolean` / `toggle` is a bare `z.boolean()` (`data/field-value.zod.ts`,
`valueSchemaFor`): "a JS boolean on the wire (driver read-coercion repairs
SQL 0/1)", stored "never text on any backend". The truth table that turns
`'true'` / `1` / `'0'` into a boolean already lives at the producer
boundaries — objectql's read-path `coerceBooleanFields` and its
`invalid_boolean` write refusal, `rest`'s CSV `parseBooleanCell` — so a
non-boolean reaching the renderer is a producer that skipped its repair,
and a second copy of that table here would be the renderer-side dialect
AGENTS.md #0.1 forbids.

The guard is now `typeof value !== 'boolean'`, which also answers `null`,
`undefined` and the `[]` case (an empty array is not a boolean) with the
same shared `EmptyValue` affordance for the same reason; `isEmptyMultiValue`
loses its boolean caller and its docblock says so. A real `true` / `false`
renders exactly as before. The stale "green / gray badge" sentence in
`content/docs/fields/boolean.mdx` is replaced by what the renderer draws,
and the superseded truthiness pin for a scalar `0` in the 8490 suite now
records that the two rulings agree at their seam.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
…lean-cell-non-boolean-scalars

# Conflicts:
#	packages/fields/src/__tests__/cellRenderers.fabricatedValue-8490.test.tsx
#	packages/fields/src/index.tsx
@os-justin
os-justin marked this pull request as ready for review September 8, 2026 14:14
@os-justin
os-justin enabled auto-merge September 8, 2026 14:14
@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-CbSvSN2X.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.54KB 61.49KB
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

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): BooleanCellRenderer reads a non-boolean scalar by truthiness — the string 'false' and {} render a CHECKED checkbox

2 participants