Skip to content

feat!: three verdicts, and exit 2 means "could not tell" - #24

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/a1-a2-third-verdict
Sep 6, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/a1-a2-third-verdict

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Resolves A1 (#20) and A2 (#19). They are the same missing idea seen from two
sides, which is why the adjudication said to decide them together. Recorded as D26.

A2 -- there was no verdict for "could not tell"

Verdict = Literal["pass", "fail"], and the report was green only when every rule was
green, so a skipped or unsupported rule collapsed into fail. netspec said the
board is wrong
when the truth was netspec could not check it. D9 already had four
statuses and said only pass is green; the verdict above them could not express what
they distinguished.

The test suite said so out loud before the type could:

def test_a_part_absent_from_the_design_is_skipped_not_failed():
    ...
    assert ... .verdict == "fail", "skipped is still not green"

The name says not failed; the assertion says fail. They contradicted each other
because fail was the only non-green value available.

A1 -- exit 2 meant two different things

EXIT_USAGE = 2 here, while 2 is Verdict.INCOMPLETE in partspec, which puts usage
at 64 (EX_USAGE). A consumer branching on 2 across both tools read "you invoked me
wrong" as "I could not decide".

Decided

netspec follows partspec:

exit verdict meaning
0 pass every rule passed
1 fail a finding about the design
2 incomplete netspec could not evaluate part of the contract
4 error environment fault, not a verdict on the design (D10)
64 -- usage (EX_USAGE)

fail outranks incomplete -- a real violation stays a statement about the design
even when another rule could not be evaluated; the reverse would let one unsupported
rule mask a genuine finding.

An empty contract stays fail, so partspec's EMPTY = 3 is deliberately not
adopted: a contract that asserts nothing is a defect in the contract, not something
netspec was unable to determine. approximate also stays absent, per D9 -- adopting
partspec's exit codes is not adopting its interval epistemics.

Verified end to end, against a real KiCad

Contracts run through the actual CLI against tests/fixtures/good_ldo.kicad_sch:

every rule passes           -> exit 0
a real connectivity finding -> exit 1
a rule naming an absent part-> exit 2      (was 1)
guard with no command       -> exit 64     (was 2)
unreadable contract         -> exit 4

and the JSON carries it:

verdict: incomplete
reason:  could not be evaluated: 1 skipped

BREAKING

Exit 2 now means "could not evaluate" rather than a usage error, and usage moved to
64. A rule that was skipped or unsupported now yields 2 where it previously yielded
1. A gate written [ $? -eq 0 ] is unaffected; one written [ $? -ne 1 ] to mean
"fine" was already wrong and is now visibly so.

For 0.9.0. Version bump follows in its own PR.

Not closed by this

D10's other half. It asks for the environment fault to be carried as a field a
consumer can branch on
, not only as an exit code. error is now in the vocabulary and
the exit map, but nothing returns it -- an environment fault raises before a netlist is
read, so there is no report to compute a verdict from. Emitting an error document is a
schema question; I have left it open rather than quietly assuming it done, and D26 says
so.

A3 (gerberdiff has no third state) is untouched; has_changes is still boolean.
This sets the vocabulary that fix should follow.

Tests

New tests/test_verdicts.py, 14 tests. Nine go red with the source reverted; the five
that stay green are the controls -- fail outranking incomplete, all-pass still
passing, the empty contract still failing, and check still exiting 1 and 0 where it
should.

Three existing tests changed, all three asserting that a skipped rule made the verdict
fail. Each was inspected individually: all three are genuine "could not evaluate"
cases, which is the change working rather than a test being bent to fit.

README.md, mcp.py's _MEANING table and D18's exit-code prose all restated the old
contract and now match.

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

Closes #19
Closes #20

Resolves adjudications A1 and A2, which are the same missing idea seen
from two sides, and so are decided together. Recorded as D26.

A2: Verdict was Literal["pass", "fail"], and the report was green only
when every rule was green -- so a skipped or unsupported rule collapsed
into fail. netspec said the board is wrong when the truth was that
netspec could not check it. D9 already had four statuses and said only
pass is green; the verdict above them could not express what they
distinguished.

The tests said so before the type could:
test_a_part_absent_from_the_design_is_skipped_not_failed asserted
verdict == "fail". The name and the assertion contradicted each other,
because fail was the only non-green value on offer.

A1: EXIT_USAGE was 2 here, and 2 is Verdict.INCOMPLETE in partspec,
which puts usage at 64 (EX_USAGE). A consumer branching on 2 across both
tools read "you invoked me wrong" as "I could not decide".

netspec follows partspec: 0 pass, 1 fail, 2 incomplete, 4 environment,
64 usage. fail outranks incomplete, so one unsupported rule cannot mask
a real finding. An empty contract stays fail -- a contract asserting
nothing is a defect in the contract, not something netspec could not
determine -- so partspec's EMPTY=3 is deliberately not adopted.

BREAKING CHANGE: exit 2 now means "could not evaluate" rather than a
usage error, and usage moved to 64. A rule that was skipped or
unsupported now yields exit 2 where it previously yielded 1.

Closes #19
Closes #20
@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 f713485 into main Sep 6, 2026
6 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/a1-a2-third-verdict branch September 6, 2026 04:41
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.

A1: exit code 2 means EXIT_USAGE here and INCOMPLETE in partspec A2: no verdict for "could not tell" — an unsupported rule collapses into fail

1 participant