Re-parse .kicad_pcb on PCB exam instead of stale layout_graph.
Cached layout_graph still listed stitching via-pads as component pads, so PE-BOM-011 kept firing after the ingest fix. PCB/placement jobs now parse the board file and refresh the cache.
This commit is contained in:
@@ -269,3 +269,43 @@ def test_tht_solder_pads_stay_component_pads(tmp_path: Path):
|
||||
g = parse_kicad_pcb(p)
|
||||
assert [p.number for p in g.footprints["R1"].pads] == ["1", "2"]
|
||||
assert g.vias == []
|
||||
|
||||
|
||||
class _Ws:
|
||||
def __init__(self, root: Path):
|
||||
self.root = root
|
||||
|
||||
def local_path(self, rel: str) -> Path:
|
||||
return self.root / rel
|
||||
|
||||
def _upload_file(self, rel: str) -> None:
|
||||
return None
|
||||
|
||||
|
||||
def test_pcb_pipeline_reparses_stale_layout_graph(tmp_path: Path):
|
||||
from backend.periscopex.models import LayoutFootprint, LayoutGraph, LayoutPad
|
||||
from backend.services.pcb_pipeline import _load_layout
|
||||
|
||||
uploads = tmp_path / "uploads"
|
||||
uploads.mkdir()
|
||||
pcb = _qfn24_pcb(
|
||||
tmp_path,
|
||||
n_pads=24,
|
||||
stitch_via_pads=[(26, 0.0, 0.0, "GND")],
|
||||
)
|
||||
(uploads / "pcb.kicad_pcb").write_text(pcb.read_text())
|
||||
stale = LayoutGraph(
|
||||
footprints={
|
||||
"U1": LayoutFootprint(
|
||||
reference="U1",
|
||||
footprint="QFN-24",
|
||||
x=0, y=0, layer="F.Cu",
|
||||
pads=[LayoutPad(number=str(i), x=0, y=0, net="GND") for i in range(1, 35)],
|
||||
),
|
||||
},
|
||||
)
|
||||
(tmp_path / "layout_graph.json").write_text(stale.model_dump_json())
|
||||
layout = _load_layout(_Ws(tmp_path))
|
||||
assert layout is not None
|
||||
assert len(layout.footprints["U1"].pads) == 24
|
||||
assert len(layout.vias) == 1
|
||||
|
||||
Reference in New Issue
Block a user