Skip to content

fix(oracle): fail closed when a named engine cannot be used - #22

Merged
CameronBrooks11 merged 1 commit into
mainfrom
fix/17-explicit-engine-fails-closed
Sep 6, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
fix/17-explicit-engine-fails-closed

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

NETSPEC_KICAD_CLI, and the explicit argument behind it, were treated as the first
entry in a candidate list. When the named engine did not probe, discovery fell through
to the next one and the run succeeded against a different engine than the caller
asked for
, with nothing said on stdout, stderr, or in the report.

Why fall-through is the wrong default here

The variable is presented as authoritative -- it is what the tool's own error message
tells you to set. Someone sets it precisely because they need a specific engine: a
second KiCad, a build under test, a pinned CI toolchain. A typo or a stale CI path
therefore produced a green run against the wrong oracle. can do is computed from that
engine's version, so the substitution also changed what the tool claimed to have
checked.

This takes option 1 from the issue, which is the direction the issue itself
expected.

Verified

Before, with a working Flatpak KiCad present:

$ NETSPEC_KICAD_CLI=/nonexistent/kicad-cli netspec doctor
engine   : kicad-cli 10.0.6 (flatpak)
exit=0            # the bad path appears nowhere

After:

$ NETSPEC_KICAD_CLI=/nonexistent/kicad-cli netspec doctor
error: NETSPEC_KICAD_CLI names a kicad-cli that does not work: /nonexistent/kicad-cli
It was set to choose a specific engine, so netspec will not fall back to another one.
Correct it, or unset it to let discovery choose.

This is an environment problem, not a finding about your design.
exit=4

Controls, both confirmed unchanged: with no override, discovery still finds the Flatpak
engine at exit 0; with a valid override, it is still used and reported as
origin=env. Unnamed candidates (PATH, Flatpak, macOS, Windows) still fall through --
nobody asked for those specifically, so trying the next one is the whole point.

Depends on #18

Without it this change would have turned a silent wrong-engine run into an unhandled
traceback, because KiCadNotFound did not reach the exit-4 handler. #18 landed first
and this is rebased on it.

Tests

New tests/test_discovery.py, 6 tests. The 4 positive ones were confirmed to go red
with the source change reverted; the 2 controls (a working override is still used,
unnamed candidates still fall through) stay green either way.

Worth noting: my first draft of two of these passed without the fix. With every
candidate failing to probe, the ordinary fall-through path already raises with the bad
path in its Tried: list, so asserting only that the path appears proved nothing. Both
now arrange for a working alternative engine to exist, so only failing closed can
produce the expected result.

just check and just test green: 236 passed, 6 skipped (baseline 227).

Recorded as D10.1 in docs/DECISIONS.md.

Closes #17

NETSPEC_KICAD_CLI, and the explicit argument behind it, were treated as
the first entry in a candidate list. When the named engine did not probe,
discovery fell through to the next one and the run succeeded against a
different engine than the caller asked for, with nothing said on stdout,
stderr, or in the report.

The variable is presented as authoritative -- it is what the tool's own
"no working kicad-cli found" message tells you to set. It is set to pick
a specific engine: a second KiCad, a build under test, a pinned CI
toolchain. A typo or a stale CI path therefore produced a green run
against the wrong oracle, and `can do` is computed from that engine's
version, so the substitution also changed what the tool claimed to check.

A named engine that cannot be used is now an environment fault under D10:
exit 4, naming the path and why it was rejected. Unnamed candidates
(PATH, Flatpak, macOS, Windows) still fall through, since nobody asked
for those specifically.

Recorded as D10.1.

Closes #17
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Connectivity unchanged

tests/fixtures/good_ldo.kicad_sch

design sha256:36f119b0091afd2449fcd8cc92856510f5eda0d95156ad096fc1272a39cff90e

Connectivity unchanged.

tests/fixtures/polcap_rail_correct.kicad_sch

design sha256:60a7ddcc8a14c5b7c1269e499974c219ce6e3e3b53f22c734099aeb749c4b4b1

Connectivity unchanged.

Reported by netspec — KiCad's own netlist, not a guess.

@CameronBrooks11
CameronBrooks11 merged commit 1edc6c0 into main Sep 6, 2026
6 checks passed
@CameronBrooks11
CameronBrooks11 deleted the fix/17-explicit-engine-fails-closed branch September 6, 2026 02:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NETSPEC_KICAD_CLI pointing at a missing path is silently ignored, and the run succeeds against a different engine

1 participant