test(archunit): add Rule 2 coverage for importing and audit domains
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / OCR Service Tests (push) Successful in 36s
CI / Unit & Component Tests (pull_request) Failing after 3m33s
CI / OCR Service Tests (pull_request) Successful in 36s
CI / Backend Unit Tests (pull_request) Failing after 3m24s

MassImportService delegates to other domain services (no direct repo
access), and AuditService only touches its own AuditLogRepository —
both pass the boundary rule cleanly. Closes the known hole flagged
by Sara and Markus in PR #428.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit was merged in pull request #428.
This commit is contained in:
Marcel
2026-05-05 17:59:08 +02:00
parent 0dd58556a7
commit 0981355247

View File

@@ -86,6 +86,20 @@ class ArchitectureTest {
.and().resideInAPackage("..ocr..")
.should().dependOnClassesThat(foreignJpaRepositoryFor("ocr"));
@ArchTest
static final ArchRule services_only_access_own_domain_repositories_importing =
noClasses()
.that().areAnnotatedWith(Service.class)
.and().resideInAPackage("..importing..")
.should().dependOnClassesThat(foreignJpaRepositoryFor("importing"));
@ArchTest
static final ArchRule services_only_access_own_domain_repositories_audit =
noClasses()
.that().areAnnotatedWith(Service.class)
.and().resideInAPackage("..audit..")
.should().dependOnClassesThat(foreignJpaRepositoryFor("audit"));
// Rule 3: Infrastructure @Configuration classes must not end up scattered in domain packages.
// Keeps cross-cutting setup (security, async, DB, storage) in dedicated packages
// where it can be audited and reasoned about independently.