fix(babel-plugin): stamp only tags that are actually DOM - #901
Merged
Conversation
Extracted, unchanged, from eb3e6c5 on `fix/pr-list-tells-the-truth`, where it rode along inside an onboarding commit on a PR titled about the open-PR list. It is the most severe defect in the 2026-09-08 field export and it needs to land as itself, where a reviewer can see it. "Lowercase means host element" is true only for React DOM. React is a reconciler interface: react-three-fiber, react-pdf and ink define their own lowercase intrinsics, and those host instances are not nodes and do not take attributes. R3F is the case that bit. Its `applyProps` treats any prop containing a dash as a PIERCED PROPERTY PATH, so `data-reticle-source` is walked as `data` -> `reticle` -> `source`; there is no `data` object on a three.js instance and it throws from inside the commit phase. Unhandled there, the whole React tree unmounts to a white screen. It fires on an element UPDATE rather than a mount, so a field app imported a STEP file, ran a volume extraction and rendered geometry for ~20 minutes with ~15 passing verdicts before a newly generated mesh took the app down mid-pipeline — which reads as an application bug, and was initially diagnosed as one. The option that causes it is ON by default, and its documentation names the React version as the risk axis. The actual risk axis is whether the tree contains non-DOM reconciler elements. The check is an ALLOWLIST, not a heuristic. The set of custom-reconciler intrinsics is unbounded and cannot be enumerated; the set of HTML and SVG tags can. Getting it wrong conservatively costs one source pointer on an exotic element. Getting it wrong the other way costs the user their entire app. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Divyanshu Shekhar <imdshekhar@gmail.com>
divshekhar
force-pushed
the
fix/r3f-crash-source-stamping
branch
from
September 8, 2026 19:24
41a2c7d to
34a5b51
Compare
divshekhar
enabled auto-merge (squash)
September 8, 2026 19:24
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The most severe defect in the 2026-09-08 field export. Extracted unchanged from
eb3e6c57onfix/pr-list-tells-the-truth, where it rode along inside an onboarding commit under a PR titled about the open-PR list (#872) — invisible to any reviewer, and lost if that branch were reworked. See my comment on #872 for the suggested split.The defect
"Lowercase means host element" is true only for React DOM. React is a reconciler interface: react-three-fiber, react-pdf and ink define their own lowercase intrinsics, and those host instances are not nodes and do not take attributes.
R3F is the case that bit. Its
applyPropstreats any prop containing a dash as a pierced property path, sodata-reticle-sourceis walked asdata→reticle→source. There is nodataobject on a three.js instance, so it throws:The throw is inside R3F's commit phase and unhandled, so it does not degrade the viewport — it unmounts the entire React app to a white screen.
Why it is severe rather than cosmetic
reticle initlooks clean, a session connects, verdicts pass, and the app dies much later — which reads as an application bug. The reporter initially diagnosed it as one and only found us by reading the stack trace.Net: an entire application category — CAD, simulation, 3D configurators, map and model viewers — is not merely unverifiable but actively broken by installing us.
The approach
An allowlist, not a heuristic. The set of custom-reconciler intrinsics is unbounded and cannot be enumerated; the set of HTML and SVG tags can. Wrong conservatively costs one source pointer on an exotic element. Wrong the other way costs the user their entire app.
Stated rather than implied in
dom-tags.ts: a few three.js class names collide with real DOM tags —lineis both<line>in SVG andTHREE.Line, and so isaudio. A tag name alone cannot separate them, and a lexical "is it under a<Canvas>" walk only sees the file being transformed. The complete answer for a three.js app remainsreticle({ sourceMapping: false }), whichinitnow writes on its own when it finds react-three-fiber in the manifest.Verification
pnpm format:check,pnpm lint,pnpm typecheckgreen; 15/15 babel-plugin tests.Not claimed: I have not driven a real react-three-fiber app against this build. The unit tests pin that the listed non-DOM intrinsics are skipped and DOM tags still stamp; the end-to-end proof that the white screen is gone is the thing #891's awkward-app corpus exists to make routine.
🤖 Generated with Claude Code