Skip to content

Feat: add built in DSL file API - #17003

Merged
yuzhichang merged 2 commits into
infiniflow:mainfrom
xugangqiang:feat/dsl-component-params
Jul 18, 2026
Merged

yuzhichang merged 2 commits into
infiniflow:mainfrom
xugangqiang:feat/dsl-component-params

Conversation

@xugangqiang

@xugangqiang xugangqiang commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  1. list and get by id API for builtin DSL
  2. add DSL default component param values validation
  3. remove all hard code keys for parser config

@xugangqiang xugangqiang added the ci Continue Integration label Jul 16, 2026
@xugangqiang
xugangqiang marked this pull request as ready for review July 16, 2026 10:04
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR migrates parser configuration to parser_id, pipeline_id, and component parameters; adds builtin pipeline listing/detail APIs; validates DSL-backed overrides; records pipeline duration; and adjusts ingestion concurrency, error mapping, and related tests.

Changes

Pipeline configuration and API migration

Layer / File(s) Summary
Component schemas and defaults
internal/ingestion/pipeline/component_params.go, internal/ingestion/task/pipeline_executor_defaults_test.go, internal/ingestion/pipeline/*_test.go
DSL components are extracted into deep-copied defaults, excluding outputs, with coverage across builtin templates.
Builtin pipeline registry and catalog endpoints
internal/ingestion/pipeline/builtin_registry.go, internal/handler/pipeline.go, internal/router/router.go, internal/service/document_upload_helpers.go
Builtin metadata now returns {canvas,total}, parser selection uses registry heuristics, and pipeline list/detail routes expose metadata and DSL.
Dataset parser contract and component defaults
internal/service/dataset.go, internal/service/dataset_create_test.go, internal/service/dataset_update_test.go, test/testcases/restful_api/test_datasets.py
Dataset creation and updates use builtin or canvas identifiers, resolve component defaults, validate overrides, and return parser_id.
Document parser updates and validation
internal/service/document.go, internal/service/document_component_params_test.go, internal/service/document_test.go, internal/handler/document.go
Document reparsing uses parser_id/pipeline_id, component parameters are validated against effective DSLs, and document creation plus chunk_method mappings are removed.
Runtime parameters and execution results
internal/ingestion/task/pipeline_executor.go, internal/ingestion/service/doc_state.go, internal/ingestion/task/*_test.go
Pipeline results include elapsed duration, unknown component parameters generate warnings, and chunk statistics receive the measured duration.

Operational adjustments

Layer / File(s) Summary
Startup, concurrency, logging, and task handling
cmd/ragflow_server.go, internal/ingestion/service/*, internal/parser/parser/pdf_parser_cgo.go, internal/service/chunk/chunk.go, internal/tokenizer/tokenizer_concurrent_test.go
Startup concurrency and default worker sizing change, PDF parsing logs its method, DAO lookup errors are returned, and heartbeat synchronization is deadline-based.
Ingestion error-code mapping
internal/handler/error.go, internal/admin/handler.go, internal/handler/document.go, internal/httputil/ingestion_task_error.go
Ingestion task error classification moves from httputil into handler and is used by administrative and document handlers.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

Suggested labels: ☯️ refactor

Suggested reviewers: yingfeng, yuzhichang, jinhai-cn

Poem

A rabbit hops through templates bright,
Setting parser defaults just right.
Canvas paths and DSLs align,
Pipelines measure every time.
Errors wear a handler’s hue—
“Hop!” says the rabbit, “ship it through!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.31% which is insufficient. The required threshold is 80.00%. 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 is concise and clearly matches the main change: adding a built-in DSL file API.
Description check ✅ Passed The description covers the main goals and lists the key changes, though it lacks the background context requested by the template.

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

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

🧹 Nitpick comments (1)
internal/handler/pipeline.go (1)

35-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the speculative user-defined pipeline note.

Document only the currently supported builtin resource; “may be added later” is not a runtime contract.

As per coding guidelines, remove stale documentation and “move later” notes.

Proposed change
 // PipelineHandler handles pipeline endpoints.
-// Pipelines are the top-level resource for ingestion pipeline templates.
-// Built-in templates are shipped with the binary; user-defined templates
-// (canvas DSL) may be added later.
+// Pipelines are built-in ingestion pipeline templates shipped with the binary.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/handler/pipeline.go` around lines 35 - 38, Remove the speculative
user-defined pipeline and future-support wording from the documentation comment
above PipelineHandler, leaving only the currently supported built-in pipeline
resource description.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/ingestion/task/pipeline_executor_defaults.go`:
- Around line 85-93: Update the pipeline override flow around
buildComponentParams and pipe.Run to pass the complete component-params map,
including per-component values such as Tokenizer.fields, instead of converting
it through bridgeToLegacySetups. Extend the pipeline/canvas override contract
and update downstream consumers to merge the full map while preserving existing
setup handling and unknown-component validation.

In `@internal/service/dataset.go`:
- Around line 1710-1718: Reject requests that provide both a non-empty
chunk_method/parserID and pipelineID before calling common.GetParserConfig or
deriving parserConfig. Update the surrounding dataset configuration flow to
return the existing data-error response for this invalid combination, while
preserving normal behavior when only one is supplied.

In `@internal/service/document.go`:
- Around line 2591-2600: Authorize custom canvas resolution using the caller’s
tenant or user scope instead of unrestricted ID lookup. In
internal/service/document.go:2591-2600, update loadCanvasDSLJSON and its callers
to use an ownership-aware DAO query; in internal/service/document.go:2500-2521,
propagate the authenticated scope into pipeline resolution; and in
internal/service/dataset.go:3094-3110, pass tenantID through dataset
component-parameter validation.
- Around line 2569-2584: The custom canvas selection logic should honor an
explicitly cleared pipeline_id instead of falling back to doc.PipelineID. Update
the pipeline_id handling in the surrounding pipeline/parser resolution function
so presence of the request field, including an empty or whitespace value,
prevents selecting the stored canvas and allows the built-in template path to be
used.

---

Nitpick comments:
In `@internal/handler/pipeline.go`:
- Around line 35-38: Remove the speculative user-defined pipeline and
future-support wording from the documentation comment above PipelineHandler,
leaving only the currently supported built-in pipeline resource description.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8c5724ae-5848-4d32-bc43-ede5c3312a45

📥 Commits

Reviewing files that changed from the base of the PR and between caa76fb and 43ec84d.

📒 Files selected for processing (20)
  • docker/entrypoint.sh
  • internal/common/parser_config.go
  • internal/common/parser_config_test.go
  • internal/handler/pipeline.go
  • internal/handler/pipeline_test.go
  • internal/ingestion/pipeline/builtin_registry.go
  • internal/ingestion/pipeline/builtin_registry_test.go
  • internal/ingestion/pipeline/component_params.go
  • internal/ingestion/pipeline/component_params_test.go
  • internal/ingestion/service/execute_task_ack_test.go
  • internal/ingestion/task/pipeline_executor_defaults.go
  • internal/ingestion/task/pipeline_executor_defaults_test.go
  • internal/parser/parser/pdf_parser_cgo.go
  • internal/router/router.go
  • internal/service/chunk/chunk.go
  • internal/service/dataset.go
  • internal/service/dataset_create_test.go
  • internal/service/dataset_update_test.go
  • internal/service/document.go
  • internal/service/document_component_params_test.go

Comment thread internal/service/dataset.go Resolved
Comment thread internal/service/document.go Resolved
Comment thread internal/service/document.go Resolved
@xugangqiang
xugangqiang marked this pull request as draft July 16, 2026 11:01
@xugangqiang
xugangqiang marked this pull request as ready for review July 16, 2026 11:02
@dosubot dosubot Bot added 💞 feature Feature request, pull request that fullfill a new feature. 🧪 test Pull requests that update test cases. labels Jul 16, 2026
@xugangqiang
xugangqiang marked this pull request as draft July 16, 2026 11:28
@xugangqiang
xugangqiang marked this pull request as ready for review July 16, 2026 11:28
@xugangqiang xugangqiang added ci Continue Integration and removed ci Continue Integration labels Jul 16, 2026
@codecov

codecov Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (c420de0) to head (b0b81e0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #17003   +/-   ##
=======================================
  Coverage   90.65%   90.65%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          650      650           
  Misses         39       39           
  Partials       28       28           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xugangqiang
xugangqiang force-pushed the feat/dsl-component-params branch from 1199017 to 43ec84d Compare July 16, 2026 13:58
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Jul 17, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
internal/ingestion/task/pipeline_real_integration_test.go (1)

428-442: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Re-add the integration build tag or use t.Skip().

By removing the //go:build integration tag (as indicated by the line-range change details), this test now runs unconditionally during standard go test invocations. Because the test requires real infrastructure (MySQL and MinIO) and a specific configuration file (service_conf.yaml), it will fail with t.Fatal in environments where these are unavailable (such as standard CI pipelines or local development environments without the full stack running).

Please restore the build tag at the top of the file, or change the t.Fatal calls here to t.Skip to gracefully bypass the test when the environment isn't fully configured.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/ingestion/task/pipeline_real_integration_test.go` around lines 428 -
442, Re-add the integration build tag at the top of
pipeline_real_integration_test.go so the real-infrastructure tests remain
excluded from standard go test runs. Keep mustLoadTaskRealIntegrationConfig
validation and its t.Fatal behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/testcases/restful_api/test_datasets.py`:
- Around line 30-31: Converge the dataset API tests on the parser_id contract by
removing the conditional PARSER_ID_FIELD fallback to chunk_method and
eliminating Go-only skips that mask differing create behavior. Update the
affected dataset create tests to use only supported fields consistently; delete
tests for fields no longer in the public contract rather than preserving
compatibility paths.

---

Outside diff comments:
In `@internal/ingestion/task/pipeline_real_integration_test.go`:
- Around line 428-442: Re-add the integration build tag at the top of
pipeline_real_integration_test.go so the real-infrastructure tests remain
excluded from standard go test runs. Keep mustLoadTaskRealIntegrationConfig
validation and its t.Fatal behavior unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cacc2597-13b7-40e4-aa48-02acd8bbab07

📥 Commits

Reviewing files that changed from the base of the PR and between 1199017 and 5cc16dd.

📒 Files selected for processing (24)
  • cmd/ragflow_server.go
  • internal/common/parser_config.go
  • internal/handler/document.go
  • internal/handler/document_test.go
  • internal/ingestion/pipeline/builtin_registry.go
  • internal/ingestion/pipeline/builtin_registry_test.go
  • internal/ingestion/pipeline/component_params.go
  • internal/ingestion/service/doc_state.go
  • internal/ingestion/service/ingestion_service.go
  • internal/ingestion/task/pipeline_executor.go
  • internal/ingestion/task/pipeline_executor_defaults.go
  • internal/ingestion/task/pipeline_executor_defaults_test.go
  • internal/ingestion/task/pipeline_executor_test.go
  • internal/ingestion/task/pipeline_real_integration_test.go
  • internal/router/router.go
  • internal/service/dataset.go
  • internal/service/dataset_create_test.go
  • internal/service/dataset_update_test.go
  • internal/service/document.go
  • internal/service/document_component_params_test.go
  • internal/service/document_test.go
  • internal/service/document_upload_helpers.go
  • internal/tokenizer/tokenizer_concurrent_test.go
  • test/testcases/restful_api/test_datasets.py
💤 Files with no reviewable changes (4)
  • internal/ingestion/task/pipeline_executor_defaults_test.go
  • internal/common/parser_config.go
  • internal/handler/document_test.go
  • internal/router/router.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • cmd/ragflow_server.go
  • internal/service/document_component_params_test.go
  • internal/service/dataset.go

@xugangqiang
xugangqiang force-pushed the feat/dsl-component-params branch from 5cc16dd to b215dcb Compare July 17, 2026 08:37

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (3)
internal/admin/handler.go (1)

1070-1076: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Inconsistent error mapping for conditional task stops.

While StopIngestionTasks correctly uses handler.IngestionTaskErrorCode(err) to map service errors to HTTP status codes, the adjacent StopIngestionTasksByCondition implementation (lines 1086-1091) still hardcodes common.CodeBadRequest. Consider updating it for consistency.

♻️ Proposed refactor
 	} else {
 		tasks, err := h.service.StopIngestionTasksByCondition(req.Tasks, req.Email, req.Status)
 		if err != nil {
-			common.ErrorWithCode(c, common.CodeBadRequest, err.Error())
+			common.ErrorWithCode(c, handler.IngestionTaskErrorCode(err), err.Error())
 			return
 		}
 		common.SuccessWithData(c, tasks, "Stop tasks successfully")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/admin/handler.go` around lines 1070 - 1076, Update the
StopIngestionTasksByCondition error path to use
handler.IngestionTaskErrorCode(err) when calling common.ErrorWithCode, matching
the existing StopIngestionTasks mapping instead of hardcoding
common.CodeBadRequest.
cmd/ragflow_server.go (1)

498-498: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff

Hardcoded concurrency limits ingestor throughput.

By hardcoding the maxConcurrency parameter to 2, the ingestor will only use 2 concurrent workers regardless of the available CPU cores. This can severely limit ingestion throughput on larger machines. Consider using a configurable value from config.Ingestor or passing 0 to rely on the default runtime.NumCPU() fallback defined in NewIngestor.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ragflow_server.go` at line 498, Update the NewIngestor call in the
ingestion setup to avoid the hardcoded maxConcurrency value of 2. Use the
configurable concurrency from config.Ingestor if available, or pass 0 to
activate NewIngestor’s runtime.NumCPU() default while preserving the existing
file type list and arguments.
internal/handler/error_test.go (1)

38-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Prefer t.Errorf in table-driven tests.

In table-driven tests, using t.Errorf instead of t.Fatalf allows the test to continue evaluating subsequent test cases even if one fails. This provides more comprehensive feedback on test failures.

♻️ Proposed refactor
 	for _, tc := range testCases {
 		if got := IngestionTaskErrorCode(tc.err); got != tc.want {
-			t.Fatalf("%s: got %d, want %d", tc.name, got, tc.want)
+			t.Errorf("%s: got %d, want %d", tc.name, got, tc.want)
 		}
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/handler/error_test.go` around lines 38 - 42, The table-driven loop
in the IngestionTaskErrorCode test should use t.Errorf instead of t.Fatalf so
all test cases are evaluated after a failure. Keep the existing failure message
and comparison unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/handler/pipeline_test.go`:
- Around line 42-48: The fakePipelineRegistry.Get test fixture currently uses an
empty, non-distinctive DSL, so it cannot verify the handler preserves the
registry value. Assign a distinctive DSL to the returned BuiltinPipeline and
update the GetPipeline assertions to compare its contents with resp.Data.DSL,
covering the related test cases around the handler response.

In `@internal/service/dataset_update_test.go`:
- Around line 50-52: Define an explicit precedence contract for simultaneous
ParserID and PipelineID in the dataset update test setup. Update the relevant
validation/default-resolution logic to reject or clear one field so
parser_config and execution cannot target different DSLs, and add assertions
covering the chosen behavior in the affected test cases.

In `@internal/service/document_component_params_test.go`:
- Around line 230-243: Update
TestValidateComponentParamsForUpdate_ParserIDSwitch so the request uses parser
configuration valid only for the new “qa” parser and invalid for the stored
“general” parser, or otherwise assert rejection of an old-parser-only value.
Ensure the fixture proves validateComponentParamsForUpdate honors the ParserID
change rather than passing with parameters shared by both templates.

---

Nitpick comments:
In `@cmd/ragflow_server.go`:
- Line 498: Update the NewIngestor call in the ingestion setup to avoid the
hardcoded maxConcurrency value of 2. Use the configurable concurrency from
config.Ingestor if available, or pass 0 to activate NewIngestor’s
runtime.NumCPU() default while preserving the existing file type list and
arguments.

In `@internal/admin/handler.go`:
- Around line 1070-1076: Update the StopIngestionTasksByCondition error path to
use handler.IngestionTaskErrorCode(err) when calling common.ErrorWithCode,
matching the existing StopIngestionTasks mapping instead of hardcoding
common.CodeBadRequest.

In `@internal/handler/error_test.go`:
- Around line 38-42: The table-driven loop in the IngestionTaskErrorCode test
should use t.Errorf instead of t.Fatalf so all test cases are evaluated after a
failure. Keep the existing failure message and comparison unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b901268f-37fc-4a0a-adc7-b30737a3e58d

📥 Commits

Reviewing files that changed from the base of the PR and between 5cc16dd and b215dcb.

📒 Files selected for processing (32)
  • cmd/ragflow_server.go
  • internal/admin/handler.go
  • internal/handler/document.go
  • internal/handler/document_test.go
  • internal/handler/error.go
  • internal/handler/error_test.go
  • internal/handler/pipeline.go
  • internal/handler/pipeline_test.go
  • internal/httputil/ingestion_task_error.go
  • internal/ingestion/pipeline/builtin_registry.go
  • internal/ingestion/pipeline/builtin_registry_test.go
  • internal/ingestion/pipeline/component_params.go
  • internal/ingestion/pipeline/component_params_test.go
  • internal/ingestion/service/doc_state.go
  • internal/ingestion/service/execute_task_ack_test.go
  • internal/ingestion/service/ingestion_service.go
  • internal/ingestion/task/pipeline_executor.go
  • internal/ingestion/task/pipeline_executor_defaults_test.go
  • internal/ingestion/task/pipeline_executor_test.go
  • internal/ingestion/task/pipeline_real_integration_test.go
  • internal/parser/parser/pdf_parser_cgo.go
  • internal/router/router.go
  • internal/service/chunk/chunk.go
  • internal/service/dataset.go
  • internal/service/dataset_create_test.go
  • internal/service/dataset_update_test.go
  • internal/service/document.go
  • internal/service/document_component_params_test.go
  • internal/service/document_test.go
  • internal/service/document_upload_helpers.go
  • internal/tokenizer/tokenizer_concurrent_test.go
  • test/testcases/restful_api/test_datasets.py
💤 Files with no reviewable changes (2)
  • internal/httputil/ingestion_task_error.go
  • internal/handler/document_test.go
🚧 Files skipped from review as they are similar to previous changes (21)
  • internal/tokenizer/tokenizer_concurrent_test.go
  • internal/parser/parser/pdf_parser_cgo.go
  • internal/ingestion/service/doc_state.go
  • internal/ingestion/pipeline/component_params.go
  • internal/router/router.go
  • internal/ingestion/service/ingestion_service.go
  • internal/service/dataset_create_test.go
  • internal/handler/pipeline.go
  • internal/ingestion/task/pipeline_executor_test.go
  • internal/service/chunk/chunk.go
  • internal/service/document_upload_helpers.go
  • internal/ingestion/pipeline/component_params_test.go
  • internal/ingestion/task/pipeline_real_integration_test.go
  • internal/ingestion/pipeline/builtin_registry.go
  • internal/service/document_test.go
  • internal/handler/document.go
  • internal/ingestion/service/execute_task_ack_test.go
  • internal/ingestion/pipeline/builtin_registry_test.go
  • test/testcases/restful_api/test_datasets.py
  • internal/service/document.go
  • internal/service/dataset.go

Comment on lines +42 to +48
func (f fakePipelineRegistry) Get(ref string) (*pipelinepkg.BuiltinPipeline, bool) {
for _, item := range f.items {
if item.ParserID == ref {
return &pipelinepkg.BuiltinPipeline{
BuiltinPipelineMeta: *item,
DSL: map[string]any{"components": map[string]any{}},
}, true

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert that GetPipeline returns the registry’s exact DSL.

The test only checks for a non-nil map, so it would pass if the handler returned any unrelated DSL. Give the fake a distinctive DSL and compare its contents with resp.Data.DSL.

Also applies to: 188-219

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/handler/pipeline_test.go` around lines 42 - 48, The
fakePipelineRegistry.Get test fixture currently uses an empty, non-distinctive
DSL, so it cannot verify the handler preserves the registry value. Assign a
distinctive DSL to the returned BuiltinPipeline and update the GetPipeline
assertions to compare its contents with resp.Data.DSL, covering the related test
cases around the handler response.

Comment thread internal/service/dataset_update_test.go Resolved
Comment on lines +230 to +243
func TestValidateComponentParamsForUpdate_ParserIDSwitch(t *testing.T) {
// Request switches the parser_id; the doc's stored parser is "general".
datasetID, docID := seedValidationDB(t, validationDoc("general", nil), nil)
newPID := "qa"
req := &UpdateDatasetDocumentRequest{
ParserID: &newPID,
ParserConfig: map[string]any{
"Parser:HipSignsRhyme": map[string]any{"pdf": map[string]any{}},
},
}
present := map[string]bool{"parser_config": true, "parser_id": true}
if err := (&DocumentService{}).validateComponentParamsForUpdate(datasetID, docID, "u1", req, present); err != nil {
t.Errorf("expected nil for valid parser switch, got %v", err)
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the parser-switch fixture distinguish qa from general.

The submitted component parameters are already valid for the stored general parser, so this test passes even if newPID is ignored. Use a component or parameter unique to one template, or assert rejection for a value valid only under the old parser.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/document_component_params_test.go` around lines 230 - 243,
Update TestValidateComponentParamsForUpdate_ParserIDSwitch so the request uses
parser configuration valid only for the new “qa” parser and invalid for the
stored “general” parser, or otherwise assert rejection of an old-parser-only
value. Ensure the fixture proves validateComponentParamsForUpdate honors the
ParserID change rather than passing with parameters shared by both templates.

@xugangqiang
xugangqiang force-pushed the feat/dsl-component-params branch from b215dcb to 3ec5d11 Compare July 17, 2026 08:55

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
internal/service/dataset_create_test.go (1)

67-71: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename chunkMethod to parserID.

These tests use the legacy variable name chunkMethod for values strictly assigned to ParserID fields. To fully align with the PR's migration from chunk_method to parser_id and prevent confusion, consider updating the variable name across these test flows.

  • internal/service/dataset_create_test.go#L67-L71: rename chunkMethod to parserID.
  • internal/service/dataset_create_test.go#L88-L92: rename chunkMethod to parserID.
  • internal/service/document_test.go#L1711-L1718: rename chunkMethod to parserID, and update the adjacent assertion's failure message from want method=%s to want parser_id=%s.
  • internal/service/document_test.go#L2284-L2286: rename chunkMethod to parserID.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/service/dataset_create_test.go` around lines 67 - 71, Rename the
legacy chunkMethod variable to parserID at
internal/service/dataset_create_test.go:67-71 and 88-92, and at
internal/service/document_test.go:1711-1718 and 2284-2286. Update all references
accordingly, and change the adjacent assertion message at
document_test.go:1711-1718 from “want method=%s” to “want parser_id=%s”.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/service/dataset_create_test.go`:
- Around line 67-71: Rename the legacy chunkMethod variable to parserID at
internal/service/dataset_create_test.go:67-71 and 88-92, and at
internal/service/document_test.go:1711-1718 and 2284-2286. Update all references
accordingly, and change the adjacent assertion message at
document_test.go:1711-1718 from “want method=%s” to “want parser_id=%s”.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: db2070f0-b52e-4d19-8b15-167e0eefc382

📥 Commits

Reviewing files that changed from the base of the PR and between b215dcb and 3ec5d11.

📒 Files selected for processing (32)
  • cmd/ragflow_server.go
  • internal/admin/handler.go
  • internal/handler/document.go
  • internal/handler/document_test.go
  • internal/handler/error.go
  • internal/handler/error_test.go
  • internal/handler/pipeline.go
  • internal/handler/pipeline_test.go
  • internal/httputil/ingestion_task_error.go
  • internal/ingestion/pipeline/builtin_registry.go
  • internal/ingestion/pipeline/builtin_registry_test.go
  • internal/ingestion/pipeline/component_params.go
  • internal/ingestion/pipeline/component_params_test.go
  • internal/ingestion/service/doc_state.go
  • internal/ingestion/service/execute_task_ack_test.go
  • internal/ingestion/service/ingestion_service.go
  • internal/ingestion/task/pipeline_executor.go
  • internal/ingestion/task/pipeline_executor_defaults_test.go
  • internal/ingestion/task/pipeline_executor_test.go
  • internal/ingestion/task/pipeline_real_integration_test.go
  • internal/parser/parser/pdf_parser_cgo.go
  • internal/router/router.go
  • internal/service/chunk/chunk.go
  • internal/service/dataset.go
  • internal/service/dataset_create_test.go
  • internal/service/dataset_update_test.go
  • internal/service/document.go
  • internal/service/document_component_params_test.go
  • internal/service/document_test.go
  • internal/service/document_upload_helpers.go
  • internal/tokenizer/tokenizer_concurrent_test.go
  • test/testcases/restful_api/test_datasets.py
💤 Files with no reviewable changes (2)
  • internal/httputil/ingestion_task_error.go
  • internal/handler/document_test.go
🚧 Files skipped from review as they are similar to previous changes (22)
  • internal/tokenizer/tokenizer_concurrent_test.go
  • internal/handler/error.go
  • internal/ingestion/service/ingestion_service.go
  • internal/handler/error_test.go
  • internal/parser/parser/pdf_parser_cgo.go
  • internal/ingestion/pipeline/component_params.go
  • internal/ingestion/pipeline/builtin_registry_test.go
  • internal/router/router.go
  • internal/ingestion/pipeline/component_params_test.go
  • cmd/ragflow_server.go
  • internal/admin/handler.go
  • internal/ingestion/task/pipeline_executor_defaults_test.go
  • internal/handler/pipeline_test.go
  • internal/ingestion/task/pipeline_executor_test.go
  • internal/service/document_upload_helpers.go
  • internal/handler/pipeline.go
  • internal/handler/document.go
  • internal/service/dataset_update_test.go
  • test/testcases/restful_api/test_datasets.py
  • internal/service/document_component_params_test.go
  • internal/service/dataset.go
  • internal/service/document.go

…d ingestion integration

- KB/Doc-level component_params validation against DSL schema
- Builtin DSL pipeline registry and API (list, get by id)
- ParserConfig stores DSL runtime params directly {cpnID: {param: value}}
- Runtime: PatchDSL + override_params merge via applyOverrideParams (top-level)
- Remove legacy hardcoded parser_config defaults
- Rebase onto upstream/main including PR infiniflow#16991
@xugangqiang
xugangqiang force-pushed the feat/dsl-component-params branch from 3ec5d11 to b0b81e0 Compare July 17, 2026 16:05
@yuzhichang

Copy link
Copy Markdown
Member

LGTM

@yuzhichang
yuzhichang merged commit 10c00a9 into infiniflow:main Jul 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration 💞 feature Feature request, pull request that fullfill a new feature. size:XXL This PR changes 1000+ lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants