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
1 change: 1 addition & 0 deletions src/copper_pilot_cli/validate/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ def cache_key(self, check: CheckSpec) -> str:
"inputs": input_hashes(self.workspace, list(check.inputs)),
"repeat": self.options.repeat,
"effort": self.options.effort,
"kicad_version": self.design.kicad_version if self.design is not None else None,
}
return hashlib.sha256(json.dumps(payload, sort_keys=True).encode()).hexdigest()

Expand Down
30 changes: 30 additions & 0 deletions tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,36 @@ 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_kicad_version_change_invalidates_cached_erc_and_drc(tmp_path):
make_project(tmp_path)
options = RunOptions(gate=GateMode.FULL)

# First validation with KiCad 9.
kicad9 = FakeKicad(version="9.0.1")
await runner_for(
tmp_path,
options=options,
kicad=kicad9,
).run()

# Second validation with KiCad 10, without changing the design.
kicad10 = FakeKicad(version="10.0.4")
second = await runner_for(
tmp_path,
options=options,
kicad=kicad10,
).run()

results = {result.check_id: result for result in second.results}

assert results["sch.erc"].cached is False
assert results["pcb.drc"].cached is False

assert "erc" in kicad10.calls
assert "drc" in kicad10.calls


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