Repository navigation
feat(diagnostics): source locations on every finding, docs page per code - #4107
Conversation
Dev and observe builds keep a `loc` (`file:line:col`, root-relative — the compiler's `sourceNames` `locations` kind) in a `_loc` slot beside `_name` on owner, computed, effect, signal and store-property nodes, and on the client and server component owners through a fourth `createComponent` argument. `emitDiagnostic` resolves `DiagnosticEvent.loc` as the innermost located node on the subject's chain, the way `ownerPath` is found, and `reportDiagnostic` prints it as an `at` line after `in` — a dev-server URL in a browser so the devtools link it to Sources. `@solidjs/web`'s `effect` and `insert` take `loc` in their options, `spread` a trailing `loc`. `DEV.guideUrl(code)` is now the code's docs page (`https://v2.solidjs.com/reference/solid-js/diagnostics/<slug>`); the console footer leads with it for a human and keeps the repair skill (installed path and GitHub anchor) on a second line for an agent. `diagnostics.json` is regenerated and the skill documents the `at` line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
A third `sourceNames` kind, `locations`, and a `root` option. Where a
component or binding label is emitted, its source location rides beside it:
`createComponent(Home, props, "Home", "src/App.tsx:12:5")` (the `<Home`
opening element, DOM and SSR), `{ name: "div.class", loc: "src/App.tsx:14:7" }`
(the attribute start; a merged effect points at its first attribute), a
hole's `{` for its insert, and the first spread attribute's start as one more
`spread` argument after the tag. The path is relative to `root` (default:
Babel's `cwd`), posix separators, line and column 1-based. `locations`
follows `dev` like the other kinds; no `filename` → no location.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
`sourceNames` gains a `locations` kind and `transform()` a `root` option.
Where a name is emitted, its source position follows as
`<path>:<line>:<column>` (path relative to `root`, default cwd, posix;
line and column 1-based): a fourth `createComponent` argument at the
opening element (DOM and SSR), `loc` after `name` in a binding's options
(the attribute's start, a hole's `{`; a merged effect points at its first
binding, a property split out of `style={{}}`/`class={{}}` at that
attribute), and one more positional string after the tag for `spread`.
Nothing without a `filename`. `locations` follows `dev` like the other
kinds.
`transformSourceNames` gains `locations` (default true) and `root`, and
writes `loc` right after `name` in the options literal it writes or
completes, keeping an explicit `name` and never overriding an explicit
`loc`.
`relative_id` and the refresh pass's `line_column` move to
`shared::location`, which the no-`node` build can reach. The parity
harness now gives Babel the same `<fixture>.jsx` filename oxc gets, so
the location strings can be compared once both compilers print them.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
The split-out object of `class={["a", { b: x() }]}` and a `{...items()}`
child are holes with a name, so they carry a location too; this keeps both
compilers' dev output identical (the parity suites compare them by text).
The native compiler's copy of the Babel `locations` fixture source is
dropped now that the Babel fixture is on the same branch.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
The compiler's `locations` kind writes `{ name, loc }` into the options
of `createSignal`, `createMemo` and the effect primitives, so the public
option interfaces accept it beside `name`.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
🦋 Changeset detectedLatest commit: fb2dcaf The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size (brotli, eager entry chunk)
|
Coverage Report for CI Build 38819579478Coverage increased (+0.03%) to 77.539%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
…e caps it moves One owner walk for the location (an owner has a `_parent` key, a signal hops to its `_owner`), the store's label and location looked up once per property node: -116 B minified on the observe tier. The rest (+204 B minified, observe-tier only; prod byte-identical except the two bytes of `createComponent`'s fourth parameter) is the feature, so the two observe scenarios and the live + router page are re-based on the measurement with dated ledger lines. No frozen floor moves. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
Merging this PR will improve performance by 5.86%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | dbmon shallow full tick |
53.7 ms | 50.7 ms | +5.86% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/project-thread-atg22y-locations (fb2dcaf) with next (ccd9948)
Summary
Before: a dev console report tells a human what went wrong and names the owner chain (
in <App> › <TodoRow> › effect), but nothing in it leads to the code, and its only guidance line points at the agent repair skill. Scheduler-time findings (HOT_SCOPE_*, SILENT_HOLD, waterfalls, SSR codes) fire from the flush, so even the console gutter link lands inside the runtime.After: the report carries a clickable source location and a human-facing docs link:
Every
DiagnosticEventgainsloc(the innermost located node on the subject's chain, so a scope compiled without a location falls back to its component's JSX site), and@solidjs/diagnosticsartifacts and assertion messages carry it.The location comes from the compilers, not from stack captures:
sourceNamesgains a third kind,locations, in both@solidjs/babel-pluginand@solidjs/compiler, plus arootoption the build tool fills with the Vite root. Components get a 4thcreateComponentargument, bindings getlocbesidename(spread as a 6th positional string, sincespreadtakes no options object), and the nativetransformSourceNamespass writeslocbeside the primitive'sname. Both compilers print identical output; the parity suites assert it.locationsfollowsdevlike the other kinds. A dev-only string literal per site, nothing in production.DEV.guideUrlnow points at the docs page per code (solidjs/solid-docs#1658 adds the 66 pages, generated from the skill; the host flips to docs.solidjs.com at stable with the JSDoc links). solidjs/solid-vite-plugin#421 passes the new options and probes for compiler support so older compilers keep working.Runtime surface:
loc?: stringbesidenameonNodeOptions,StoreOptions,SignalOptions,MemoOptionsand the effect options (documented as compiler-written),createComponent(Comp, props, name?, loc?),DiagnosticEvent.loc. No new exports.How did you test this change?
@solidjs/signals: 5321 passed (new "diagnostics source locations" tests; dist-artifact tests assert_locis an observe-tier slot absent from prod).solid-js: 869 passed,test-typesok (servercreateComponentloc, console footer text, cross-package field reservation).@solidjs/web: 1405 + 1731 + 511 passed (effect/insert/spread loc on nodes and events, performance tracks guide URL). One server spec,server-functions-adapter-request.spec.tsx"keeps a rebuild failure's own error", fails locally on Node 22 becausenew Requestaccepts a fake signal there; it is unrelated to this change and passes on the Node 24 CI uses.@solidjs/diagnostics: 37 passed.@solidjs/babel-plugin: 305 passed (newlocationsfixture, defaults,root).@solidjs/compiler: 6242 passed including cross-mode parity, option matrix and parity probes against the Babel plugin;cargo test(default,--no-default-features,tsrx),cargo clippy -D warnings,cargo fmt --checkclean.node scripts/generate-diagnostics-json.mjs --checkup to date; prettier clean; changesets (patch) for every touched package.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ka6h98478umeFadcRV1KLY
Generated by Claude Code