Repository navigation
feat!: three verdicts, and exit 2 means "could not tell" - #24
Merged
Merged
Conversation
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
Connectivity unchanged
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 wasgreen, so a
skippedorunsupportedrule collapsed intofail. netspec said theboard is wrong when the truth was netspec could not check it. D9 already had four
statuses and said only
passis green; the verdict above them could not express whatthey distinguished.
The test suite said so out loud before the type could:
The name says not failed; the assertion says
fail. They contradicted each otherbecause
failwas the only non-green value available.A1 -- exit 2 meant two different things
EXIT_USAGE = 2here, while2isVerdict.INCOMPLETEin partspec, which puts usageat
64(EX_USAGE). A consumer branching on2across both tools read "you invoked mewrong" as "I could not decide".
Decided
netspec follows partspec:
0pass1fail2incomplete4error64EX_USAGE)failoutranksincomplete-- a real violation stays a statement about the designeven 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'sEMPTY = 3is deliberately notadopted: a contract that asserts nothing is a defect in the contract, not something
netspec was unable to determine.
approximatealso stays absent, per D9 -- adoptingpartspec'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:and the JSON carries it:
BREAKING
Exit
2now means "could not evaluate" rather than a usage error, and usage moved to64. A rule that was skipped or unsupported now yields2where it previously yielded1. 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.
erroris now in the vocabulary andthe 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_changesis stillboolean.This sets the vocabulary that fix should follow.
Tests
New
tests/test_verdicts.py, 14 tests. Nine go red with the source reverted; the fivethat stay green are the controls --
failoutrankingincomplete, all-pass stillpassing, the empty contract still failing, and
checkstill exiting 1 and 0 where itshould.
Three existing tests changed, all three asserting that a
skippedrule made the verdictfail. 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_MEANINGtable and D18's exit-code prose all restated the oldcontract and now match.
just checkandjust testgreen: 250 passed, 6 skipped (baseline 236).Closes #19
Closes #20