From 595b99b9b17f3fe006511f501ea0e5d2dd14e2b9 Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Thu, 13 Aug 2026 00:38:53 +0530 Subject: [PATCH 1/2] Retry net label placement at default size when custom dimensions never fit Signed-off-by: Priyanshubhartistm --- .../NetLabelPlacementSolver.ts | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts b/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts index 8a76c4606..ef85875b9 100644 --- a/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +++ b/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts @@ -77,6 +77,8 @@ export class NetLabelPlacementSolver extends BaseSolver { failedGroups: Array = [] currentGroup: OverlappingSameNetTraceGroup | null = null triedAnyOrientationFallbackForCurrentGroup = false + triedUserOrientationDefaultDimensionsFallbackForCurrentGroup = false + triedDefaultDimensionsFallbackForCurrentGroup = false constructor(params: { inputProblem: InputProblem @@ -307,6 +309,8 @@ export class NetLabelPlacementSolver extends BaseSolver { this.activeSubSolver = null this.currentGroup = null this.triedAnyOrientationFallbackForCurrentGroup = false + this.triedUserOrientationDefaultDimensionsFallbackForCurrentGroup = false + this.triedDefaultDimensionsFallbackForCurrentGroup = false return } @@ -337,6 +341,58 @@ export class NetLabelPlacementSolver extends BaseSolver { return } + // A caller-specified net label size (netLabelWidth/netLabelHeight) can be + // too large to fit in a cramped island even though the same net places + // fine elsewhere. Retry at the default label size before giving up on + // the group entirely - first honoring the caller's orientation + // constraint, then (if that still doesn't fit) any orientation. A + // smaller-than-requested label beats no label at all. + if (this.currentGroup) { + const netLabelWidth = this.getNetLabelWidthForGroup(this.currentGroup) + const netLabelHeight = this.getNetLabelHeightForGroup(this.currentGroup) + const hadCustomDimensions = + netLabelWidth !== undefined || netLabelHeight !== undefined + + if ( + hadCustomDimensions && + !this.triedUserOrientationDefaultDimensionsFallbackForCurrentGroup + ) { + this.triedUserOrientationDefaultDimensionsFallbackForCurrentGroup = true + const netId = + this.currentGroup.netId ?? this.currentGroup.globalConnNetId + const userOrientations = + this.inputProblem.availableNetLabelOrientations[netId] ?? + fullOrients + const userOrientationsAlreadyFull = + userOrientations.length === 4 && + fullOrients.every((o) => userOrientations.includes(o)) + + if (!userOrientationsAlreadyFull) { + this.activeSubSolver = new SingleNetLabelPlacementSolver({ + inputProblem: this.inputProblem, + inputTraceMap: this.inputTraceMap, + overlappingSameNetTraceGroup: this.currentGroup, + availableOrientations: userOrientations, + }) + return + } + } + + if ( + hadCustomDimensions && + !this.triedDefaultDimensionsFallbackForCurrentGroup + ) { + this.triedDefaultDimensionsFallbackForCurrentGroup = true + this.activeSubSolver = new SingleNetLabelPlacementSolver({ + inputProblem: this.inputProblem, + inputTraceMap: this.inputTraceMap, + overlappingSameNetTraceGroup: this.currentGroup, + availableOrientations: fullOrients, + }) + return + } + } + // Record the failure for this group and continue to the next one if (this.currentGroup) { this.failedGroups.push(this.currentGroup) @@ -344,6 +400,8 @@ export class NetLabelPlacementSolver extends BaseSolver { this.activeSubSolver = null this.currentGroup = null this.triedAnyOrientationFallbackForCurrentGroup = false + this.triedUserOrientationDefaultDimensionsFallbackForCurrentGroup = false + this.triedDefaultDimensionsFallbackForCurrentGroup = false return } @@ -366,6 +424,8 @@ export class NetLabelPlacementSolver extends BaseSolver { this.currentGroup = nextOverlappingSameNetTraceGroup this.triedAnyOrientationFallbackForCurrentGroup = false + this.triedUserOrientationDefaultDimensionsFallbackForCurrentGroup = false + this.triedDefaultDimensionsFallbackForCurrentGroup = false const netLabelWidth = this.getNetLabelWidthForGroup(this.currentGroup) const netLabelHeight = this.getNetLabelHeightForGroup(this.currentGroup) From bf34447bfbdbe4f301acb6a18335f0af7e706d0d Mon Sep 17 00:00:00 2001 From: Priyanshubhartistm Date: Thu, 13 Aug 2026 00:38:53 +0530 Subject: [PATCH 2/2] Add real assertions to atmega328p GND repro, update snapshots for recovered labels Signed-off-by: Priyanshubhartistm --- .../bug-report-20260706T220324Z.snap.svg | 2 + .../bug-report-20260707T092615Z.snap.svg | 2 + .../bug-report-20260707T134549Z.snap.svg | 2 + .../bug-report-20260708T055430Z.snap.svg | 94 +++++------ ...o-atmega328p-missing-gnd-netlabel.snap.svg | 154 +++++++++--------- .../repro-ina237-current-monitor.snap.svg | 6 +- ...ro-rp2040-gamepad-trace-alignment.snap.svg | 12 +- ...variant-resistor-facing-direction.snap.svg | 94 +++++------ ...ro-atmega328p-missing-gnd-netlabel.test.ts | 16 +- 9 files changed, 204 insertions(+), 178 deletions(-) diff --git a/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg b/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg index d24c2ffca..cee04f322 100644 --- a/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +++ b/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg @@ -79,6 +79,7 @@ globalConnNetId: connectivity_net24" data-x="-3.0789999999999997" data-y="-1.090 globalConnNetId: connectivity_net24" data-x="-0.5176339500000009" data-y="-6.014" x="336.329200264733" y="380.3209225488325" width="20.94451226000814" height="4.363440054168336" fill="hsl(80, 100%, 50%, 0.35)" stroke="black" stroke-width="0.04583539535714285"/> + ]]> \ No newline at end of file diff --git a/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg b/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg index ab2cdefc5..804c560f9 100644 --- a/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg +++ b/tests/repros/__snapshots__/small-variant-resistor-facing-direction.snap.svg @@ -1,48 +1,50 @@ -