Skip to content

Remove dead ParseResult.HTML field and redundant EmailParser json-path Text - #20992

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
xugangqiang:rm-html-field-email-text
Oct 15, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
xugangqiang:rm-html-field-email-text

Conversation

@xugangqiang

Copy link
Copy Markdown
Contributor

Summary

PR #19467 unified the ingestion component to JSON-only output, leaving Markdown/Text as the internal normalization fallback and the direct-call contract. HTML was never produced by any Go parser, so ParseResult.HTML and its normalization branches were dead code.

  • Drop ParseResult.HTML and the html branch in resolveParserNormalizationSource / normalizeParserJSON / parseResultText.
  • Stop duplicating the flattened email body into result.Text on the JSON output path; the searchable text already lives in the JSON items. The text output_format branch still populates result.Text (it is the only path that reads it downstream via parseResultText).

Test plan

  • TestParseResult_Contract drops the html family clause.
  • TestNormalizeParserJSON_EmptyPayloadYieldsEmpty pins empty payload -> empty slice (no html fall-through).
  • TestEmailParserJSONPathOmitsDuplicateText / TestEmailParserTextPathKeepsText pin the json/text Text contract.
  • bash build.sh --test green for internal/parser/parser, internal/ingestion/component, internal/ingestion/component/chunker, internal/service/file.

…h Text

PR infiniflow#19467 unified the component to JSON-only output, leaving Markdown/Text as
the internal normalization fallback and direct-call contract. HTML was never
produced by any Go parser, so the ParseResult.HTML field and its normalization
branches were dead code.

- Drop ParseResult.HTML and the html branch in resolveParserNormalizationSource
  / normalizeParserJSON / parseResultText.
- Stop duplicating the flattened email body into result.Text on the JSON output
  path; the searchable text already lives in the JSON items. The "text"
  output_format branch still populates result.Text.

Add TDD guards: TestParseResult_Contract drops the html family,
TestNormalizeParserJSON_EmptyPayloadYieldsEmpty pins empty payload -> empty
slice, TestEmailParserJSONPathOmitsDuplicateText / TestEmailParserTextPathKeepsText
pin the json/text Text contract.
@xugangqiang xugangqiang added the ci Continue Integration label Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e1730d4e-dfd3-4a92-9581-aadc9ddc7b50
📥 Commits

Reviewing files that changed from the base of the PR and between a2a629e and 02b272e.

📒 Files selected for processing: 9
  • internal/ingestion/component/chunker/xlsx_qa_regression_test.go
  • internal/ingestion/component/parser.go
  • internal/ingestion/component/parser_dispatch.go
  • internal/ingestion/component/parser_dispatch_test.go
  • internal/parser/parser/email_parser.go
  • internal/parser/parser/email_parser_test.go
  • internal/parser/parser/parse_result.go
  • internal/parser/parser/parse_result_test.go
  • internal/service/file/file_content.go
💤 Files with no reviewable changes: 4
  • internal/parser/parser/email_parser.go
  • internal/ingestion/component/chunker/xlsx_qa_regression_test.go
  • internal/ingestion/component/parser.go
  • internal/ingestion/component/parser_dispatch.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The parser result contract no longer includes HTML. Ingestion and file content normalization no longer process HTML payloads. Email JSON output leaves Text empty, while explicit text output continues to populate it.

Changes: Parser Output Normalization

Layer / File(s) Summary
Parser result contract
internal/parser/parser/parse_result.go, internal/parser/parser/parse_result_test.go
The ParseResult contract and its tests now cover JSON, Markdown, and text payloads. The exported HTML field and related test cases are removed.
Email JSON and text output
internal/parser/parser/email_parser.go, internal/parser/parser/email_parser_test.go
Email JSON results no longer set Text; tests check email content in JSON items. Explicit text output continues to populate Text.
Downstream parser normalization
internal/ingestion/component/parser.go, internal/ingestion/component/parser_dispatch.go, internal/ingestion/component/parser_dispatch_test.go, internal/ingestion/component/chunker/xlsx_qa_regression_test.go, internal/service/file/file_content.go
Ingestion normalization no longer processes HTML results. File content handling no longer returns HTML or uses it as a JSON fallback. Tests cover empty JSON results and remaining normalization behavior.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: jay77721

Merge Risk: ⚪ Minimal · up to 02b27

No actionable issue is established for this change; it is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the two main changes: removing the unused ParseResult.HTML field and eliminating duplicate email JSON-path text.
Description check Passed The description includes the required Summary section, explains the background and intended changes, and provides a specific test plan with reported test coverage.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the parser’s trail,
JSON items fill the pail.
Text stays clear when asked to show,
HTML paths no longer flow.
The tests hop on, then settle down.

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

@Harsh23Kashyap

Copy link
Copy Markdown
Collaborator

LGTM at 02b272e.

I checked the parser producers and the normalization/file-content consumers. HTML parsing already returns JSON items; removing the unused HTML result field does not remove the HTML file parser. Email's JSON output remains the content source after dropping its duplicate Text field.

With TIKTOKEN_CACHE_DIR=/tmp/ragflow-bpe CGO_ENABLED=0, I ran the parser, file service, chunker and component packages twice with -count=1. Parser passed (5.300s, 5.666s), file service passed (0.792s, 1.219s), and chunker passed (0.659s, 0.778s). The component suite failed both times because TestDispatch_PDFLegacyMarkdownConfigurationEmitsJSON needs a PDF backend unavailable in this build. The same test fails on the PR base for the same reason. Four CI checks passed; the native-backend job was skipped.

@yuzhichang
yuzhichang merged commit 66f15c7 into infiniflow:main Oct 15, 2026
6 checks passed
xugangqiang added a commit to xugangqiang/ragflow that referenced this pull request Oct 15, 2026
…pt typed JSON tests

Rebasing the DocItem boundary-adapter branch onto the current
upstream/main surfaced two classes of breakage that the original PR
(base predating these upstream changes) did not have:

- upstream infiniflow#20992 removed ParseResult.HTML as dead/redundant, so the
  HTML fallback in normalizeParserJSON (which referenced
  dispatched.HTML) no longer compiles. Drop that branch to match the
  post-infiniflow#20992 contract; HTML normalization is no longer carried on
  ParseResult.
- upstream's newer tests (csv/email/office_table_render) index
  res.JSON as []map[string]any. With JSON now typed []DocItem they must
  project via DocItem.ToMap() (same boundary-adapter pattern used in
  the integration test fix).
- email json-path must not duplicate the flattened body into
  result.Text (text lives in the JSON items), matching the upstream
  test TestEmailParserJSONPathOmitsDuplicateText; drop Text: text from
  the json return.
@xugangqiang
xugangqiang deleted the rm-html-field-email-text branch November 26, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants