Repository navigation
Description
NETSPEC_KICAD_CLI pointing at a path that does not exist is ignored silently.
Discovery falls through to the next candidate and the run succeeds against a
different engine than the one that was explicitly requested, with nothing said on
stdout, stderr or in the report.
Reproduction
netspec 0.7.0, Linux, KiCad available as a Flatpak.
$ NETSPEC_KICAD_CLI=/nonexistent/kicad-cli netspec doctor
engine : kicad-cli 10.0.6 (flatpak)
invoked : flatpak run --command=kicad-cli org.kicad.KiCad
note : sandboxed engine; work files are written beside the design
can do : kicad-cli (KiCad 10.0.6): netlist, erc, drc, schematic_parity
$ echo $?
0
No mention of /nonexistent/kicad-cli anywhere in the output. Same on a real
command:
$ NETSPEC_KICAD_CLI=/nonexistent/kicad-cli netspec netlist tests/fixtures/good_ldo.kicad_sch
tests/fixtures/good_ldo.kicad_sch
3 components, 3 nets
+3V3 C2.1, U1.2
...
$ echo $?
0
Why the fallback is the wrong default here
The variable is presented as authoritative, not as a hint — it is what the
tool's own error message tells you to set:
error: no working kicad-cli found. Set NETSPEC_KICAD_CLI=/path/to/kicad-cli, or install KiCad.
Someone sets it precisely because they need a specific engine: a second KiCad
version, a build under test, a pinned CI toolchain. A typo, a stale path in a CI
job, or a bind-mount that did not appear then produces a green run against a
different oracle, and the report cannot be distinguished from one that used the
requested engine.
For a tool whose premise is that KiCad is the oracle, quietly adjudicating
against a different oracle than the caller asked for is a correctness question,
not a convenience one — and the version matters, since can do is computed from
it.
This is the shape orlab#61 records
in the drive layer — a fallback that reaches the caller only as a suppressible log
line — except here there is no log line at all.
Expected, one of
- Fail closed. An explicitly requested engine that cannot be used is an
environment fault: exit4, naming the path that was set and why it was
rejected. This is what I would expect, since the variable exists to override
discovery rather than to seed it. - Fall back loudly, and put the substitution in the report as a field a
consumer can branch on rather than as prose — so a caller can tell that the
engine used was not the engine requested.
Either is fine; silence is the part worth changing. doctor already prints
engine and invoked, so it is close — it just does not say the requested one
was discarded.
Found while provisioning netspec on a workstation where KiCad is a Flatpak, so
the fallback always had somewhere to land.
Activity
fix(oracle): fail closed when a named engine cannot be used (#22)
chore(release): 0.8.0 (#23)