Context
OnnxEvaluator (src/main/java/com/fortemate/dicechess/bot/OnnxEvaluator.java) loads an ONNX value model and falls back to the engine heuristic JvmApi.evaluate when the model path is null, blank, missing, or not a loadable model. OnnxStrategyTest exercises the strategy through a missing model only; the fallback contract of the evaluator itself is not pinned.
The Definition-of-Done block at the top of AGENTS.md applies: run mise run format (Spotless), then mise run check, before publishing. Tests use JUnit 5 (org.junit.jupiter.api), see OnnxStrategyTest.java for style; temporary files via @TempDir.
Objective
Add src/test/java/com/fortemate/dicechess/bot/OnnxEvaluatorFallbackTest.java with:
new OnnxEvaluator(null), new OnnxEvaluator(""), new OnnxEvaluator(" ") and new OnnxEvaluator("no/such/model.onnx") → isLoaded() is false, no exception, and close() is safe to call.
- A temporary file with arbitrary non-ONNX bytes → the constructor does not throw,
isLoaded() is false.
- For a non-loaded evaluator and the initial position parsed via the engine (
JvmApi/FenParser as used elsewhere in this repository) with dice pool p, evaluate(state, 0) equals JvmApi.evaluate(state, 0) and evaluate(state, 1) equals JvmApi.evaluate(state, 1).
Definition of Done (DoD)
Guards
- Do not modify
OnnxEvaluator.java, OnnxStrategy.java, Main.java or models; if a test reveals a defect, describe it in the pull request instead. No new dependencies; do not load a real ONNX model.
Verification gates
mise run format
mvn -B test -Dtest=OnnxEvaluatorFallbackTest
mise run check
Non-goals
Inference with a real model, the HTTP server, the webhook handshake.
Blast radius
One new test file. Execution tier: Routine.
Context
OnnxEvaluator(src/main/java/com/fortemate/dicechess/bot/OnnxEvaluator.java) loads an ONNX value model and falls back to the engine heuristicJvmApi.evaluatewhen the model path isnull, blank, missing, or not a loadable model.OnnxStrategyTestexercises the strategy through a missing model only; the fallback contract of the evaluator itself is not pinned.The Definition-of-Done block at the top of
AGENTS.mdapplies: runmise run format(Spotless), thenmise run check, before publishing. Tests use JUnit 5 (org.junit.jupiter.api), seeOnnxStrategyTest.javafor style; temporary files via@TempDir.Objective
Add
src/test/java/com/fortemate/dicechess/bot/OnnxEvaluatorFallbackTest.javawith:new OnnxEvaluator(null),new OnnxEvaluator(""),new OnnxEvaluator(" ")andnew OnnxEvaluator("no/such/model.onnx")→isLoaded()isfalse, no exception, andclose()is safe to call.isLoaded()isfalse.JvmApi/FenParseras used elsewhere in this repository) with dice poolp,evaluate(state, 0)equalsJvmApi.evaluate(state, 0)andevaluate(state, 1)equalsJvmApi.evaluate(state, 1).Definition of Done (DoD)
OnnxEvaluatorFallbackTest.javaexists and covers the three points; existing tests unchanged; no production source modified.mise run formatapplied;mvn -B test -Dtest=OnnxEvaluatorFallbackTestpasses;mise run checkpasses.Guards
OnnxEvaluator.java,OnnxStrategy.java,Main.javaor models; if a test reveals a defect, describe it in the pull request instead. No new dependencies; do not load a real ONNX model.Verification gates
mise run format mvn -B test -Dtest=OnnxEvaluatorFallbackTest mise run checkNon-goals
Inference with a real model, the HTTP server, the webhook handshake.
Blast radius
One new test file. Execution tier:
Routine.