#74 (3/4): import-linter module boundaries #196

Open
bobby wants to merge 1 commits from 74-3-module-boundaries into 74-2-serve
pull from: 74-3-module-boundaries
Owner

Part of #74. Stack: 1. probe app → 2. hapi serve → 3. module boundaries → 4. pre-commit. Based on the 2/4 branch.

Summary

hapi.app : hapi.cli                              composition root
finance : fitness : maintenance : smart_home     domains; each one's service.py is its only public module
platform                                         shared, imports no domain
bots/                                            forbidden from importing hapi.* (ADR-0011)

There are six contracts: one layers, four protected (one per domain), and one forbidden. The domain packages are empty stubs, there only so the contracts have something to check. just lint now runs lint-imports.

Evidence

  • Before: nothing enforced module boundaries.
    After: each contract broken on purpose, then reverted:
platform  -> finance.service   BROKEN (layers)
finance   -> app               BROKEN (layers)
fitness   -> finance.models    BROKEN (protected)
any hapi  -> finance.models    BROKEN (protected)
fitness   -> finance.service   kept
finance   -> finance.models    kept
bots      -> hapi.*            BROKEN (forbidden)
clean tree                     6 kept, 0 broken

Merge Danger

Door: two-way

Blast Radius: none

Adding a fifth domain means adding it to the layers contract and adding one more protected block. The config format can't loop over domains.

🤖 Generated with Claude Code

Part of #74. Stack: 1. probe app → 2. `hapi serve` → **3. module boundaries** → 4. pre-commit. Based on the 2/4 branch. ## Summary ```text hapi.app : hapi.cli composition root finance : fitness : maintenance : smart_home domains; each one's service.py is its only public module platform shared, imports no domain bots/ forbidden from importing hapi.* (ADR-0011) ``` There are six contracts: one `layers`, four `protected` (one per domain), and one `forbidden`. The domain packages are empty stubs, there only so the contracts have something to check. `just lint` now runs `lint-imports`. ## Evidence - **Before:** nothing enforced module boundaries. **After:** each contract broken on purpose, then reverted: ```text platform -> finance.service BROKEN (layers) finance -> app BROKEN (layers) fitness -> finance.models BROKEN (protected) any hapi -> finance.models BROKEN (protected) fitness -> finance.service kept finance -> finance.models kept bots -> hapi.* BROKEN (forbidden) clean tree 6 kept, 0 broken ``` ## Merge Danger **Door:** two-way **Blast Radius:** none Adding a fifth domain means adding it to the layers contract and adding one more `protected` block. The config format can't loop over domains. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bobby added 1 commit 2026-11-27 17:01:43 -05:00
Domain packages (finance, fitness, maintenance, smart_home) and `bots/`,
with contracts: composition root above domains above platform; each
domain reachable from others only through its `service` module; `bots/`
forbidden from importing `hapi`. `just lint` runs import-linter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 74-3-module-boundaries:74-3-module-boundaries
git checkout 74-3-module-boundaries
Sign in to join this conversation.