Repository navigation
fix(gnn): require the literal True type-check verdict - #14
Merged
Merged
Conversation
`GNNTypeChecker.validate_gnn_files` is tri-state: `True` when every file validated, `2` when one or more files were invalid or none was found, and `False` on a hard failure. `_check_types` tested it for truthiness, so `2` passed and the arm printed `"result": "verified"` for an invalid model set. Reproduced with the pinned parser (v5.0.3, revision 8f293d9) on a sketch declaring `A[3,3]` against a 2x2 likelihood matrix: the checker returned `2` and `python .github/scripts/gate.py gnn` exited 0 with a `verified` receipt. The arm now passes only on `is True` and the refusal names the returned value. `.github/scripts/tests/test_gnn_conformance.py` pins `True`, `2`, `False`, `None` and `0` without needing the parser installed, and proves the arm emits no receipt for a refused verdict. `.github/GNN.md` and `docs/RUN_GUIDE.md` record the tri-state contract.
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.
Defect
_check_typesin.github/scripts/gnn_conformance.pytested the type checker's result for truthiness:validate_gnn_filesis tri-state, per its own docstring at the pinned revision8f293d9(v5.0.3):Truewhen every file validated,2(SUCCESS_WITH_WARNINGS) when one or more files had type/consistency problems or when no GNN file was found,Falseon a hard failure.2is truthy, so an invalid model set passed and the arm printed"result": "verified".Reproduction
Pinned parser installed exactly as the arm installs it (
generalized-notation-notation @ git+…@8f293d9). One sketch — the pinned exemplar withA[2,2,type=float]changed toA[3,3,type=float], i.e. a declared shape that contradicts its 2×2 initialisation — parses cleanly and passesvalidate_gnn_syntax, and the checker returns2:With this branch the same tree fails:
The empty-model-set path is documented as the same
2:Fix
Only the literal
Truepasses; the refusal reports the value the checker returned. No check was weakened and no test removed.Tests
.github/scripts/tests/test_gnn_conformance.py(6 tests, dependency-free: it stubsgnninsys.modules, so thetestsarm and CI's docs job still need no parser). All five refusal tests are red onmainand green here; theTruecase asserts the copied model set and that the receipt still prints.Gate
python3.12 .github/scripts/gate.py linkspython3.12 .github/scripts/gate.py archivepython3.12 .github/scripts/gate.py testspython3.12 .github/scripts/gate.py fastpython3.12-in-a-venv .github/scripts/gate.py gnn(pinned parser 5.0.3)pinned-exemplarHosted Actions are billing-locked for this organisation, so the local gate is the evidence.