Skip to content

Fix: The form related to switching the dataset pipeline configuration was not rendered. - #17124

Merged
wangq8 merged 4 commits into
infiniflow:mainfrom
cike8899:feat-pipeline-dataset-config
Jul 21, 2026
Merged

wangq8 merged 4 commits into
infiniflow:mainfrom
cike8899:feat-pipeline-dataset-config

Conversation

@cike8899

Copy link
Copy Markdown
Contributor

Summary

Fix: The form related to switching the dataset pipeline configuration was not rendered.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 20, 2026
@cike8899 cike8899 added ci Continue Integration and removed 🐞 bug Something isn't working, pull request that fix bug. labels Jul 20, 2026
@cike8899
cike8899 marked this pull request as draft July 20, 2026 11:16
@cike8899
cike8899 marked this pull request as ready for review July 20, 2026 11:16
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Dataset settings now synchronize parser configuration with selected pipelines, preserve DSL defaults when pipeline configuration is absent, rebuild parser configuration from operator nodes, and select backend-specific parser fields during dataset creation.

Changes

Dataset parser configuration synchronization

Layer / File(s) Summary
Parser configuration contracts and construction
web/src/interfaces/database/dataset.ts, web/src/pages/dataset/setting/utils.ts
IDataset accepts an optional parser_id; operator forms preserve DSL defaults, and buildParserConfigFromNodes creates configuration keyed by operator identifiers.
Pipeline change synchronization
web/src/pages/dataset/setting/hooks.ts, web/src/pages/dataset/setting/index.tsx
Dataset settings distinguish saved and selected pipelines, fetch matching operator nodes, reset parser_config during pipeline changes, and display loading while nodes are unavailable.

Backend-specific dataset creation

Layer / File(s) Summary
Backend-specific parser field selection
web/src/utils/backend-runtime.ts, web/src/pages/datasets/dataset-creating-dialog.tsx
Dataset creation detects Go backend runtime and selects parser_id with BuiltinPipelineItem, or chunk_method with ChunkMethodItem for other backends.

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

Possibly related PRs

Suggested labels: 🧰 typescript

Poem

I’m a bunny with a pipeline chart,
Resetting stale forms with a hop and start.
DSL defaults stay tucked in place,
Parser IDs switch by backend space.
Clean configs bloom anew—
Carrots and tidy settings too!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change and clearly references the dataset pipeline configuration form issue.
Description check ✅ Passed The description satisfies the repository template by providing a brief Summary that matches the PR purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

Caution

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

⚠️ Outside diff range comments (1)
web/src/pages/dataset/setting/utils.ts (1)

274-306: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

isEmpty check is scoped too broadly — Parser operator can still lose DSL defaults.

