This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
refactor(components): resolve ui:button icons through the shared resolver - #6350
Merged
os-support-ai merged 1 commit intoAug 25, 2026
Merged
Conversation
…lver `renderers/form/button.tsx` carried a byte-equivalent reimplementation of `renderers/action/resolve-icon.ts` — its own `toPascalCase`, its own `iconNameMap` with the single `Home -> House` entry, its own index into lucide's runtime `icons` record. Same algorithm, not the same function, so an alias added to the shared resolver to absorb a lucide retirement reached every `action:*` site and silently missed `ui:button` (objectui#5993). Behaviour is unchanged, and measured rather than assumed: over 3547 names (lucide's 1767 record keys in both spellings, plus kebab-case probes, the `Home` alias, retired spellings and `undefined`) the two implementations agree by object identity on 3539, differ on 8 only in the nullish flavour returned for a miss (`undefined` from the record index vs `null` from the shared resolver), and fork on none. `Icon` is consumed at exactly two truthiness sites, so that difference cannot reach the DOM. `scripts/check-lucide-icon-record-names.mjs` drops the file from `DECLARED_RECORD_READERS` in the same commit: that census is rediscovered from source on every run and fails on drift in both directions, which both verifies the removal and makes a re-inlined copy fail the gate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011SfZeFWrhGLHmfq61xbz4q
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
|
This was referenced Aug 25, 2026
os-support-ai
marked this pull request as ready for review
August 25, 2026 14:59
os-support-ai
deleted the
claude/issue-5993-button-inlined-icon-resolver
branch
August 25, 2026 15:12
akarma-synetal
pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Sep 28, 2026
…993 note (objectstack-ai#9822) Fixes objectstack-ai#9772 Clause-②: no `.changeset/5993-button-shared-icon-resolver.md`'s final paragraph asserts that `renderers/basic/icon.tsx` "keeps its own copy deliberately and is untouched". The first clause is false today. It was **true when written**, so this is ROTTED, not BORN FALSE — the repair **keeps the sentence, dates it, and names the falsifier**. Correcting it outright (objectui#9753's repair, for a claim that was never true) would delete the record that the sentence was once true, and with it the reason this change left `ui:icon` alone. This is a **pending** changeset: the body publishes verbatim into the CHANGELOG at the next release. The repair lands in the pending body while it is still pending. ⛔ Nothing here touches release PR objectui#5400 or any file it owns. ## Both readings taken here, neither inherited **Write-time ref — `194fae184` (2026-08-25).** ``` git log -L 42,44:.changeset/5993-button-shared-icon-resolver.md --oneline ``` walks to exactly one commit — `194fae184` `refactor(components): resolve ui:button icons through the shared resolver (objectstack-ai#6350)` — and shows the hunk as `--- /dev/null`, i.e. the file was created there and the paragraph has never been edited since. `git blame -L 42,44` on the same file agrees on all three lines. **At that ref the clause was TRUE.** ``` git show 194fae1:packages/components/src/renderers/basic/icon.tsx ``` That file defines `function toPascalCase`, holds `const iconNameMap` carrying the single `Home -> House` entry, and resolves with `(icons as any)[mappedIconName]` against `lucide-react`'s runtime record. A grep of the same blob for `resolve-icon` / `resolveIcon` / `describeIconLookup` returns nothing: it imported no part of the shared resolver. So it did keep its own copy. **Falsifier — `e176053094` (2026-09-03), `refactor(...): one lucide icon-name seam, seven resolvers down to one (objectstack-ai#7491)`.** Three independent `git log -S` probes, each scoped to that one file, converge on it and on no other commit after the write-time ref: | probe | first commit after `194fae184` | |---|---| | `git log -S "from '../action/resolve-icon'"` | `e176053094` | | `git log -S "function toPascalCase"` | `e176053094` | | `git log -S "const iconNameMap"` | `e176053094` | Why that one **and not another**: - `git log --oneline --reverse 194fae1..HEAD -- packages/components/src/renderers/basic/icon.tsx` lists exactly four commits, and `e176053094` is the **first** of them — the file was not touched at all between the write-time ref and it, so nothing in between can have falsified the clause. - Its diff on that file removes `function toPascalCase`, `const iconNameMap` and `(icons as any)[mappedIconName]`, and adds the shared import, in one commit. At `e176053094^` the own copy is still present and the shared import still absent. - The other three commits in that range — `e304a4ef76`, `c6198c27bd` and `57c07f0028` — move **no** line matching the own-copy or import pattern. In particular **objectui#9770 (`57c07f0028`) is not the falsifier**, though it touched the same file most recently; on a card whose subject is provenance, naming it would have been a fresh false statement. **Corroboration inside the thing being described.** The file's own docblock beside the lookup already speaks in the past tense — it says this file *carried* its own `toPascalCase` + `iconNameMap` + `icons[...]`, and that the guarded name *used to* reach this file's own `toPascalCase`. The changeset was still asserting the opposite in the present tense. The falsifier's own commit body independently records that it kept `ui:icon`'s `SquareDashed` placeholder and objectui#5631 warning at the call site. ## Only the first clause was repaired "Is untouched" is scoped to objectui#5993's own change — *that change didn't touch it* — not to "never touched again", so a later commit touching the file does not falsify it. It is left **byte-identical**, and the amendment says so explicitly so the next reader does not re-litigate it. The reason clause (`SquareDashed` placeholder + objectui#5631 warning, which the shared resolver does not do) is likewise untouched and still true, per the falsifier's own body. The diff is **append-only: 20 insertions, 0 deletions.** ## The amendment does not plant a fact that will rot again It contains no bare present-tense assertion about today's tree. Where it points at the current implementation it names where to re-derive it — *read what `renderers/basic/icon.tsx` imports from `renderers/action/resolve-icon`, and the docblock beside that lookup* — and every historical reading carries its ref and its date. No `path:line` citation is added (AGENTS.md objectstack-ai#11); `pnpm check:new-line-citations` is green. ## Before/after probe of the changed prose — whitespace-tolerant, both controls Changeset prose wraps near 88 columns, so a line-anchored `grep -F` reads 0 on text that is plainly present. The instrument therefore normalises every whitespace run to a single space across the whole file and counts literal occurrences. Same instrument, same corpus (`.changeset/5993-button-shared-icon-resolver.md`) at base `42234b1a2` and at the head. | probe | before | after | line-anchored `-F`, before/after | expected | |---|---|---|---|---| | SUBJECT — new prose, spans a wrap | 0 | 1 | 0 / 0 | 0 / 1 ✅ | | SUBJECT-2 — falsifier named, spans a wrap | 0 | 1 | 0 / 0 | 0 / 1 ✅ | | **LIT CONTROL** — pre-existing sentence, spans the wrap between "`ui:icon`" and "draws a `SquareDashed` placeholder" | 1 | 1 | 0 / 0 | 1 / 1 ✅ | | **ABSENT CONTROL** — in neither tree | 0 | 0 | 0 / 0 | 0 / 0 ✅ | The lit control spans a wrap deliberately, and the fourth column is the point: the naive line-anchored instrument reads **0** for a sentence that is verbatim in both trees. Probe exit code captured to disk before any pipe: `PROBE_EXIT=0`. ## Changeset grade for this change — measured from a build, both controls `@object-ui/components` ships `files: ["dist", "README.md", "CHANGELOG.md", "LICENSE"]`; minus `*.md` and `LICENSE*`, the published executable surface is `dist/`. Built for real first — `pnpm --workspace-concurrency=2 --filter '@object-ui/components^...' build` then `pnpm --filter @object-ui/components build`, both under the shared verify lock, both `VERDICT command-exit 0` — then grepped over the 212 files of `packages/components/dist`: | probe | hits | exit | |---|---|---| | new prose (`the reason is the half worth releasing`) | 0 | 1 | | falsifier sha `e176053094` | 0 | 1 | | **positive control** — published symbol `describeIconLookup` | 1 file (`dist/renderers/action/resolve-icon.d.ts`) | 0 | The positive control lands, so instrument and corpus are live; the subject does not, so nothing this change moves is published executable source ⇒ **no changeset is owed**, which is also what `node scripts/check-changeset-presence.mjs` prints on its own: *"0 of them published source of a package the release covers … no changeset is owed"*, exit **0**. Stated rather than glossed over: the changeset **body** does publish, into `packages/components/CHANGELOG.md`, which is in `files[]` — and is excluded from the criterion as `*.md` by the repo's own rule. That is the whole reason this repair is urgent rather than cosmetic, and it is not a changeset-owing surface. ## Gates — exit codes captured to disk before any pipe | gate | exit | |---|---| | `check-changeset-overwrite` | **0** — reports this as its documented **case 2** (*"You are CORRECTING a declaration on purpose … prose that no longer matches"*): `M .changeset/5993-button-shared-icon-resolver.md`, *declared at base* `@object-ui/components: patch`, *declares now* `@object-ui/components: patch` — no declaration lost, frontmatter unmoved | | `check-changeset-presence` | 0 | | `check-changeset-claims` | 0 | | `check-changeset-no-major` | 0 | | `check-changeset-fixed` | 0 | | `check-pending-changeset-literals` | 0 | | `check-control-bytes` | 0 | | `check-new-cross-file-line-citations` | 0 | | `grep -naP '[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]'` on the changed file | 1 (clean) | No test or typecheck is owed: the diff touches one markdown file and no package source. The repo-wide run belongs to CI. ## Serial constraint, re-taken over the open-PR 全集 immediately before the first write 19 open pull requests enumerated through the REST proxy, every one's file list read. Exactly **one** touches `.changeset/5993-button-shared-icon-resolver.md`: **objectui#5400**, the release PR, which consumes every pending declaration. Re-taken immediately before the push: `state=open, merged=False, merged_at=None`. ⇒ the window is open and no concurrent branch edits this file. ⛔ objectui#5400 is not touched by this PR. The sibling work on objectui#9781 is on `.changeset/8171-…` and shares no file with this. If objectui#5400 merges before this lands, this card needs re-triage — the remedy channel becomes a docs-only PR on a release-owned tree. ## Acceptance notes Out-of-scope findings are reported in the hand-back, not filed. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01UanLVj6xvbS6puBCewLr8L --- _Generated by [Claude Code](https://claude.ai/code/session_01UanLVj6xvbS6puBCewLr8L)_ Co-authored-by: Claude <noreply@anthropic.com>
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 #5993
ui:buttonresolved its authorediconwith a hand-copied reimplementation of the sharedresolver. It now imports
resolveIconfromrenderers/action/resolve-icon.ts, and thecopy is gone.
This is a duplication repair, not a rendering fix. Nothing a user sees changes — that
is the contract, and the verification below is built around proving it rather than around
a defect that does not exist.
1. Premise, re-derived on
origin/main@79ebf30d1Line numbers read off the tree on this branch's merge base rather than inherited from the
card (two rows of the dispatched table were off by one; the substance was exact).
renderers/action/resolve-icon.tsrenderers/form/button.tsxfunction toPascalCase(:14-19)function toPascalCase(:18-23)const iconNameMap = { Home: 'House' }(:22-24)const iconNameMap = { 'Home': 'House' }(:26-28)export function resolveIcon(:30-35):44-49Both split on
-, both PascalCase each segment, both consult the same single-entry renamemap, both index lucide's runtime
iconsrecord. Same algorithm, not the same function —so an alias added to
resolve-icon.tsto absorb a lucide retirement (the objectui#5586 /objectui#5622 mechanism) reached every
action:*site,complex/data-table.tsxand bothmenu renderers, and silently missed this one.
Helper census before deleting anything.
toPascalCaseis referenced exactly twice inthe file — its definition (
:18) and the icon lookup (:46).iconNameMaplikewise(
:26,:47). Neither served anything but the icon lookup, so both go with it.2. Equivalence — measured, not assumed
The deleted copy was transcribed verbatim and run beside the real shared resolver over
3547 names: every one of lucide's 1767 record keys in both its PascalCase and its
kebab-case spelling, plus kebab-case probes, the rename alias, retired spellings, the empty
string and
undefined.Zero genuine forks. Agreement is by object identity, not by name — the same component
object comes back from both.
The one real difference, and why it is inert — measured, not assumed
The copy ended in
(icons as any)[mapped] as LucideIcon, which yieldsundefinedfora miss;
resolveIconends in?? null. The card flagged this as the difference to check,so it was checked at the consumption site rather than reasoned about:
Iconoccurs at exactly four places in the old file — the declaration (:44), theassignment (
:48), and two render sites:Both are truthiness tests, and React renders nothing for
nullandundefinedalike,so the flavour of the falsy value never reaches the DOM. Pinned behaviourally by three rows
in the new suite (a retired spelling, an unresolvable name, and no icon authored — all
three assert
button.querySelector('svg')is null while the label still renders).One consequence worth stating: the new code calls
resolveIcon(schema.icon)unconditionally, where the copy skipped the lookup when
schema.iconwas falsy.resolveIconreturnsnullforundefinedand for''by its ownif (!name)guard, sothe outcome is identical; the guard simply moved inside the function.
3. Removal proof
Counts taken with
git show 79ebf30d1:<path>against the working file:^function toPascalCase^const iconNameMapiconsimported fromlucide-react(icons as any)[…]index'../action/resolve-icon'resolveIcon(callNo second definition of either helper survives anywhere in the file. The two textual
occurrences that remain are inside the explanatory comment naming what was removed, and
they are prose — the census in
scripts/check-lucide-icon-record-names.mjsparses importsfrom the TS AST, so a comment cannot be mistaken for a read.
4. Why there is no red-before ablation, and what red-before there is
Behaviour is unchanged by construction, so the usual "revert the fix, watch the test go
red" leg does not exist for the behavioural rows: they are green on the copy and green on
the import. No fake behavioural difference was manufactured to produce one. Presenting
those green rows as evidence that the change is correct would be circular; they are the
guard that it changed nothing.
What is checkable was checked, in two reverse-verification legs. Each restored the
pre-change state on disk, proved the mutation landed by blob hash and by grep before
reading anything, and restored via
git checkout HEAD -- <abs path>under a trap, withgit diff HEADempty and the blob hash back toHEAD's afterwards.Leg A — restore the inlined copy, keep the new suite (
79ebf30d1'sbutton.tsx; blobd1d0a278→e6377fe9,copy defs on disk: 2,shared-resolver imports: 0):The two routing rows are the only ones that discriminate, and they discriminate on
exactly the thing this card changes: which function the glyph came out of. The nine
behaviour rows stayed green in both worlds, as they must.
That leg also caught a blind instrument in the suite before it shipped: the second routing
row originally read
expect(shared.mock.results[0]?.value).not.toBeNull(), which passeswith zero calls (
undefinedis notnull) and was measured green against the restoredcopy. It now asserts
toHaveBeenCalledTimes(1)first, and the reason is written beside it.Leg B — restore the census declaration while the source no longer reads the record
(blob
1a591a76→6bd2ec8d, injected declaration lines: 1):5. The icon-name gate — what its verdict means here
scripts/check-lucide-icon-record-names.mjsdoes cover this file, and it is not abystander: part 1 of that gate rediscovers every record-reading module from source on each
run and fails when the discovered set differs from
DECLARED_RECORD_READERSin eitherdirection. Dropping
form/button.tsxfrom that list is therefore verified rather thanasserted — leg B above is that verification, and the run on this branch reports the
population as 7 resolvers, down from 8.
Two things it says, and one it does not:
undeclared record reader and fail the census in the opposite direction — which is a
stronger guard against re-divergence than any single test.
the copy in place. Both modules were declared legitimate record readers; nothing in the
gate compares two resolvers to each other. That blindness is exactly what the card was
filed about, and it is disclosed in objectui#5935.
The part-2 census entry for the
buttontype stays — its authored icon names stillreach a record-reading resolver, one indirection away — with its
resolverfieldre-pointed at
resolve-icon.ts, matching thecontext-menu/dropdown-menuidiomalready in that table.
Three rows of
scripts/__tests__/check-lucide-icon-record-names.test.tshard-coded thepopulation at 8 and enumerated
form/button.tsxamong the four resolvers objectui#5633'shand-kept table missed. They move to 7, with the reason recorded in place: the site left
the census by being fixed, not by being forgotten, and the row that listed it now asserts
its absence so the direction of the change is pinned rather than merely edited away.
6. Out of scope — reported, not touched
renderers/basic/icon.tsx(ui:icon) keeps its own copy, deliberately. It draws aSquareDashedplaceholder and warns on an unresolvable name (objectui#5631, maintainerruling 2026-08-22), where the shared
resolveIconreturnsnull. Folding it in woulddelete a deliberate behaviour and break
renderers/basic/__tests__/icon-unresolvable-placeholder.test.tsx. Untouched here, and thereason is now recorded beside the census pin that counts it.
A fourth production copy exists that the dispatched census did not name:
packages/plugin-view/src/ViewSwitcher.tsx(:149-165) carries its owntoPascalCase,its own
iconNameMapand its own function also calledresolveIcon. It is the sameduplication class as this card — and
plugin-viewalready depends on@object-ui/components,so it has no structural obstacle to importing the shared one.
Both sites are already inside the scope of the open umbrella card objectui#5935
("Consolidate the eight lucide record-reading icon resolvers into one seam"), which
enumerates
form/button.tsxamong its eight and rules on the tokeniser and aliasdivergences the wider consolidation has to settle. No new issue was filed, because that
search found one. This PR is the first slice of that population to land, and it is the
easy slice precisely because
ui:button's tokeniser and alias map were already identicalto the shared resolver's — which is why it could be done without changing behaviour.
objectui#5935 stays open.
7. Gates
Gate set derived by reading the step lists under
.github/workflows/(ci.yml,lint.yml,changeset-*.yml,control-bytes.yml,vi-mock-specifiers.yml), not from memory. Exitcodes captured before any pipe; each verdict line is the gate's own output.
Run at
f72ac931— the final commit, working tree clean.pnpm check:icon-record-namesOK lucide icon names: 167 authored/declared names reaching 7 record-reading resolvers are live 'icons' keyspnpm lintTasks: 47 successful, 47 total(0 errors; warnings pre-existing)pnpm --filter @object-ui/components run type-checktsc --noEmit && tsc -p tsconfig.test.json— no diagnosticspnpm type-check:scriptstsc -p tsconfig.scripts.json— no diagnosticspnpm exec vitest run packages/components/Test Files 190 passed (190)/Tests 1731 passed (1731)pnpm exec vitest run scripts/__tests__/check-lucide-icon-record-names.test.tsTest Files 1 passed (1)/Tests 39 passed (39)node scripts/check-changeset-presence.mjs✅ 2 source file(s) of 1 released package(s) changed, and this change declares 1 changeset(s)node scripts/check-changeset-no-major.mjs✅ No changeset declares a 'major' bump.node scripts/check-changeset-fixed.mjs✅ All workspace packages are in the changeset fixed group.node scripts/check-vi-mock-specifiers.mjs✅ check-vi-mock-specifiers: OK (… 685 relative specifier(s) resolved …)node scripts/check-control-bytes.mjs✅ check-control-bytes: OK (scanned 5226 tracked text file(s); skipped 85 binary).node scripts/check-entry-guard.mjs --self-test✓ check-entry-guard self-test: 63 cases passnode scripts/check-entry-guard.mjs✓ check:entry-guard: 47 scripts/ file(s) — no entry guard outside the baselinenode scripts/check-lint-coverage.mjs✅ lint coverage: 46/46 packages linted, 0 with outstanding errors (0 total).node scripts/check-type-check-coverage.mjs✅ type-check coverage: 45/46 via 'type-check' … 41/41 packages compile their testspnpm check:phantom-deps✅ Every in-scope import is declared by the package that publishes it.pnpm check:self-import✅ No package names itself inside its own src/.Two "ran but did not measure" traps ruled out by measurement, not by assumption:
type-checkcompiles tests through a second project(
tsc -p tsconfig.test.json).--listFilesconfirms both edited files are in thatprogram —
renderers/form/button.tsxandrenderers/form/__tests__/button-shared-icon-resolver.test.tsx— so "type-check is clean"is a statement about the new test file too, not merely next to it.
pnpm lintis the repo-wide scan (eslint .in 47 tasks) and it was run in full, notnarrowed:
Tasks: 47 successful, 47 totalin 4m6s. No narrowing needed and none claimed.Left to CI, declared rather than skipped silently:
check:esm-specifiers,check:spec-symbols,check:action-forward-parity,check:designer-field-key-parity,check:i18n-keys,check:i18n-drift,check:node-esm-load,check:published-dist,type-check:vitest-setup, the repo-wide shardedpnpm test, the coverage merge, the CLIself-check and Build & E2E.
half-state-patrolis a scheduled backlog sweep, not a gate onthis diff.
8. Files
packages/components/src/renderers/form/button.tsx— imports the shared resolver; localtoPascalCase,iconNameMapand theiconsimport deleted.packages/components/src/renderers/form/__tests__/button-shared-icon-resolver.test.tsx—new. 11 rows: 1 harness control, 2 routing (the discriminating pair), 8 behaviour.
scripts/check-lucide-icon-record-names.mjs— census: reader dropped,buttontype'sresolver re-pointed.
scripts/__tests__/check-lucide-icon-record-names.test.ts— population pins 8 → 7..changeset/5993-button-shared-icon-resolver.md—patchon@object-ui/components(
node scripts/check-changeset-presence.mjsasked for one: published source changed).Never
major, per AGENTS.md §版本号策略.Generated by Claude Code