Skip to content

✅ Introduce architecture tests#292

Merged
Gudsfile merged 3 commits into
mainfrom
architecture-tests
Jun 21, 2026
Merged

✅ Introduce architecture tests#292
Gudsfile merged 3 commits into
mainfrom
architecture-tests

Conversation

@Gudsfile

@Gudsfile Gudsfile commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Static AST-based tests that enforce hexagonal architecture boundaries without runtime overhead. Shared helpers.py with collect_import_lines / find_private_import_violations avoids duplication across test files. Known violations are marked xfail(strict=True) to document tech debt without blocking CI: pytest will alert with XPASS when a violation is fixed and the marker can be removed.

Rules enforced

Test Rule
test_domain_public_api.py All imports of domain.* must go through __init__ (entities, ports, repositories, use_cases)
test_domain_isolation.py domain -> adapters forbidden
test_adapters_isolation.py Only composition roots (di_container.py, admin/di_container.py, app.py) may import from adapters; no cross-direction between inbound and outbound
test_pn532_public_api.py All imports of jukebox.pn532.* must go through __init__
test_settings_public_api.py All imports of jukebox.settings.* must go through __init__
test_sonos_public_api.py All imports of jukebox.sonos.* must go through __init__

Known violations (xfail)

  • adapters isolation: admin/pn532_command_handlers.py imports an outbound adapter directly
  • pn532: widespread direct sub-module imports
  • settings: widespread direct sub-module imports
  • sonos: widespread direct sub-module imports

@Gudsfile Gudsfile changed the title Introduce architecture tests ✅ Introduce architecture tests Jun 20, 2026
@Gudsfile Gudsfile self-assigned this Jun 20, 2026
@Gudsfile Gudsfile force-pushed the architecture-tests branch from c28f0c2 to 8620879 Compare June 20, 2026 23:42
Enforce hexagonal boundaries via static AST analysis:
- domain public API only (entities, ports, repositories, use_cases)
- domain must not import from adapters
- only composition roots may import from adapters
- no cross-direction imports between inbound/outbound adapters
- settings, pn532 and sonos public API only

Known violations marked xfail(strict=True) to track future fixes.
@Gudsfile Gudsfile force-pushed the architecture-tests branch from 5de9530 to c3f93fc Compare June 21, 2026 00:05
@Gudsfile Gudsfile merged commit a29f74c into main Jun 21, 2026
5 checks passed
@Gudsfile Gudsfile deleted the architecture-tests branch June 21, 2026 00:27
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