fix: omit group anchor_alignment and subcircuit_id instead of writing null (#2845)#2846
fix: omit group anchor_alignment and subcircuit_id instead of writing null (#2845)#2846DPS0340 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
11077e0 to
39aec1a
Compare
|
Housekeeping — rebased onto current Since I have several PRs open here now, a note on how they interact so none of this lands on you: Five of the seven are fully independent — they touch different files and merge in any order:
Two pairs conflict, and both are trivial:
Happy to do the merge myself: say the word and I'll combine any subset into a single PR, or rebase the losers as soon as the first one lands. I'd rather you not spend time on conflict resolution for my changes. I verified the above rather than assuming it — checked all 21 branch pairs for conflicts and confirmed each rebases cleanly onto |
39aec1a to
2bc8d19
Compare
Closes #2845.
<group />wrotenullinto two fields that circuit-json types as string-or-absent, so both elements failed validation:Why
undefinedrather than a valueFor
anchor_alignment, omitting is strictly better than substituting"center"in core: the schema already supplies that default, so leaving it out keeps a single source of truth and stays correct if the default ever changes. The explicitpcbAnchorAlignmentprop still passes through unchanged — the test asserts a"top_left"group survives, so this can't be satisfied by blanket-clearing the field.For
subcircuit_id, the!assertion was hiding that the field isstring | null = nullon the component. A group outside any subcircuit genuinely has none, andundefinedis what the schema expects.Three existing tests recorded the invalid values
That's why nothing caught this — the bug was baked into expectations:
group-outline.test.tsx—"anchor_alignment": nullgroup-subcircuit-id.test.tsx—"anchor_alignment": nullgroup-schematic-box.test.tsx—"subcircuit_id": nullAll three updated to
undefined. No assertion was weakened; they're inline snapshots of emitted values.Verification
The test bites. Reverting
Group.ts:It asserts neither field is
null, that an explicitly requested alignment survives, and that neither field appears insafeParseissues — so it pins the schema contract rather than just the absence ofnull.Suite:
1260 pass / 0 fail,tsc --noEmit0 errors,biome formatclean.Note
Locating one of the three failures took a moment because five test files share the test name "group schematic box" — a single-file rerun of the wrong one passes and looks like flakiness. I isolated it by running each candidate file separately.
This is the third and final batch from validating core's output against circuit-json's exported schemas (#2841
display_offset_x/y, #2843 hole elements). With this merged,<group />no longer contributes violations.