Skip to content

refactor: restructure modules into decision/ and enforcement/ planes#12

Merged
kschlt merged 5 commits intomainfrom
refactor/module-restructure-by-plane
Mar 24, 2026
Merged

refactor: restructure modules into decision/ and enforcement/ planes#12
kschlt merged 5 commits intomainfrom
refactor/module-restructure-by-plane

Conversation

@kschlt
Copy link
Copy Markdown
Owner

@kschlt kschlt commented Mar 24, 2026

Why

The codebase had grown with modules organized by technical role (gate/, enforce/, guardrail/, guard/) rather than by architectural plane. The three-plane architecture (Decision / Context / Enforcement) was already the conceptual model, but the directory layout didn't reflect it — making it harder to reason about where logic belongs and where to add new features.

Approach

Modules were moved into two new top-level planes inside adr_kit/:

  • decision/ — workflows, guidance, and gate logic
  • enforcement/ — adapters, validation, generation, config, detection, and reporter

The migration was done in stages: first creating the new structure with backward-compat shims at the old paths so all 309 tests continued to pass, then updating all import sites (mcp/server.py, cli.py, tests) to use the new paths directly, and finally deleting the old directories and shims. This avoids a big-bang cutover that's hard to review.

adr_kit/workflows/ was preserved as-is for PlanningWorkflow, which belongs to the Context plane and is addressed separately.

What Was Tested

  • All 286 unit and integration tests pass after each stage of the migration
  • Ruff, mypy, and black all pass clean with no suppressions
  • Imports in mcp/server.py and cli.py verified to go directly to new plane paths, not through shims

Risks

This is a pure structural refactor — no logic was changed, only file locations and import paths. The main risk is an import that was missed, but the test suite and mypy provide strong coverage of the import graph. No public API surface changed.

kschlt added 5 commits March 24, 2026 10:02
…ward-compat shims

Files moved into new three-plane structure:
- adr_kit/decision/workflows/ (from workflows/)
- adr_kit/decision/guidance/ (from workflows/decision_guidance.py)
- adr_kit/decision/gate/ (from gate/)
- adr_kit/enforcement/adapters/ (from enforce/eslint.py, ruff.py)
- adr_kit/enforcement/validation/ (from enforce/validator.py, stages.py)
- adr_kit/enforcement/generation/ (from enforce/script_generator.py, ci.py, hooks.py)
- adr_kit/enforcement/config/ (from guardrail/)
- adr_kit/enforcement/detection/ (from guard/)
- adr_kit/enforcement/reporter.py (from enforce/reporter.py)

Backward-compat shims created at old locations so all 309 tests pass.
Update mcp/server.py and cli.py to import directly from new plane locations
instead of going through backward-compat shims.
Deleted adr_kit/gate/, adr_kit/enforce/, adr_kit/guardrail/, adr_kit/guard/.
Updated workflows/__init__.py to final form (only PlanningWorkflow stays here).
RST (module restructure by plane) is fully executed — all 309 tests pass,
lint is clean, and the three-plane architecture is in place. The plan file
is no longer needed and its presence would be misleading.
@kschlt kschlt merged commit 4c2dcd1 into main Mar 24, 2026
8 checks passed
@kschlt kschlt deleted the refactor/module-restructure-by-plane branch March 24, 2026 09:34
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