Skip to content

Migrate indexer logging from Maven Log to SLF4J#143

Merged
bernardladenthin merged 3 commits into
mainfrom
claude/llm-wiki-architecture-plan-0nvriu
Jul 15, 2026
Merged

Migrate indexer logging from Maven Log to SLF4J#143
bernardladenthin merged 3 commits into
mainfrom
claude/llm-wiki-architecture-plan-0nvriu

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Summary

  • Replace Maven plugin Log dependency with SLF4J Logger in four indexer classes (AiFieldGenerationSupport, SourceFileIndexer, PackageIndexer, ProjectIndexer) to decouple them from the Maven plugin API
  • Convert all log statements to use SLF4J parameterized logging (replacing string concatenation)
  • Remove Log constructor parameters from indexer classes; loggers are now static final fields
  • Update test infrastructure to capture SLF4J output via logback ListAppender instead of a custom Maven Log wrapper
  • Add explicit slf4j-api compile dependency and logback-classic test dependency to pom.xml
  • Update architecture tests to enforce SLF4J logger field constraints and document the Maven-free design of non-mojo layers

Rationale

The indexer layer (orchestration, field generation, document handling, prompts, providers, config) is now framework-free and can be extracted into a standalone library without a Maven runtime. Only the mojo layer remains the Maven Plugin API boundary. This change:

  1. Decouples indexer logic from Maven's Log interface, making the code testable and reusable outside a Maven context
  2. Improves logging performance via SLF4J's parameterized messages (no string concatenation overhead when log level is disabled)
  3. Simplifies test setup by using standard logback test infrastructure instead of custom Log wrappers
  4. Clarifies architectural intent through explicit constraints (non-mojo packages must not depend on Maven APIs)

Test plan

  • Affected unit tests pass locally: AiFieldGenerationSupportTest, ProjectIndexerTest, PackageIndexerTest, SourceFileIndexerTest all updated to use logback ListAppender and pass
  • Architecture tests updated and pass: PluginArchitectureTest now enforces SLF4J logger field constraints and documents the Maven-free design
  • CI is green on this branch

Related issues / PRs

None

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • My commits follow Conventional Commits
  • No security-sensitive changes

https://claude.ai/code/session_016DByQrKSWzzpBt4iSRcmRP

SourceFileIndexer, PackageIndexer, ProjectIndexer, and
AiFieldGenerationSupport now log via org.slf4j.Logger instead of a
constructor-injected Maven Log, closing the long-standing "no SLF4J
usage" gap and decoupling these classes from the Maven Plugin API as
the first step toward extracting them into a standalone library. Only
the 5 mojos still touch org.apache.maven, enforced by a broadened
ArchUnit rule (nonMojoIsMavenFree) plus a new loggersArePrivateStaticFinal
rule.

All log calls use parameterized {} placeholders instead of string
concatenation, fixing a genuine SpotBugs LO_APPENDED_STRING_IN_FORMAT_STRING
finding; a narrowly-scoped CRLF_INJECTION_LOGS suppression was added for
the four converted classes (local filesystem paths only, no untrusted
input, matching the project's existing suppression style).

AiFieldGenerationSupportTest's log-capturing tests now attach a logback
ListAppender to the class logger instead of a hand-rolled Maven
SystemStreamLog subclass; logback-classic is added as a direct
test-scope dependency (already resolved transitively via llama) and
slf4j-api becomes a direct compile dependency.

Verified: full test suite green (414 tests, 3 expected native-model
skips), spotless/spotbugs clean, and an end-to-end run of the generate
goal against a scratch project confirms the SLF4J log lines surface
identically as [INFO] lines in Maven's console output via
maven-slf4j-provider.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016DByQrKSWzzpBt4iSRcmRP
PackageIndexer and ProjectIndexer each hardcoded their own private
"1970-01-01T00:00:00Z" literal as the seed value for folding over
child dates to find the latest one. Both are exactly
Instant.EPOCH formatted through the same ISO_INSTANT formatter
AiTimeSupport.formatInstant already uses for every other timestamp
in a .ai.md header, so the duplicate literals are now a single
derived AiTimeSupport.EPOCH_DATE constant.

Added AiTimeSupportTest (previously untested despite being in the
PIT 100%-threshold targetClasses list) to cover formatInstant and
pin the new constant; verified 1/1 mutations killed on AiTimeSupport.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016DByQrKSWzzpBt4iSRcmRP
@sonarqubecloud

Copy link
Copy Markdown

@coveralls

coveralls commented Jul 15, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29413473672

Warning

No base build found for commit 65cfa8c on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 73.156%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 2598
Covered Lines: 1968
Line Coverage: 75.75%
Relevant Branches: 1049
Covered Branches: 700
Branch Coverage: 66.73%
Branches in Coverage %: Yes
Coverage Strength: 3.2 hits per line

💛 - Coveralls

Introduces the root net.ladenthin:srcmorph-parent (packaging=pom) as
the first step of the srcmorph multi-module migration. The existing
plugin moves into llamacpp-ai-index-maven-plugin/ with its coordinates,
Java package, and goalPrefix completely unchanged — this step is a pure
structural move, not a rename. The coordinate/package/goalPrefix
rename to srcmorph is deferred to the final migration step, once the
core library and CLI modules exist and the whole reactor is proven
working end-to-end.

Hoisted to the parent (reactor-wide, so future core/CLI modules can
share it without duplication): project metadata (licenses, developers,
scm, issueManagement, url, distributionManagement), the slf4j-api/
logback-classic dependencyManagement convergence pins, and the
`release` profile (GPG signing + central-publishing-maven-plugin) so a
single `mvn -P release deploy` from the root signs and publishes every
reactor module. Everything else (dependencies, the full build-plugin
chain, all other profiles) stays in the plugin module unchanged.
Version bumped 1.0.3-SNAPSHOT -> 1.1.0-SNAPSHOT (parent + child, by
inheritance) since adding modules is a feature-level change.

Moved with git mv (history preserved): pom.xml, src/, and
spotbugs-exclude.xml into llamacpp-ai-index-maven-plugin/ (spotbugs
resolves its exclude file relative to the module basedir; lombok.config
stays at the repo root, since Lombok's config search bubbles up from
each source file until it finds one, and stopBubbling only stops the
search at the file where it's declared — one shared root config already
works correctly for every future module). Updated the path-relative
references that break under the move: .gitignore module-scoped
patterns, REUSE.toml file annotations, and every target/... path in
.github/workflows/publish.yml (build artifacts, jacoco/PIT/vmlens
reports, crash dumps, signed-artifact collection).

Verified: `mvn verify` from the reactor root — BUILD SUCCESS, both
modules green, 417 tests (3 expected native-model skips), spotless and
spotbugs clean via their verify-phase bindings. Byte-diffed the
generated plugin.xml descriptor against a pre-move build of the same
commit: identical except the version number, confirming the mojo/
parameter/goalPrefix descriptor is completely unaffected by the
restructuring. `mvn -P release help:effective-pom` confirms the
parent's release profile (gpg + central-publishing) correctly resolves
into the child module's effective build.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016DByQrKSWzzpBt4iSRcmRP
@bernardladenthin
bernardladenthin merged commit f70373a into main Jul 15, 2026
19 of 25 checks passed
@bernardladenthin
bernardladenthin deleted the claude/llm-wiki-architecture-plan-0nvriu branch July 15, 2026 20:25
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.

3 participants