Skip to content

fix(ingestion): derive component param whitelist from component schemas - #20060

Merged
wangq8 merged 3 commits into
infiniflow:mainfrom
jay77721:fix/component-param-whitelist
Sep 23, 2026
Merged

wangq8 merged 3 commits into
infiniflow:mainfrom
jay77721:fix/component-param-whitelist

Conversation

@jay77721

@jay77721 jay77721 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Summary

The dataset/document pipeline operator forms could not persist chunk_token_cap and root_chunk_as_heading for the built-in title/manual chunker templates. Saving goes through BuildParserConfig → CleanComponentParams, whose param whitelist only accepted keys the DSL template already baked; ingestion_pipeline_{book,laws,paper,manual}.json bake only method, hierarchy, levels and include_heading_content, so both keys were dropped with a warning while the API still returned success. At parse time the component then fell back to its schema defaults (cap 512, switch off) — the UI edit silently had no effect.

This change derives each component's accepted param keys from its param schema (schema.TitleChunkerParam, schema.TokenChunkerParam, schema.TokenizerParam) and unions them with the template-baked keys, so a param the component can read is no longer lost to template drift. It also covers canvas DSL snapshots saved before a param existed, and ManualChunker (whose config the dataset tabs now render) whose root_chunk_as_heading was being dropped the same way.

Related Issue

No upstream issue — reported directly by a user running the Go backend (title chunker "Chunk token cap" / "Set first chunk as global context" changes had no effect).

Changes

  • internal/ingestion/pipeline/pipeline_params.go: add componentParamSchemaKeys (component name → keys derived from the component's param schema) and union it into the CleanComponentParams whitelist; spell out the accepted-key sources in the function doc comment and record that ManualChunker accepts but ignores method / chunk_token_cap / include_heading_content. Templates, golden fixtures, Python behavior, and the existing Extractor/Compiler whitelists are untouched.
  • internal/ingestion/pipeline/pipeline_params_test.go: five tests —
    1. a stale canvas snapshot (node params without the two keys) keeps dataset-level overrides for the title family;
    2. BuildParserConfig preserves chunk_token_cap / root_chunk_as_heading for every builtin template carrying a TitleChunker/ManualChunker node;
    3. a guard test that pins the keys the operator forms can submit per component and asserts none of them is silently dropped in any builtin template;
    4. a component-name inventory test: every component in the builtin templates must be schema-derived or explicitly exempted, so a rename cannot silently disable guard 3;
    5. a negative case proving unknown keys are still dropped.

Non-goals

  • No template / golden / frontend / Python changes: with the union in place, a template that predates a param no longer affects whether it can be saved.
  • GeneralChunker, QAChunker and Parser keep their existing whitelists (param struct not in the schema package / no operator form / file families defined by the DSL); Extractor and Compiler keep their cpnID-prefixed dynamic whitelists.
  • The "warn and drop" behavior for genuinely unknown params is unchanged (a follow-up could turn it into a hard error).

Test Plan

  • bash build.sh --test ./internal/ingestion/pipeline/... ./internal/ingestion/task/... ./internal/service/dataset/... ./internal/service/document/... — all pass. The ingestion/task template golden test passes unchanged because no template was modified.
  • Sensitivity checked: with the production change reverted, the regression tests fail (book/laws/paper/manual report chunk_token_cap and root_chunk_as_heading dropped), so they lock the regression.

chunk_token_cap and root_chunk_as_heading were silently dropped when
saving the dataset/document parser_config for the builtin title and
manual templates: the param whitelist only accepted keys the DSL
template already carried, and those templates bake only method,
hierarchy, levels and include_heading_content.

Union the template keys with the keys declared by the component's param
schema, so a param the component can read survives for builtin templates
and for canvas snapshots saved before the param existed. ManualChunker
(whose config the dataset tabs now render) is covered by the same table.
@jay77721 jay77721 added go Pull requests that update go code size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Sep 22, 2026
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: ceff334b-548a-468d-b7c9-3669b52ddd03

📥 Commits

Reviewing files that changed from the base of the PR and between 8871872 and 52cd7d7.

📒 Files selected for processing (2)
  • internal/ingestion/pipeline/pipeline_params.go
  • internal/ingestion/pipeline/pipeline_params_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/ingestion/pipeline/pipeline_params.go

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The pipeline now preserves schema-declared component parameters during cleaning. Tests cover stale DSL snapshots, built-in templates, supported operator-form parameters, exemptions, and unknown-key removal.

Changes

Component parameter preservation

Layer / File(s) Summary
Schema-derived parameter whitelisting
internal/ingestion/pipeline/pipeline_params.go
CleanComponentParams now includes schema-derived keys for TitleChunker, ManualChunker, TokenChunker, and Tokenizer. Existing special cases and dynamic Extractor and Compiler keys remain active.
Parameter preservation validation
internal/ingestion/pipeline/pipeline_params_test.go
Tests verify preservation from stale DSL snapshots, built-in templates, and operator-form parameter whitelists. Inventory checks cover exemptions, and tests confirm unknown keys are still removed.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Suggested reviewers: euvre

Merge Risk: ⚪ Minimal · up to 52cd7

This change preserves supported ingestion parameters without retaining unknown keys, and no merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly describes the main change: deriving ingestion component parameter whitelists from component schemas.
Description check ✅ Passed The description includes the required Summary section and provides clear background, changes, non-goals, and test coverage.
  • Fix all pre-merge checks with AI

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

I’m a rabbit, and the keys now stay,
Through stale snapshots on their way.
Schemas guard each little gate,
Typos still meet a clean slate.
Templates pass with params bright,
Hop, hop, the pipeline’s right.

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

…keys

Pin the builtin templates' component-name inventory so a renamed or newly
added component cannot silently skip the operator-form guard, add a
negative case proving unknown keys are still dropped, and record that
ManualChunker accepts but ignores method / chunk_token_cap /
include_heading_content. Also spell out the accepted-key sources in the
CleanComponentParams doc comment.

@Bruce-Yii Bruce-Yii left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-scoped fix for the component param whitelist drift. Derives accepted keys from component schemas and unions with template-baked keys. Comprehensive test coverage (5 test cases). Approved.

@wangq8
wangq8 merged commit ee5c314 into infiniflow:main Sep 23, 2026
1 of 2 checks passed
@jay77721
jay77721 deleted the fix/component-param-whitelist branch October 16, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration go Pull requests that update go code size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants