fix: name the model in the flashAttn refusal so the message is not a constant - #195
Conversation
…constant SpotBugs' WEM_WEAK_EXCEPTION_MESSAGING fires on a throw whose entire message is a compile-time constant, which is what the provider-side flashAttn guard did. That reds main. The fix is not a suppression, because the finding is pointing at something real: this guard runs on the direct-API path, where there is no aiDefinition key to name -- the plan-time guard in EngineSupport prefixes that one -- so a caller running several models was told what is wrong but not which configuration to change. The message now leads with the model path, matching the shape EngineSupport already uses. The knob-sweep assertion moves from equality to containsString and also pins that the model path appears, so the prefix cannot be dropped again silently. Why it was not caught before the merge: spotbugs:check is bound to verify, and the runs used here were mvn test and mvn -P release package, both of which stop earlier. Verified this time with the two commands the code-style job runs verbatim (spotless:check and spotbugs:check over all three modules, 0 bugs) plus the 81 tests that touch the message.
Review SummaryThis is a well-executed fix that addresses both the SpotBugs finding and improves user experience. ✅ Strengths:
Minor observation: The PR description's explanation of why this wasn't caught earlier ( Looks good to merge. 👍 |
|



Summary
Fixes
main, which went red on run 33479921629 right after #194 merged.Both failing jobs have the same single cause. The job named Code style (spotless) did not fail on Spotless, and the Test job did not fail on a test — its own run was
Tests run: 639, Failures: 0, Errors: 0, Skipped: 0. Both hit the same SpotBugs finding, because the test job runsverifyandspotbugs:checkis bound there:Not suppressed, because the finding points at something real. This guard runs on the direct-API path, where there is no
aiDefinitionkey to name — the plan-time guard inEngineSupportalready prefixes that one, which is exactly why it was not flagged. So a caller running several models was told what is wrong but not which configuration to change. The message now leads with the model path, matching the shapeEngineSupportalready uses.The knob-sweep assertion moves from equality to
containsString, and additionally pins that the model path is present — so the prefix cannot be dropped again without a test noticing.Test plan
mvn -pl srcmorph,srcmorph-cli,srcmorph-maven-plugin spotless:check— BUILD SUCCESS (the exact command the job runs)mvn -DskipTests -Denforcer.skip=true -pl srcmorph,srcmorph-cli,srcmorph-maven-plugin compile spotbugs:check— BUILD SUCCESS,BugInstance size is 0in all three modules (the exact command that failed)LlamaCppJniKnobSweepTest,EngineSupportTest,LlamaCppJniAiGenerationProviderTest— 81 tests, 0 failuresWhy it escaped the pre-merge checks, stated plainly:
spotbugs:checkis bound toverify, and what I ran locally wasmvn testandmvn -P release package -DskipTests, both of which stop before it. The gate existed; I did not run it. This time the two failing commands were run verbatim before pushing.Related issues / PRs
Follows #194.
Checklist
CONTRIBUTING.mdandCODE_OF_CONDUCT.mdGenerated by Claude Code