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
2 changes: 1 addition & 1 deletion docs/validate.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ for that stage.
- **Cache.** `.copperpilot/validate/cache/<key>.json`, where the key hashes the
check spec, preamble, limits, profile, `--context` file hashes, the
`--repeat`/`--effort` overrides, and the check's `inputs` (`sch` = all
sheets, `pcb`, `pro`, `libs` = `.kicad_sym` + `.kicad_mod` + lib tables,
sheets, `pcb`, `pro` = project settings and custom design rules, `libs` = `.kicad_sym` + `.kicad_mod` + lib tables,
`intent` = `.copperpilot/README.md`, `PLANS.md`, `plans/*.md`, `all` = the
whole tree). A PCB-only change re-runs only PCB-dependent checks. `intake.*`
checks always run.
Expand Down
2 changes: 1 addition & 1 deletion src/copper_pilot_cli/validate/design.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _matches_input(relative: str, kind: str) -> bool:
if kind == "pcb":
return suffix == ".kicad_pcb"
if kind == "pro":
return suffix == ".kicad_pro"
return suffix in {".kicad_pro", ".kicad_dru"}
if kind == "libs":
return suffix in _LIB_SUFFIXES or path.name in _LIB_TABLES
if kind == "intent":
Expand Down
15 changes: 15 additions & 0 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,21 @@ def test_input_hashes_select_by_kind(tmp_path) -> None:
assert not input_hashes(tmp_path, ["libs"])


def test_drc_cache_key_tracks_custom_design_rules(tmp_path) -> None:
make_project(tmp_path)
runner = runner_for(tmp_path)
check = runner.config.check("pcb.drc")
rules = tmp_path / "board" / "board.kicad_dru"
without_rules = runner.cache_key(check)
rules.write_text('(version 1)\n(rule "width" (constraint track_width (min 0.2mm)))\n')
with_rules = runner.cache_key(check)
assert with_rules != without_rules
rules.write_text(rules.read_text().replace("0.2mm", "0.3mm"))
assert runner.cache_key(check) != with_rules
rules.unlink()
assert runner.cache_key(check) == without_rules


def test_snapshot_is_read_only_and_excludes_git_and_copperpilot(tmp_path) -> None:
make_project(tmp_path)
(tmp_path / ".git").mkdir()
Expand Down