Skip to content

refactor(lint): per-gate return values replace the module-global failures list (#60) - #77

Merged
danielPoloWork merged 1 commit into
mainfrom
refactor/lint-per-gate-findings
Jul 2, 2026
Merged

danielPoloWork merged 1 commit into
mainfrom
refactor/lint-per-gate-findings

Conversation

@danielPoloWork

Copy link
Copy Markdown
Owner

Problem (#60)

eamos_lint.py accumulated findings in a module-level mutable global (failures = []). Three costs: temporal coupling (gate_confidentiality had 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 the failures.clear() protocol — which is exactly what the tests did), and hidden fail() coupling (unit-testing one gate required global cleanup).

Refactor (no behavior change)

  • Every gate is a pure function returning its findings as (gate, message) tuples.
  • run_all(manifest, archetype, deck_ir, acc, ledger) aggregates them in the CLI's reporting order.
  • The one legitimate dependency became an explicit parameter: gate_confidentiality(manifest, failed_gate_ids) — and gate_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 the failures global are removed; test_gates.run_gates collapses to a run_all call with no .clear().

Verification

  • CLI output byte-identical before/after on all 11 reference manifests plus a multi-failure red case (typo'd top-level key + identity key + cell field + content key), captured and diff'd.
  • 82/82 tests green; no failures/fail( references remain in the tool or tests.

Closes #60

🤖 Generated with Claude Code

…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>
@danielPoloWork danielPoloWork added the enhancement New feature or request label Jul 2, 2026
@danielPoloWork danielPoloWork self-assigned this Jul 2, 2026
@danielPoloWork
danielPoloWork marked this pull request as ready for review July 2, 2026 17:23
@danielPoloWork
danielPoloWork merged commit 15d091a into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(lint): replace the module-global failures list with per-gate return values

1 participant