Repository navigation
Description
Summary
If an authored <copperpour> has no same-net copper on its own layer, Board_doInitialPcbCopperPourCleanup deletes every fragment of it (db.pcb_copper_pour.delete(pourId)) and emits no copper-pour diagnostic. Two examples: an inner1 plane, or a bottom pour whose net has only top-layer SMT pads. The net still has same-net pads elsewhere, so the floating-copper check treats the pour as removable. Nets with no anchors at all keep their pours (find-floating-copper.ts:344).
After the cleanup, the Circuit JSON has no pcb_copper_pour and the KiCad export has no (zone …). The existing pcb_copper_pour_isolated_warning never appears either, because the pour is deleted before the island check can see it. The user believes they have a ground plane and silently gets none.
Repro
// tests/repros/repro5068-authored-pour-removed-silently.test.tsx
import { expect, test } from "bun:test"
import { getTestFixture } from "tests/fixtures/get-test-fixture"
test.each([
{ layers: 4, layer: "inner1" },
{ layers: 2, layer: "bottom" },
] as const)(
"unseeded authored $layer pour is not removed silently",
async ({ layers, layer }) => {
const { circuit } = getTestFixture()
circuit.add(
<board width="20mm" height="10mm" layers={layers}>
<resistor
name="R1"
resistance="10k"
footprint="0603"
connections={{ pin1: "net.GND", pin2: "net.GND" }}
/>
<copperpour connectsTo="net.GND" layer={layer} />
</board>,
)
await circuit.renderUntilSettled()
const json = circuit.getCircuitJson()
const pours = json.filter((e) => e.type === "pcb_copper_pour")
const warnings = json.filter(
(e) => e.type === "pcb_copper_pour_isolated_warning",
)
// Today: pours.length === 0 and warnings.length === 0.
expect(pours.length > 0 || warnings.length > 0).toBe(true)
},
)On main (v0.0.2399, 0ce5c61) both cases fail: 0 pass, 2 fail.
Expected
At least one diagnostic for an authored pour whose islands are all removed. For example, keep emitting pcb_copper_pour_isolated_warning with the pour id, layer and net, or add a pcb_copper_pour_removed_warning. Optionally, keep the authored outline so the KiCad export still contains the zone definition. KiCad's own island removal keeps the zone and only empties the fill.
Actual
pcb_copper_pour: 0- copper-pour warnings: none (the only warning is the unrelated
schematic_missing_sheet_warning) - KiCad
.kicad_pcb: 0 zones
Evidence
- When
Board.prototype.doInitialPcbCopperPourCleanupis stubbed to a no-op, both cases pass. Each gives 1pcb_copper_pour, 1 KiCad zone, and:
Copper pour for GND has an isolated island on inner1 near (0.00 mm, 0.00 mm) with no physical connection to a same-net pad or via
(the same message forbottom). The information exists; the cleanup removes it first. - The cleanup was introduced in Remove electrically isolated copper pours after via stitching #3699. Preserve authored copper during cleanup #4687 ("Preserve authored copper during cleanup") was closed without merging.
lib/components/normal-components/Board/Board_doInitialPcbCopperPourCleanup.tsis unchanged onmain.
Versions
- @tscircuit/core v0.0.2399 (0ce5c61, current
main), Bun 1.3.14, circuit-json-to-kicad 0.0.272 (core dev dependency), tested in this repo's own test setup. - Also seen downstream with tscircuit 0.0.3192 / core 0.0.2385 and tscircuit 0.0.3208 / core 0.0.2399.
Activity
0hmX commentedon Nov 19, 2026
I don't think this is a bug. Removing unconnected copper pours is standard behavior. Here, nothing connects the GND pads to the inner1/bottom pour, so cleanup flags it as dangling copper and removes it. That's expected: any copper pour assigned to a net that isn't physically connected to that net should be removed.
To keep the pour, connect it explicitly. For example, add a via or a trace with a custom
pcbPathdown to the pour's layer, or useautorouter="fanout", which treats the pour as a plane and adds the vias for you.Closing this as working as intended.
bhatipoglu commentedon Nov 20, 2026
Thanks, that makes sense. Removing a pour that has no physical connection to its net is the right behaviour, and a via, a
pcbPathtrace orautorouter="fanout"fixes the board.What I'd still like to address is that the removal is silent. When cleanup removes an entire authored
<copperpour>, Circuit JSON has no pour and no warning, and the KiCad export has no zone. Nothing tells the user why their plane is missing. #5736 keeps the removal exactly as it is. It only emits onepcb_copper_pour_isolated_warningfor the removed pour, with the net, the layer and the same fixes you suggested here.If you'd rather not add a warning either, I'm happy to close #5736 along with this issue.