Repository navigation
Fix template integration tests for typed parser DocItem output - #21141
Conversation
PR infiniflow#20998 changed the Parser component's json state from []map[string]any to []parser.DocItem but did not update the pipeline integration tests that still type-assert the old map shape. Those tests are gated behind RequireTokenizerPool, so CI skipped them and the break went unnoticed. Update the three assertions and the joinJSONItemTexts helper to read the typed DocItem via ToMap(), and refresh the stale []map[string]any output documentation in ParserComponent.Outputs(). Co-Authored-By: CodeBuddy <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
… text) Two classes of stale assertions in the pipeline integration tests, none of which are caused by the parser DocItem refactor: - Parser item count and text: TextParser has emitted a single normalized json item since infiniflow#19611, but TemplateManual_RealComponents still asserted 6 items and per-part text. Align to the single-item contract. - Chunk text whitespace: the chunker preserves the blank line between the two seed paragraphs verbatim ("Alpha paragraph.\n\nBeta paragraph."); the tests expected it collapsed to a single newline. Update the expectations for TemplateGeneral_RealComponents, TemplateOne_RealComponents and TemplateGeneral_RealMySQLMinIO_OutputShape. Also align the parser json type assertion in real_storage_integration_test.go to []parser.DocItem (same infiniflow#20998 regression missed by the earlier pass). No production code changed; this is test-only alignment. Co-Authored-By: CodeBuddy <[email protected]>
yuzhichang
left a comment
There was a problem hiding this comment.
LGTM. The []parser.DocItem type alignment is consistent across the output contract and integration tests, and the updated expectations match the typed parser output. No blocking findings.
Summary
Two commits that make the
internal/ingestion/pipelineintegration tests pass against the current production contract. No production code changed — all fixes are test-only alignment.1. Align parser
jsonstate to[]parser.DocItem(PR #20998 regression)PR #20998 changed the
Parsercomponent'sjsonstate from[]map[string]anyto[]parser.DocItembut left the pipeline integration tests asserting the old map shape. Those tests are gated behindRequireTokenizerPool(skips when/usr/share/infinity/resourceis absent), so CI skipped them and the break went unnoticed.template_integration_test.go: threeparserState["json"]assertions now type-assert[]parser.DocItemand read text viaDocItem.ToMap()["text"].helpers_test.go:joinJSONItemTextsnow accepts[]parser.DocItem.real_storage_integration_test.go: the same type assertion was missed in the earlier pass and is fixed here too.component/parser.go: refreshed the stale[]map[string]anyoutput documentation left behind by refactor(parser): type ParseResult.JSON as []DocItem boundary adapter #20998.2. Fix stale test expectations (pre-existing, unrelated to #20998)
TemplateManual_RealComponents):TextParserhas emitted a single normalized json item since refactor(ingestion): migrate general parser and chunker contract #19611, but the test still asserted 6 items and per-part text. Aligned to the single-item contract.TemplateGeneral_RealComponents,TemplateOne_RealComponents,TemplateGeneral_RealMySQLMinIO_OutputShape): the chunker preserves the blank line between the two seed paragraphs verbatim ("Alpha paragraph.\n\nBeta paragraph."); the tests expected it collapsed to a single newline. Updated the expectations (and corrected a now-inaccurate comment claiming whitespace collapsing).How it was tested
build.sh --test ./internal/ingestion/pipeline/... ./internal/ingestion/component/... ./internal/parser/parser/...— all green.build.sh --test-integration ./internal/ingestion/pipeline/— fully green, 0 failures (all template tests pass after these fixes).Note: the template integration tests still only run locally behind
RequireTokenizerPool; CI skips them, so CI remains green for the same reason the original break slipped through.Co-Authored-By: CodeBuddy [email protected]