Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ registered builtin; a `{items}` placeholder is present when `scope` is not
| S0 Intake | `intake.tools` (kicad-cli 9/10), `intake.project` (netlist export; parts, nets, sheets, layers indexed), `intake.intent` (advisory: project index and plan present) | — |
| S1 Architecture | — | `arch.review` (block diagram, power tree and budget, protection, clocks, boot path; intelligence effort) |
| S2 Parts | `parts.bom_fields` (Value, Footprint, MPN, LCSC `C#####`, Datasheet; DNP and mechanical parts exempt), `pcb.models_3d` (ungated: every footprint `(model ...)` path resolves through `${KIPRJMOD}`, `${KICADn_3DMODEL_DIR}`, KiCad's configured path variables and the system 3D directory, P1 per missing file; parts with a body but no model, P2) | `parts.lcsc`, `parts.symbols`, `parts.footprints` (per part) |
| S3 Schematic | `sch.erc` | `sch.conventions` (per sheet), `sch.circuits` (per sheet; requires `arch.review`, `parts.symbols`, `sch.erc`), `sch.ratings` |
| S4 Netlist→layout | `pcb.parity` (schematic parity + unconnected items), `pcb.rules` (board rules and net classes ≥ fab limits) | — |
| S3 Schematic | `sch.erc` (re-runs when ERC severities, the pin map or exclusions in `.kicad_pro` change) | `sch.conventions` (per sheet), `sch.circuits` (per sheet; requires `arch.review`, `parts.symbols`, `sch.erc`), `sch.ratings` |
| S4 Netlist→layout | `pcb.parity` (schematic parity + unconnected items; re-runs when DRC severities or exclusions in `.kicad_pro` change), `pcb.rules` (board rules and net classes ≥ fab limits) | — |
| S5 Placement | `pcb.connector_edge` (ungated: USB, RJ45, HDMI, DisplayPort, DVI, barrel/audio jacks and D-Sub sit on the board edge with the mating face pointing out; the face is taken from the pad centroid to the Fab/courtyard body centre; P1 when facing inward or along the edge or not on an edge, P2 when set back more than 2.5 mm; headers, board-to-board, vertical and ambiguous parts are not judged) | `pcb.placement` (requires `pcb.parity`, `parts.footprints`) |
| S6 Routing SI/PI | — | `pcb.power_routing`, `pcb.signal_integrity` (per net class) |
| S7 DFM/DFA | `pcb.drc` | `dfm.fab`, `dfa.assembly`, `pcb.silkscreen` (advisory) |
Expand Down
4 changes: 2 additions & 2 deletions src/copper_pilot_cli/validate/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ checks:
kind: builtin
builtin: erc
requires: [intake.project]
inputs: [sch, libs]
inputs: [sch, libs, pro]

- id: sch.conventions
stage: S3
Expand Down Expand Up @@ -223,7 +223,7 @@ checks:
kind: builtin
builtin: parity
requires: [intake.project]
inputs: [sch, pcb]
inputs: [sch, pcb, pro]

- id: pcb.rules
stage: S4
Expand Down
23 changes: 23 additions & 0 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,29 @@ async def test_cache_reuse_and_invalidation(tmp_path) -> None:
assert not any(result.cached for result in fourth.results)


@pytest.mark.asyncio
async def test_erc_and_parity_rerun_when_project_settings_change(tmp_path) -> None:
# KiCad keeps ERC and DRC/parity severities, the pin map and exclusions in
# .kicad_pro, so a settings-only change must not reuse ERC or parity results.
make_project(tmp_path)
kicad = FakeKicad()
turn = FakeTurn()
options = RunOptions(gate=GateMode.FULL)
await runner_for(tmp_path, options=options, kicad=kicad, turn=turn).run()

project_file = tmp_path / "board" / "board.kicad_pro"
project = json.loads(project_file.read_text(encoding="utf-8"))
project["erc"] = {"rule_severities": {"pin_to_pin": "error"}}
project_file.write_text(json.dumps(project), encoding="utf-8")
kicad.calls.clear()
second = await runner_for(tmp_path, options=options, kicad=kicad, turn=turn).run()
cached = {r.check_id for r in second.results if r.cached}
assert "sch.erc" not in cached and "pcb.parity" not in cached
assert "erc" in kicad.calls and "drc+parity" in kicad.calls
# Checks that do not read project settings still hit the cache.
assert "sch.conventions" in cached and "arch.review" in cached


@pytest.mark.asyncio
async def test_error_results_are_never_cached(tmp_path) -> None:
make_project(tmp_path)
Expand Down