Enforce module boundaries: Modulith verification + ArchUnit for plugin isolation - #77
Merged
arefbehboudi merged 2 commits intoAug 4, 2026
Conversation
Add test-scope guardrails so plugins/telegram, plugins/discord, plugins/brave, plugins/playwright, providers/openai and providers/anthropic (and siblings) can't accidentally depend on each other, and core stays free of plugin/provider dependencies: - ApplicationModules.of(JavaClawApplication.class).verify() catches cycles between top-level modules. - An ArchUnit test enforces channel-plugin, tool-plugin and LLM-provider sibling independence, provider/plugin separation, and core independence from plugins and providers.
arefbehboudi
self-requested a review
August 3, 2026 07:34
arefbehboudi
requested changes
Aug 3, 2026
Anchor package patterns to the root package so they can't accidentally match unrelated packages sharing a segment name, and match plugin/provider groups by package structure instead of enumerating each implementation, so new plugins are covered automatically without editing this test. Naively matching whole plugin packages (e.g. "ai.javaclaw.channels..") briefly flagged TaskHandler for depending on the shared Channel/ ChannelRegistry abstractions that live in that same root package. Scoped the pattern to plugin subpackages only (ai.javaclaw.channels.*..) so shared interfaces stay reachable from core while plugin implementations remain isolated.
Contributor
Author
|
Thanks a lot for the review, @arefbehboudi! I've pushed a fix addressing both comments:
Also worth flagging: widening the match initially surfaced a real (minor) boundary issue where Full test suite passes. Whenever you have a moment, feel free to take another look — no rush! |
Collaborator
|
@MarcosLM11 Thank you, Nice Job!! |
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
spring-modulith-starter-testandarchunit-junit5astestImplementationinapp/build.gradle(ArchUnit pinned to 1.4.2, the first release supporting Java 25 class files, matching this project's toolchain).ModularityTestsrunningApplicationModules.of(JavaClawApplication.class).verify()to catch cycles between top-level modules.ModuleBoundaryArchTestwith ArchUnit rules covering:telegram↮discord, generalized to anychannels.*slice)brave↮playwright, generalized to anytools.*slice)openai↮anthropic, generalized to all providers)agent,tasks,configuration,files) doesn't depend on any plugin or providerTest-scope only, no production code touched.
Resolves #76