✅ Introduce architecture tests#292
Merged
Merged
Conversation
c28f0c2 to
8620879
Compare
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.
5de9530 to
c3f93fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Static AST-based tests that enforce hexagonal architecture boundaries without runtime overhead. Shared
helpers.pywithcollect_import_lines/find_private_import_violationsavoids duplication across test files. Known violations are markedxfail(strict=True)to document tech debt without blocking CI: pytest will alert withXPASSwhen a violation is fixed and the marker can be removed.Rules enforced
test_domain_public_api.pydomain.*must go through__init__(entities, ports, repositories, use_cases)test_domain_isolation.pydomain -> adaptersforbiddentest_adapters_isolation.pydi_container.py,admin/di_container.py,app.py) may import from adapters; no cross-direction between inbound and outboundtest_pn532_public_api.pyjukebox.pn532.*must go through__init__test_settings_public_api.pyjukebox.settings.*must go through__init__test_sonos_public_api.pyjukebox.sonos.*must go through__init__Known violations (xfail)
adapters isolation:admin/pn532_command_handlers.pyimports an outbound adapter directlypn532: widespread direct sub-module importssettings: widespread direct sub-module importssonos: widespread direct sub-module imports