The guard checks isEmpty(pipelineParserConfig) (the whole map), not whether this operatorId has an entry. When pipelineParserConfig has entries for other operators but not this one, pipelineParserConfig[operatorId] is undefined. For Operator.Parser, transformApiConfigToForm still returns { setups: [] } in that case (via transformParserConfigSetups(undefined) → []), so Object.assign overwrites the DSL template's setups with an empty array — and normalizeOperatorForm then falls back to generic initialParserValues.setups instead of the pipeline's actual DSL defaults. This reproduces the exact bug the refactor set out to fix, just scoped to operators missing from a non-empty config map (e.g. a new pipeline step added after the dataset's parser config was last saved).

🐛 Proposed fix — check the specific operator entry, not the whole map
-  if (!isEmpty(pipelineParserConfig)) {
-    // user overrides from API (now also form format)
-    Object.assign(
-      rawForm,
-      transformApiConfigToForm(operatorType, pipelineParserConfig[operatorId]), // Convert API config to form format, then merge (DSL template is baseline, API overrides)
-    );
-  }
+  if (operatorId in pipelineParserConfig) {
+    // user overrides from API (now also form format)
+    Object.assign(
+      rawForm,
+      transformApiConfigToForm(operatorType, pipelineParserConfig[operatorId]), // Convert API config to form format, then merge (DSL template is baseline, API overrides)
+    );
+  }
🤖 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 `@web/src/pages/dataset/setting/utils.ts` around lines 274 - 306, Update
buildOperatorNode to apply API overrides only when pipelineParserConfig contains
a defined entry for the current operatorId, rather than when the overall map is
non-empty. Preserve the DSL-derived rawForm unchanged for operators without a
specific configuration, preventing transformApiConfigToForm from replacing their
defaults with empty values.
🤖 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.

Outside diff comments:
In `@web/src/pages/dataset/setting/utils.ts`:
- Around line 274-306: Update buildOperatorNode to apply API overrides only when
pipelineParserConfig contains a defined entry for the current operatorId, rather
than when the overall map is non-empty. Preserve the DSL-derived rawForm
unchanged for operators without a specific configuration, preventing
transformApiConfigToForm from replacing their defaults with empty values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2625791c-e10c-4ab1-92f3-3e1be2e5ed83

📥 Commits

Reviewing files that changed from the base of the PR and between cf95d9a and 62fdeb5.

📒 Files selected for processing (4)
  • web/src/interfaces/database/dataset.ts
  • web/src/pages/dataset/setting/hooks.ts
  • web/src/pages/dataset/setting/index.tsx
  • web/src/pages/dataset/setting/utils.ts

@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

🧹 Nitpick comments (2)
web/src/pages/datasets/dataset-creating-dialog.tsx (1)

145-150: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Replace the inline function call with the reactive boolean.

Following the hook refactor above, use the reactive isGo boolean here to ensure the component updates its render output correctly, and apply the renamed chunkMethodName variable.

♻️ Proposed refactor
         {parseType === ParseType.BuiltIn &&
-          (isGoBackend() ? (
-            <BuiltinPipelineItem name={ChunkMethodName} />
+          (isGo ? (
+            <BuiltinPipelineItem name={chunkMethodName} />
           ) : (
-            <ChunkMethodItem name={ChunkMethodName}></ChunkMethodItem>
+            <ChunkMethodItem name={chunkMethodName}></ChunkMethodItem>
           ))}
🤖 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 `@web/src/pages/datasets/dataset-creating-dialog.tsx` around lines 145 - 150,
Update the built-in parse-method rendering to use the reactive isGo boolean
instead of calling isGoBackend() inline, and replace ChunkMethodName with the
renamed chunkMethodName variable in both BuiltinPipelineItem and
ChunkMethodItem.
web/src/utils/backend-runtime.ts (1)

35-36: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Export a reactive hook for reading the backend language.

React components that read backendLanguage during render must subscribe to its changes to avoid stale UI if the value resolves asynchronously after the component mounts. Since subscribeBackendLanguage is already implemented, you can expose a reactive hook for components to use.

♻️ Proposed refactor
+import { useEffect, useState } from 'react';
+
 export const isGoBackend = (): boolean => backendLanguage === 'go';
+
+export const useIsGoBackend = (): boolean => {
+  const [isGo, setIsGo] = useState(isGoBackend());
+  
+  useEffect(() => {
+    return subscribeBackendLanguage(() => {
+      setIsGo(isGoBackend());
+    });
+  }, []);
+  
+  return isGo;
+};
🤖 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 `@web/src/utils/backend-runtime.ts` around lines 35 - 36, Export a reactive
hook alongside isGoBackend that reads backendLanguage through the existing
subscribeBackendLanguage mechanism, allowing React components to update when the
value changes asynchronously. Reuse the established backend-language store state
and subscription behavior rather than exposing only a non-reactive direct read.
🤖 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 `@web/src/pages/datasets/dataset-creating-dialog.tsx`:
- Around line 36-43: Update InputForm to use the reactive backend-language hook
instead of calling isGoBackend() directly, so it re-renders when the backend
language becomes available. Rename the local ChunkMethodName variable to
chunkMethodName and update all references in the Zod schema and default values.

---

Nitpick comments:
In `@web/src/pages/datasets/dataset-creating-dialog.tsx`:
- Around line 145-150: Update the built-in parse-method rendering to use the
reactive isGo boolean instead of calling isGoBackend() inline, and replace
ChunkMethodName with the renamed chunkMethodName variable in both
BuiltinPipelineItem and ChunkMethodItem.

In `@web/src/utils/backend-runtime.ts`:
- Around line 35-36: Export a reactive hook alongside isGoBackend that reads
backendLanguage through the existing subscribeBackendLanguage mechanism,
allowing React components to update when the value changes asynchronously. Reuse
the established backend-language store state and subscription behavior rather
than exposing only a non-reactive direct read.
🪄 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: b306a30d-e369-4335-a726-0f80d811f158

📥 Commits

Reviewing files that changed from the base of the PR and between 62fdeb5 and 6b4a0b1.

📒 Files selected for processing (3)
  • web/src/pages/dataset/compilation/index.tsx
  • web/src/pages/datasets/dataset-creating-dialog.tsx
  • web/src/utils/backend-runtime.ts

Comment on lines +36 to +43
import { isGoBackend } from '@/utils/backend-runtime';

const FormId = 'dataset-creating-form';

const ChunkMethodName = 'parser_id';

export function InputForm({ onOk }: IModalProps<any>) {
const { t } = useTranslation();
const defaultModelDictionary = useFetchDefaultModelDictionary();
const ChunkMethodName = isGoBackend() ? 'parser_id' : 'chunk_method';

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

Use a reactive hook for backend language and follow camelCase naming.

Calling isGoBackend() directly in the component body reads mutable global state without a subscription. If backendLanguage resolves after the component mounts, it will not re-render and will incorrectly display the non-Go backend fields. Use the reactive hook to properly subscribe to changes.

Additionally, use camelCase for the local variable ChunkMethodName. As per standard TS conventions and coding guidelines which reserve PascalCase for components and top-level constants, local variables should use camelCase.

🐛 Proposed fix (requires updating references in the file)
-import { isGoBackend } from '`@/utils/backend-runtime`';
+import { useIsGoBackend } from '`@/utils/backend-runtime`';

 const FormId = 'dataset-creating-form';

 export function InputForm({ onOk }: IModalProps<any>) {
   const { t } = useTranslation();
   const defaultModelDictionary = useFetchDefaultModelDictionary();
-  const ChunkMethodName = isGoBackend() ? 'parser_id' : 'chunk_method';
+  const isGo = useIsGoBackend();
+  const chunkMethodName = isGo ? 'parser_id' : 'chunk_method';

Ensure you also rename ChunkMethodName to chunkMethodName throughout InputForm's Zod schema and defaults.

🤖 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 `@web/src/pages/datasets/dataset-creating-dialog.tsx` around lines 36 - 43,
Update InputForm to use the reactive backend-language hook instead of calling
isGoBackend() directly, so it re-renders when the backend language becomes
available. Rename the local ChunkMethodName variable to chunkMethodName and
update all references in the Zod schema and default values.

Source: Coding guidelines

@wangq8
wangq8 merged commit c098c4c into infiniflow:main Jul 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants