fix(indexing): one blank-input rule for every document format - #105
Open
adityamparikh wants to merge 2 commits into
Open
fix(indexing): one blank-input rule for every document format#105adityamparikh wants to merge 2 commits into
adityamparikh wants to merge 2 commits into
Conversation
adityamparikh
force-pushed
the
fix/document-creator-null-validation
branch
from
May 2, 2026 17:04
51c5b8d to
ac5e90d
Compare
adityamparikh
force-pushed
the
fix/document-creator-null-validation
branch
from
August 18, 2026 21:25
ac5e90d to
a94d1f3
Compare
adityamparikh
force-pushed
the
fix/document-creator-null-validation
branch
2 times, most recently
from
August 19, 2026 11:58
a46d9b1 to
9fc28df
Compare
This was referenced Aug 19, 2026
The four creators disagreed on where and how blank input was rejected: JSON and CSV checked isBlank() in the creator, XML was checked only by the orchestrator (the creator itself failed with a parse error), and Markdown was checked in both places with different outcomes (orchestrator threw, creator returned an empty list). The messages differed too, and the interface javadoc promised three contracts none of them honoured. One SolrDocumentCreator.requireContent(content, format) helper now runs first in every create(); the orchestrator's two XML/Markdown checks are deleted. The helper checks blankness only. The creators are @NullMarked, so a null argument is a caller's contract violation rather than an input to validate; the null branches main still carried are removed along with the XML null test that pinned them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wh7SJkZhL1uuK7pYc3SLk8 Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
adityamparikh
force-pushed
the
fix/document-creator-null-validation
branch
from
September 11, 2026 15:34
9fc28df to
0851b26
Compare
The create() javadoc still promised an empty list for blank input, which this change removes. The two parameterized tests differed only in the input literal, so they are one test over creators x blank inputs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
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.
Problem
Four formats, three different rules for blank input, in two different layers:
mainJsonDocumentCreator.createisBlank()→"JSON input cannot be empty"CsvDocumentCreator.createisBlank()→"CSV input cannot be empty"IndexingDocumentCreator(orchestrator), creator has nonenull || trim().isEmpty()→"XML input cannot be null or empty"List.of()So
new XmlDocumentCreator().create("")fails with a parser error,new MarkdownDocumentCreator().create(" ")returns an empty list, and the interface javadoc promised three mutually exclusive contracts that no implementation honoured.Change
SolrDocumentCreator.requireContent(content, format)helper, blank-only, message"<FORMAT> input cannot be empty". Every creator calls it first, so the contract holds for direct callers and through the orchestrator alike; the orchestrator's XML/Markdown checks are deleted rather than moved.@NullMarked, so a null argument is a caller's contract violation, and the only place a runtime null can enter is the reflective@McpToolboundary (fix: validate collection name consistently across all MCP tool methods #108 guardscollectionthere). A client omitting thexmlormarkdownargument now gets the same NPE-derived tool error JSON and CSV already produced onmain, until MCP SDK 2.0 input validation (feat: upgrade to Spring Boot 4.1.1 and Spring AI 2.0.1 #23) rejects missing required arguments before dispatch.MarkdownDocumentCreatorjavadoc describe the one contract that now exists. Net: fewer lines thanmain, and no== nullanywhere in the package.Verification
DocumentCreatorBlankInputTest: 8 parameterized cases (4 formats × empty/whitespace), direct creator calls, no Spring. Written first; XML and Markdown fail onmain, JSON and CSV pass as regression pins../gradlew buildon Java 25: 410 tests, 0 failures, 7 skipped (the OTLP suite, skipped onmainuntil test(observability): re-enable OtlpExportIntegrationTest #198).🤖 Generated with Claude Code
https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