Skip to content

Fix the SpotBugs newline rule on the calibration block; make the selftest model directory a property - #237

Merged
bernardladenthin merged 4 commits into
mainfrom
model-dir-property-and-stale-gpu-comment
Oct 23, 2026
Merged

bernardladenthin merged 4 commits into
mainfrom
model-dir-property-and-stale-gpu-comment

Conversation

@bernardladenthin

Copy link
Copy Markdown
Owner

Summary

  • spotbugs:check was red on main after Write the calibration paste block with LF line endings on every platform #236. VA_FORMAT_STRING_USES_NEWLINE fires on every String.format pattern containing \n and asks for %n — the platform separator the calibration paste block must not carry, so the rule and the requirement conflict. The newline leaves the pattern instead: a new appendXmlNumber helper appends it as a literal (the shape appendJsonNumber/appendYamlNumber already use, for the same documented reason) and the numbers are formatted at the call site through the FORMAT_* constants, which until now only the JSON/YAML renderers used although their javadoc claimed otherwise. No suppression, rendered text unchanged.
  • The srcmorph-selftest profile names its model directory once. All 38 <modelPath> entries carried the absolute X:/Modelle/…, a drive that no longer exists on the owner's machine — so the profile ran nowhere as committed, and a machine-specific path shipped in a published POM 38 times. They read ${ai.modelDir}/<file>.gguf now; another machine uses -Dai.modelDir=/path/to/models.
  • Two documentation statements that stopped matching jllama 6.0.0: the gpuLayers = -1 comment ("CPU build stays CPU; GPU build uses its own default" — there is no such split since the natives-jar restructure), and TODO.md's "GPU classifier fat jars … never launched", which now records that cuda13-windows-x86-64 has had a real launch pass.
  • Four dead constants and one concatenated literal removed from LlamaCppJniAiGenerationProviderTest (six Error Prone warnings). Their assertions moved to the model-free LlamaCppJniProviderSupportTest with the core-module extraction, so no coverage is lost.

Test plan

  • Affected unit / integration tests pass locally — full reactor clean verify BUILD SUCCESS on all three modules, 659 + 39 + 32 tests, 0 failures, spotbugs:check and spotless:check clean. Run against a resolvable llama 6.0.0-SNAPSHOT from the Central snapshot repository in an isolated local repository, which is the only way to get past the pin described below.
  • -P srcmorph-selftest interpolation verified with help:effective-pom: the default resolves every path to M:/Modelle/<file>.gguf, -Dai.modelDir=<dir> redirects all 38.
  • The gpuLayers claim is measured, not assumed — RTX 3070 Laptop, Qwen3-4B-Instruct-2507-Q4_K_M, identical config, only the classpath differing: 63 t/s prefill / 7.1 t/s decode with ggml registering [RPC, CPU], and 3474 / 86.8 with [CUDA, RPC, CPU] once the cuda13 module jar is present. gpuLayers −1 and 99 within noise in both cases.
  • The cuda13 fat jar (-P gpu-cuda, 258 MB) ran a real GenerateFileIndex over the production prompt set through the CLI and through srcmorph:generate.
  • CI will be red on this branch, and not because of it. The reactor still dies at the first Maven step on the unresolvable net.ladenthin:llama:6.0.0 (TODO.md, first open item) — which is also why no CI run could ever have shown the SpotBugs failure this PR fixes: nothing reached SpotBugs. Expect green only once jllama 6.0.0 is on Central.
  • Docs / CHANGELOG updated

Related issues / PRs

Refs #236 — the first commit here fixes a SpotBugs violation that PR introduced and CI could not see.

Checklist

  • I have read CONTRIBUTING.md and CODE_OF_CONDUCT.md
  • My commits follow Conventional Commits — they do not, deliberately: the commits on main use plain imperative subjects with a detailed body (e.g. "Write the calibration paste block with LF line endings on every platform"), and these match that. CONTRIBUTING.md documents Conventional Commits, so the written convention and the repository's practice disagree; worth settling one way or the other, and happy to rewrite these subjects if the document is the one that should win.
  • No security-sensitive changes

🤖 Generated with Claude Code

https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G

bernardladenthin and others added 4 commits October 23, 2026 17:00
The LF fix of the previous commit left spotbugs:check red:
VA_FORMAT_STRING_USES_NEWLINE fires on every String.format pattern that
contains \n and asks for %n -- the platform separator the paste block
must not carry, since the block is meant for a pom.xml and .gitattributes
sets eol=lf. The rule and the requirement are in direct conflict, so the
newline has to leave the pattern rather than change back.

appendPasteBlock now appends it as a literal through a new appendXmlNumber
helper -- the same shape appendJsonNumber and appendYamlNumber already use,
and for the same reason their javadoc gives -- and formats the two numbers
at the call site through FORMAT_TOKENS_PER_SECOND and FORMAT_CHARS_PER_TOKEN.
Those constants were declared for this block and only the JSON and YAML
renderers used them; the block repeated %.1f and %.2f inline, so their
javadoc claim ("identical to the one renderXml() pastes") held by
coincidence of the literal. It is now one source for all three renderers.
No suppression was added, the rendered text is unchanged, and
CalibrationReportTest -- including the child-JVM case with
-Dline.separator=\r\n -- pins that.

