Skip to content

feat(e4): add architecture guardrails and regression gates#229

Open
agustif wants to merge 4 commits intopeteromallet:mainfrom
agustif:feat/e4-guardrails-regression-gates
Open

feat(e4): add architecture guardrails and regression gates#229
agustif wants to merge 4 commits intopeteromallet:mainfrom
agustif:feat/e4-guardrails-regression-gates

Conversation

@agustif
Copy link

@agustif agustif commented Mar 4, 2026

Summary

Implements Epic #210 and sub-issues #222 #223 #224 #225.

This PR adds architecture guardrails and regression gates to prevent boundary drift, import-cycle growth, packet mode drift, and persistence safety regressions.

Scope

E4.1 Import boundary checker

  • Added new import-linter contract in .github/importlinter.ini:
    • [importlinter:contract:base_no_upward_imports]
    • Enforces: desloppify.base must not directly import app|engine|intelligence|languages
    • Uses explicit legacy ignore_imports entries to lock current debt while preventing new violations.

E4.2 Cycle detection gate

  • Added cycle checker script:
    • .github/scripts/check_import_cycles.py
  • Added scoped SCC allowlist:
    • .github/architecture/cycle_allowlist.txt
  • Wired into make arch in Makefile so CI fails on new scoped SCCs in:
    • desloppify.app.commands.review
    • desloppify.engine._plan
    • desloppify.engine._state
    • desloppify.engine._scoring

E4.3 Packet parity golden tests

  • Added golden fixture:
    • desloppify/tests/review/policy/golden/review_packet_shared_fields.json
  • Added golden regression test:
    • desloppify/tests/review/policy/test_packet_mode_parity_golden.py
  • Keeps parity lock across prepare/run-batches/external for shared packet semantics.

E4.4 Persistence safety property tests

  • Added randomized regression/property-style tests:
    • desloppify/tests/plan/test_persistence_safety_properties.py
    • desloppify/tests/state/test_persistence_safety_properties.py
  • Verifies malformed/newer payload handling and unsafe-save blocking behavior stays fail-loud.

CI contracts and docs

  • Extended CI contract tests:
    • desloppify/tests/ci/test_ci_contracts.py
  • Added architecture guardrail docs:
    • docs/architecture_guardrails.md

Validation

  1. Architecture gate
  • source .venv/bin/activate && make arch
  • Result: pass (import contracts + cycle checker)
  1. CI contracts
  • source .venv/bin/activate && make ci-contracts
  • Result: 11 passed
  1. Regression suites
  • source .venv/bin/activate && pytest -q desloppify/tests/ci/test_ci_contracts.py desloppify/tests/review/policy/test_packet_mode_parity.py desloppify/tests/review/policy/test_packet_mode_parity_golden.py desloppify/tests/plan/test_persistence_safety.py desloppify/tests/plan/test_persistence_safety_properties.py desloppify/tests/state/test_state.py desloppify/tests/state/test_persistence_safety_properties.py
  • Result: 73 passed, 1 skipped

Stack Context

This branch is stacked on implementation work from #227 (E2) and #228 (E3). Guardrail tests/gates are designed to enforce those behaviors going forward.

Tracking

Parent program: #206

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.

1 participant