refactor(lint): per-gate return values replace the module-global failures list (#60) - #77
Merged
Merged
Conversation
…ures list (#60) Every gate is now a pure function returning its findings as (gate, message) tuples; run_all aggregates them in the CLI's reporting order. No behavior change. - The temporal coupling is gone: gate_confidentiality (mandatory-gates check) and gate_rubric (grounding requirement) receive failed_gate_ids as an explicit parameter — the ordering dependency lives in the signature, not in a '# last:' comment. - Usable as a library: two manifests linted in one process no longer interleave findings; no failures.clear() protocol. - fail() and the failures global are removed; unit-testing one gate needs no cleanup (test_gates.run_gates collapses to a run_all call). Verified byte-identical CLI output before/after on all 11 reference manifests plus a multi-failure red case; 82/82 tests green. Closes #60 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem (#60)
eamos_lint.pyaccumulated findings in a module-level mutable global (failures = []). Three costs: temporal coupling (gate_confidentialityhad to run last, enforced only by a# last:comment — reordering the runner silently weakened the gate), not usable as a library (two manifests in one process interleave findings unless the caller knows thefailures.clear()protocol — which is exactly what the tests did), and hiddenfail()coupling (unit-testing one gate required global cleanup).Refactor (no behavior change)
(gate, message)tuples.run_all(manifest, archetype, deck_ir, acc, ledger)aggregates them in the CLI's reporting order.gate_confidentiality(manifest, failed_gate_ids)— andgate_rubric(manifest, deck_ir, failed_gate_ids), which had the same hidden read for its grounding requirement. The ordering now lives in the signature, not a comment.fail()and thefailuresglobal are removed;test_gates.run_gatescollapses to arun_allcall with no.clear().Verification
diff'd.failures/fail(references remain in the tool or tests.Closes #60
🤖 Generated with Claude Code