Why no CI run could have caught it: the reactor still dies earlier on the
unresolvable net.ladenthin:llama:6.0.0 (TODO.md, first open item), so no
run reaches SpotBugs. main was red on a check nothing executed. Found by
running the full reactor against a locally resolvable llama 6.0.0-SNAPSHOT.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
All 38 <modelPath> entries of the srcmorph-selftest profile carried the
absolute X:/Modelle/<file>.gguf. That drive does not exist on the owner's
machine any more (the models live on M:), so the profile could not run
anywhere as committed -- and this POM is published, so a machine-specific
absolute path shipped with it 38 times.

They read ${ai.modelDir}/<file>.gguf now. The property defaults to the
owner's model drive, so the profile behaves as before here, and any other
machine runs it with -Dai.modelDir=/path/to/models. A moved model drive is
one line instead of 38.

docs/ai-index-benchmark/tools/calibrate-bench-pom.xml already had its own
overridable bench.model property and only needed the drive letter, so it
keeps its shape.

Verified with help:effective-pom under -P srcmorph-selftest: the default
resolves every path to M:/Modelle/<file>.gguf, and -Dai.modelDir=<dir>
redirects all of them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
PARAM_DRY_PENALTY_LAST_N, PARAM_REPEAT_LAST_N, KWARG_ENABLE_THINKING and
KWARG_REASONING_EFFORT were unread in LlamaCppJniAiGenerationProviderTest,
which Error Prone reports as four UnusedVariable warnings. The assertions
they belonged to moved to LlamaCppJniProviderSupportTest with the
core-module extraction, where buildInferenceParameters is reachable without
a GGUF: the same four constants are declared there and used, so the wire
keys stay covered and no coverage is lost by deleting these copies.

The test's inlined Java source also becomes a text block, which removes the
file's fifth and sixth warnings (StringConcatToTextBlock). Spotless applied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
… CUDA launch

Two documentation statements that stopped matching jllama 6.0.0.

LlamaCppJniAiGenerationProvider explained gpuLayers = -1 as "CPU build
stays CPU; GPU build uses its own default". That was the pre-6.0.0 artifact
layout, where the classifier chose the backend. Since 6.0.0 the library jar
is CPU-only and a GPU backend joins it as an additive module jar, so the
premise is gone -- while the conclusion stayed right: -1 leaves llama.cpp's
own default, which offloads everything once a GPU device is registered and
stays on the CPU when none is. A GPU therefore needs no gpuLayers, only the
matching natives jar on the classpath.

Measured on an RTX 3070 Laptop with Qwen3-4B-Instruct-2507-Q4_K_M, identical
configuration, only the classpath differing: without the module jar 63 t/s
prefill and 7.1 t/s decode, ggml registering [RPC, CPU]; with it 3474 / 86.8,
ggml registering [CUDA, RPC, CPU]. gpuLayers -1 and 99 were within noise of
each other in both cases, which is what "llama.cpp's own default" means here.

TODO.md's "GPU classifier fat jars are verified structurally, never launched"
now records that cuda13-windows-x86-64 has had the launch pass: the -P gpu-cuda
fat jar (258 MB, carrying Windows/x86_64/cuda13/ next to the six CPU library
directories) ran a real GenerateFileIndex over the production prompt set
through the CLI and through srcmorph:generate, at the throughput above, with
the loader naming the module. rocm, sycl, openvino and vulkan stay unlaunched;
vulkan is reachable on any NVIDIA box and is the cheapest to add next.

The CHANGELOG records this branch's four changes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2h8gXyyE5UeimkL9vQv9G
@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93e92447-99fa-4a4e-a275-4a7468021996
📥 Commits

Reviewing files that changed from the base of the PR and between d334ebe and 09a71b0.

📒 Files selected for processing: 7
  • CHANGELOG.md
  • TODO.md
  • docs/ai-index-benchmark/tools/calibrate-bench-pom.xml
  • srcmorph-maven-plugin/pom.xml
  • srcmorph/src/main/java/net/ladenthin/srcmorph/engine/CalibrationReport.java
  • srcmorph/src/main/java/net/ladenthin/srcmorph/provider/LlamaCppJniAiGenerationProvider.java
  • srcmorph/src/test/java/net/ladenthin/srcmorph/provider/LlamaCppJniAiGenerationProviderTest.java
+-----------------------------------------+
| Making HAL 9000 open the pod bay doors. |
+-----------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@bernardladenthin
bernardladenthin merged commit e09f916 into main Oct 23, 2026
6 of 14 checks passed
@bernardladenthin
bernardladenthin deleted the model-dir-property-and-stale-gpu-comment branch October 23, 2026 15:02

This branch had an error being deployed

1 failed deployment
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