fix: carry net highlightColor into pcb_trace.highlight_color (#2839)#2840
fix: carry net highlightColor into pcb_trace.highlight_color (#2839)#2840DPS0340 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
06a7efe to
e9244d4
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 |
e9244d4 to
060a89d
Compare
Closes #2839.
NetProps.highlightColoris documented andpcb_trace.highlight_colorexists on the circuit-JSON schema, but the value was never written —grep -rn "highlightColor\|highlight_color" lib/returned nothing in core.Finding the right insertion site mattered more than the fix
There are five
db.pcb_trace.insertsites. My first attempt patched the ones inTrace_doInitialPcbTraceRender/Trace_doInitialPcbManualTraceRenderand added aTrace._getHighlightColor()helper. The helper resolved correctly — I verified it returns#ff0000— and the output was stillundefined, because for a normally autorouted board none of those sites run.I instrumented each site with a marker to find out which one actually executes: it's the segment insert in
Group.ts, aftergetSourceTraceIdForRoutedTrace. That's where this PR writes the field.That site has only a
source_trace_id, andsource_nethas no highlight field to read back:So
getHighlightColorForSourceTraceresolvessource_trace.connected_source_net_ids→ matchingNetcomponent →highlightColor. It's a small standalone helper rather than inline code so the other insertion sites can adopt it if they ever become reachable.I kept the
Trace._getHighlightColor()helper too, since theTrace_*sites are reachable for cached-route and manual-path boards, and left both paths consistent.Verification
The test bites. Reverting only
Group.ts:It also asserts a second net without the prop stays
undefined, so the fix can't pass by blanket-applying a colour.Suite:
1260 pass / 0 fail, no snapshot churn,biome formatandtsc --noEmitclean.One note on process: an intermediate run of mine reported 7 unrelated failures (3D/PCB snapshot tests). Those were an artifact of my machine hitting 100% disk during the run — they pass individually and the count returns to
0 failon a clean run of this same branch, andmainis also0 fail. Flagging it so a stray number in my earlier notes isn't mistaken for a real regression.How this was found
Cross-referenced every
interface *Propsin@tscircuit/propsagainst the circuit-JSON schema, keeping props whose snake_case name exists as a schema field but which core references under neither name. Exactly two hits:InductorProps.maxCurrentRating(#2837 / #2838) and this one. The sweep is now exhausted for that particular pattern.