This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
fix(fields): a readonly BooleanField says Yes / No only for a real boolean - #8597
Merged
os-justin merged 1 commit intoSep 8, 2026
Merged
Conversation
…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
Contributor
✅ Console Performance Budget
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
Size Limits
|
os-justin
marked this pull request as ready for review
September 8, 2026 15:17
os-justin
deleted the
claude/issue-8593-booleanfield-readonly-truthiness
branch
September 8, 2026 15:34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, and0,'',nullandundefinedall said No. It now says "Yes" / "No" only for a real boolean and draws the sharedEmptyValueaffordance (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 barez.boolean()forboolean/toggle,BOOLEAN_VALUE_TYPES,NON_TEXT_STORED_VALUE_TYPES, and the producer-side truth tables (objectql'scoerceBooleanFields/invalid_boolean,rest'sparseBooleanCell), 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 one09fab31d1put inBooleanCellRenderer:typeof value !== 'boolean'.Measured on
21529629cby rendering (LEG A below):'false','0','no',{},[]EmptyValueaffordance'true','1',10,''null,undefinedtrue/falseThe 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 inpackages/fields/src/widgets/with a readonly branch and a nullable value rendersEmptyValuefor 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.tsxalready 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).BooleanCellRendererhappens 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 atext-smspan around it, matching the majority.The second direction
Checked. The widget has the fabricated falsehood:
0,'',nullandundefinedsaid "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 (blob035cdf27c). The test file imports it by relative source path, andvitest.config.mtsaliases@object-ui/componentstopackages/components/src(line 505), so nodist/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), runpackages/fields/src/__tests__/booleanField.readonlyNonBoolean-8593.test.tsx(33 tests), restore withgit checkout HEAD -- ABSOLUTE_PATHunder a trap onEXIT INT TERM, prove the restore by state (git diff HEADempty ANDgit hash-objectequal to the HEAD blob). All five restores verified. Instrument: per-test classification from vitest's JSON reporter (each failed test's first failure line:AssertionErrorsentence, or a harness death).035cdf27c21529629cblob (c8325fff6, 108 lines)EmptyValue0, truthiness ternary 1, lines 108, hash == BASE blobfalsecases greenvalue !== truein place oftypeof value !== 'boolean'falsecases refuse ite69de29bbElement type is invalid) against 4 assertions (the THE HOST PATH cases, whereFieldEditWidgetrenders its own fallback for an undefined widget)Instrument correction, stated rather than smoothed: the first run counted
grep -chits 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 isElement 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
c303b681dpnpm exec vitest runon the new file plusstandard-widgets.test.tsx,validation-feedback.test.tsx,readonly-host-plumbing-e2e.test.tsx: 4 files, 201 passedpnpm exec vitest run packages/fields/: 141 files, 2432 passedpnpm exec vitest run packages/plugin-form/ packages/plugin-detail/: 228 files, 2129 passed, 1 skippedpnpm --filter @object-ui/fields type-check: both programs (tsc --noEmit && tsc -p tsconfig.test.json) green afterpnpm --filter '@object-ui/fields^...' build;tsc -p tsconfig.test.json --listFileslists the new test (1 hit)pnpm exec eslinton the two.tsxfiles with--format json: 2 files, 0 errors; 0 warnings on the test, 1 pre-existingno-explicit-anywarning atBooleanField.tsx:11(config = field as any, untouched). Population:eslint.config.jsfiles: ['**/*.{ts,tsx}']minus itsignores(dist, .next, node_modules, public, .source) over 4397 tracked ts/tsx. Invariance: the config sets noparserOptions.project/projectService(0 hits; controlfiles:7 hits) and its ratchet rules are per-fileerrorpromotions, not repo-wide counters, so this diff cannot move any untouched file's verdict.check-control-bytesOK (6783 files);check-changeset-no-major,check-changeset-presence(2 source files, 1 changeset),check-changeset-overwrite,check-changeset-fixedOK;check-doc-fence-languages,check-doc-component-types,check-doc-linksOK; a Python zero-width / control-character scan of the four changed files, with a lit control, 0 hits;check-governed-queue-guard --teston the four paths: NOT GOVERNED.check-doc-snippet-typesexits 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 lintrepo-wide,pnpm check, and the other 19 CI-affected packages fromturbo ls --affectedagainst21529629c(app-shell, console, plugin-grid, plugin-kanban, the examples, ...) are CI's;git grepfinds no test outsidepackages/fieldsthat pins the readonly boolean's Yes / No text.Scope notes
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/mainmoved one commit (d02942b0e,packages/typestests) after this branch was cut, with no file overlap, somainwas 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 tocontent/docs/fields/boolean.mdxis 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