Repository navigation
fix(core): preserve composition startup error stacks - #6353
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
jrusso1020
left a comment
There was a problem hiding this comment.
Approved. Startup errors now keep their stack locations and still fall back to the message when there's no stack. Removing the stack attachment fails 12 tests, and the regenerated bundle differs only by renamed identifiers.
miguel-heygen
left a comment
There was a problem hiding this comment.
Thanks, this is a careful fix and the tests are thorough. I regenerated position-edits-render-inline.ts from the generator at this head and it matches the committed file exactly, so the change there is just minifier renaming. The tests are doing real work: removing the stack attachment fails 12 of them, removing the composition-frame step fails 7, and dropping the whitespace collapse or allowing hyperframes:// frames each fails at least one. Errors without a usable stack and non-Error throws still get the same message as before.
One suggestion for the docs (docs/guides/troubleshooting.mdx:206). In a render, the composition's inline scripts all show up as hyperframes-composition://body, and the line numbers count from the start of each <script>, not from the top of the HTML file. I checked this in Chrome 152 with two inline scripts below 20 lines of markup: the frames read hyperframes-composition://body:3:8 and hyperframes-composition://body:2:32. Someone following the guide would likely open line 3 of index.html. A sentence like "hyperframes-composition://body means one of your composition's inline scripts; its line number counts from that script's opening tag, and the function name in the frame tells you which one" would prevent that. Not blocking.
Verdict: APPROVE
Reasoning: Stacks are kept on one line with a bounded frame count, the generated file matches its generator, fallbacks are covered, every behavior is pinned by tests that fail without it, and CI is green; the docs note is a small follow-up.
Composition startup errors now include a short stack after the error name and message: the first three frames plus the first recognized composition frame, all on one line. This identifies the throwing library and the authored call site when the browser supplies those locations. Headerless browser stacks and unavailable stack getters retain useful diagnostics.
The troubleshooting guide explains these locations. The required tracked position-edit helper was regenerated; only minified local identifiers changed.
Validation: 11 regressions fail on the original source; 74 focused diagnostics, startup and position-edit tests pass. Full build, typechecks, lint/format, runtime checks, test reachability, normal commit hooks, comment checks and Mint checks pass. Native Chrome 152 checks pass for real thrown-error stacks with the compiler source URL, a custom HTML path and an extensionless preview URL. These checks use local test pages; the original Windows GSAP fixture was not run.
Fixes #6334