fix: report empty connections targets instead of crashing the render - #3963
Open
Itachi3355 wants to merge 2 commits into
Open
Itachi3355 wants to merge 2 commits into
Itachi3355 wants to merge 2 commits into
Conversation
An empty or whitespace-only value in `connections` reached `selectOne` as a selector, where css-what threw `Expected name, found .`. The exception aborted the whole render, so a single bad entry produced no circuit JSON at all, and the message named neither the component nor the pin. Empty targets are now skipped when creating nets and traces, and reported as a `source_component_misconfigured_error` naming the component and pin during SourceComponentPropertyValidation, once the source component id exists. Sibling connections and the rest of the board still render. Non-empty but unresolvable selectors are untouched, since they already have their own downstream handling. Fixes tscircuit#2865 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
Author
|
Merged current Not stale from my side; this is waiting on maintainer review. Happy to rebase, split, or adjust the error message/wording if you would prefer a different shape. 🤖 Addressed by Claude Code |
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.
Fixes #2865
Problem
An empty or whitespace-only value in
connectionsreachedselectOneas a selector, wherecss-whatthrew:Two problems, as described in the issue:
css-whatinternals. The natural reading is that the valid selector is malformed.Fix
Empty targets are skipped when collecting nets (
_getNetsFromConnectionsProp) and when creating traces (_createTracesFromConnectionsProp), so the rest of the board renders. The misconfiguration is recorded as asource_component_misconfigured_errornaming the component and pin:The error is emitted in
doInitialSourceComponentPropertyValidationrather than at trace-creation time, becauseCreateTracesFromPropsruns beforeSourceRenderandsource_component_iddoes not exist yet.Scope, following the issue author's notes:
".R9 > .pin1"where R9 doesn't exist) already has its own downstream handling and is untouched.connectionsentry.""at the props-schema level intscircuit/props, which would be a cross-repo change with a wider blast radius.Verification
tests/components/normal-components/empty-connections-target.test.tsx. Both fail on cleanmainwith the exact reportedExpected name, found .crash, and pass with the fix.connections: 308 pass / 4 fail. The same 4 fail on cleanmainwith this change stashed — all autorouting/breakout/fanout, unrelated to this path. No failure is unique to this change.bunx tsc --noEmitexits 0; biome format clean.One unrelated flake noticed while establishing the baseline:
tests/features/autoroutingphase-connection-phase-index.test.tsxfailed 2 of 3 runs on cleanmainwith this change stashed.🤖 Generated with Claude Code