This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
refactor(app-shell): drop the redundant unknown[] assertion in useReconcileOnError - #8389
Merged
Merged
Conversation
…oncileOnError (objectui#8379) `useReconcileOnError` handed the rehydrated thread to the chat sink as `setMessagesRef.current(ui as unknown[])`. `toUIMessages` returns `HydratedUIMessage[]`, and the sink -- `useObjectChat`'s `setMessages?: (messages: unknown[]) => void` in `@object-ui/plugin-chatbot` -- takes `unknown[]`. An array of anything already widens to `unknown[]`, so the assertion converted nothing. It was not inert in the way that matters, though: it sits on the published boundary that objectui#8342 found to be lying, so it is exactly the thing that would swallow the diagnostic if either side of the seam is ever tightened -- the class of objectui#4424, where a cast on this same seam deleted capability with the compiler agreeing. Deleting it makes the compiler answer the question instead of being told not to. Measured on ab03bff with the dependency closure built: `tsc --noEmit` and `tsc -p tsconfig.test.json` are both exit 0 with zero `error TS` lines, with and without the assertion; the emitted JavaScript is byte-identical either way, so the changeset declares an empty frontmatter. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
The first wording said "the emitted JavaScript is byte-identical", which is true of the assertion in isolation but reads as a claim about this whole change. Two real package builds say it exactly: the published `.d.ts` is byte-identical, and the published `.js` differs only by the four comment lines this change adds. No code delta either way. 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 7, 2026 16:05
os-justin
enabled auto-merge
September 7, 2026 16:05
os-justin
deleted the
claude/issue-8379-reconcile-redundant-assertion
branch
September 7, 2026 16:33
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 #8379
useReconcileOnErrorhanded the rehydrated thread to the chat sink assetMessagesRef.current(ui as unknown[]). Both sides of that call are already compatible, so theassertion converted nothing:
toUIMessages(rows): HydratedUIMessage[]packages/app-shell/src/hooks/useChatConversation.ts:479setMessages?: (messages: unknown[]) => voidpackages/plugin-chatbot/src/useObjectChat.ts:360React.MutableRefObjectparameterised with((m: unknown[]) => void) OR undefinedpackages/app-shell/src/hooks/useReconcileOnError.ts:36An array of anything already widens to
unknown[]. Site re-derived on this branch's own base(
ab03bffae), not trusted from the card: still line 74, one hit, lit control (a made-up type name onthe same instrument) 0.
Note on spelling: the generic parameter above is written in words rather than in angle brackets
because GitHub silently eats tag-shaped fragments from stored bodies, including inside backticks —
a table written to show a type would otherwise render as if nothing were there.
Why this is not a tidy-up
A redundant assertion and a load-bearing one look identical in the source, so the deletion is only
worth making if you can show which one this is — that proof is the content of this PR.
And it is worth making. This assertion sits on exactly the seam objectui#8342 was about: the one
real in-repo consumer of that hook member, on a published-package boundary. It costs nothing today
and it is precisely the thing that would swallow the signal tomorrow — if
toUIMessages's returntype is ever narrowed, or if the sink's parameter is ever tightened (which is what option A on
objectui#8342 would have done),
as unknown[]erases the diagnostic that should fire at this exactline. That is the failure class of objectui#4424, where a cast on this same seam deleted capability
with the compiler agreeing, and it is how objectui#8342's own defect stayed invisible behind
chatResult as anyuntil someone removed it.Deleting it makes the compiler answer the question instead of being told not to.
Evidence: inert in both directions
The instrument is
type-check, not vitest — vitest transpiles types away and can never see this.app-shell's
type-checkscript istsc --noEmit && tsc -p tsconfig.test.json, and both projectswere run separately (so neither hides behind the other's short-circuit), with the dependency closure
built first (
pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build, exit 0).tsconfig.json)tsconfig.test.json)error TSlineserror TSlineserror TSlineserror TSlineserror TSlineserror TSlinesAll six runs produced zero lines of output at all, not merely zero matches. The reverse leg is what
makes this a reading rather than a tolerance: the assertion is inert in both directions, not merely
tolerated in one.
Both legs were mutated and restored by state, from a committed implementation, under a
trap ... EXIT INT TERMwith absolute paths:git hash-objectdifferedfrom
git rev-parse HEAD:PATH(7f5b89c9fvsa1c6bcce5)git hash-objectequal togit rev-parse HEAD:PATHagain andgit diff HEADempty. Never by an exit code.
The files being quoted are actually in the programs being quoted
This matters here specifically:
tsconfig.jsonexcludes__tests__/by directory, and thishook's only test lives at
src/hooks/__tests__/useReconcileOnError.test.ts. objectui#8342 measured acase that was red only in the test program for exactly that reason, so a claim quoted from one
project alone would not be a reading.
src/hooks/useReconcileOnError.tstsconfig.jsontsconfig.test.jsonBoth hits are non-zero, so they are self-validating; the made-up filename returning 0 on the same
instrument confirms the matcher discriminates rather than matching everything.
Nothing moved at runtime
(
pnpm exec vitest run packages/app-shell/ --no-passWithNoTests):Test Files 649 passed (649),Tests 6255 passed | 1 skipped (6256), exit 0. A type-only deletionshould move nothing, and it moved nothing. (649 files, not the 22 that the
wrong-cwd false green reports.)
eslint .for the package: exit 0,2925 problems (0 errors, 2925 warnings)— all pre-existingno-explicit-anywarnings in other files.What the published tarball actually gains
Measured with two real package builds (
tsc), base file swapped in and out under the same trap:.d.ts— byte-identical. The change is entirely inside a function body..js— the only delta is the four explanatory comment lines this change adds. Withcomments stripped, both emits are 1584 bytes and identical, so there is no code delta: the
assertion is erased by the compiler either way.
Changeset
node scripts/check-changeset-presence.mjsverdict, quoted:Argued both ways, since the empty spelling should be reasoned to rather than felt:
minor— this issrc/of a package the release covers, which is the gate's own trigger;and a
minoris cheap right now, sincemainalready carries hundreds of pendingminorchangesets in the same 40-package
fixedgroup, so one more costs nothing incremental.releases anything, and names the empty spelling "a pass, not a workaround". Here that is measured,
not asserted: identical
.d.ts, zero code delta in.js. A release-note line saying "removed aredundant type assertion" would be noise in the platform's notes, which read this repo's declared
changesets verbatim. Declaring "this releases nothing" is the true statement.
scripts/check-changeset-no-major.mjs:✅ No changeset declares a major bump.node scripts/check-governed-queue-guard.mjs --test <the two changed paths>:✅ NOT GOVERNED — 2 path(s) checked against 5 governed surface(s); none matched.One correction against my own working notes
While measuring the emit delta I first wrote
git show "$BASE":pathin a shell where$BASEwasunset. That expands to
git show :path, which reads the index — it exits 0 and prints a realfile, so the comparison silently became implementation-vs-itself and reported "identical" for the
comments-preserved emit too. Caught by asking the base copy a question it had to answer (
as unknown[]must appear exactly once in it; it appeared zero times). Every base-side read in this PR now names the
literal sha. The corrected measurement is the one in the table above, and it changed the conclusion:
the comments-preserved emit is not identical, which is why the changeset wording was revised in a
second commit rather than left as first written.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YBWFb5YgMU5dw8p2VKj16S
Generated by Claude Code