Closed general

export passes stale zone fills: 'fills in saved board yes' while the saved fills short new copper (DRC only clean with --refill-zones)

noah · ·closed by John Lauer

What happened

On a 2-layer board finished with offline pcbnew scripts (a dozen copper edits after the pours, each script ending in pcbnew.SaveBoard without ZONE_FILLER(...).Fill(...)), the saved file kept the zone fills from before the edits. Every check passed it:

  • kicad-cli pcb drc --refill-zones (the gate's DRC): 0 errors, because it refills before checking.
  • adom-aiflow export: "fills in saved board yes, fills in Gerbers yes".

A DRC of the same saved file without --refill-zones found 34 clearance, 6 hole-clearance and 4 solder-mask-bridge errors: the old fills overlapped the new tracks and vias. The Gerbers plot the saved fills, so the first manufacturing set had copper shorts in it and had to be replaced. Refilling and saving fixed it (0 errors, 0 unconnected, without refill).

Why it slips through

"Fills in saved board" proves the fills exist, not that they are current. Gerbers and STEP plot the saved fills as they are; nothing compares them with a fresh fill.

Asks

  1. export (and gate before it): run DRC on the exact file being exported without --refill-zones, or refill a copy and compare the fill polygons with the saved ones, and refuse when they differ: "the saved zone fills are stale: refill zones and save (pcbnew ZONE_FILLER(board).Fill(board.Zones()) before SaveBoard), then export again".
  2. A hint wherever AI Flow suggests offline pcbnew edits (adopt-board, native pours) that a script must refill before SaveBoard.

Versions

adom-aiflow 0.2.55 (KiCad lane; IPC socket patch only, export and gate unchanged), KiCad 10.0.6 on Windows through kicad-cli-remote, pcbnew SWIG from KiCad 10.0.6. Hydrogen local workspace (WSL2).

1 Reply

John Lauer ·

Thanks Noah, this is a serious one, and your diagnosis was exactly right.

What was wrong. "fills in saved board yes" only checks that each zone has filled polygons, and "fills in Gerbers yes" only checks that the copper Gerbers have regions. Neither checks that the fills are current. The gate's DRC uses --refill-zones, so it checks fresh fills, while the Gerbers and STEP plot the saved ones. Nothing compared the two.

What changed (in adom-aiflow 0.2.56).

  • export now also runs kicad-cli pcb drc on the exact file it exports, without --refill-zones. Blocking findings that name a zone (for example "Zone [GND] on F.Cu" against a track or via) mean the saved fills are older than the copper. They are recorded in the export report as fillsCurrent: pass, a count by type, and the first findings.
  • When the fills are stale, export answers FINDINGS: "manufacturing files written to ..., but the saved zone fills are stale: DRC of the saved board without refilling finds N violation(s) involving zones (clearance 34, ...), and the Gerbers plot those fills". The hint gives the fix: in KiCad, Edit > Fill All Zones (or kicad_refill_zones) and save; in a pcbnew script, pcbnew.ZONE_FILLER(board).Fill(board.Zones()) before pcbnew.SaveBoard(...); then export again.
  • finish's verified list reads "fills in Gerbers NO (the saved zone fills are stale ...)" until a fresh export is clean, so the board is never reported cleared with stale fills.
  • If the DRC can't run, the export report says the check was not run and suggests running it before ordering.
  • The skills now say that any pcbnew script that edits copper must refill before SaveBoard (adom-aiflow and aiflow-schematic-to-board).

You asked for export to refuse. It reports a finding instead, because AI Flow is a suggestion engine and never refuses a command. In practice, the export says plainly that the files carry stale fills and finish won't clear the board until they're fixed.

Still open. The gate still checks with --refill-zones (that is what it is for). The new check runs at export, which is where the Gerbers come from.

How it was verified. New unit tests check the zone classification: clearance and hole-clearance findings against a zone count, and track-only findings don't. The export integration test (stand-in kicad-cli) checks three cases: stale fills are recorded and are not a refusal; a missing DRC report is recorded as not run; finish's item reads NO when the fills are stale. I did not rerun your board on real KiCad. All unit tests and workflow suites pass.

Upgrade: tell your AI "give me the latest adom-aiflow" (or adom-wiki pkg install adom/adom-aiflow); adom-aiflow --version says 0.2.56.

John Lauer closed this ·

Log in to reply.