Skip to content

fix: validate ParentIDKey is non-empty in NewIndexer#953

Open
kuishou68 wants to merge 1 commit into
cloudwego:mainfrom
kuishou68:fix/issue-952-validate-parent-id-key
Open

fix: validate ParentIDKey is non-empty in NewIndexer#953
kuishou68 wants to merge 1 commit into
cloudwego:mainfrom
kuishou68:fix/issue-952-validate-parent-id-key

Conversation

@kuishou68
Copy link
Copy Markdown

Closes #952

Problem

In flow/indexer/parent/parent.go, NewIndexer validates Indexer, Transformer, and SubIDGenerator fields but silently accepts an empty ParentIDKey. When ParentIDKey is empty, Store() silently writes every parent document ID to the "" metadata key, making the parent-child relationship unresolvable for all consumers.

Fix

Added a validation check for config.ParentIDKey == "" in NewIndexer, consistent with the existing field validation pattern.

Testing

Passing empty ParentIDKey to NewIndexer now returns an error at construction time instead of silently corrupting data at runtime.

Signed-off-by: Cocoon-Break <54054995+kuishou68@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 13, 2026

CLA assistant check
All committers have signed the CLA.

@shentongmartin shentongmartin added C-bugfix Category: This is a PR that fixes a bug. D-integration Domain: This is an issue related to 3rd party service integrations, excluding LLM providers labels Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bugfix Category: This is a PR that fixes a bug. D-integration Domain: This is an issue related to 3rd party service integrations, excluding LLM providers

Development

Successfully merging this pull request may close these issues.

bug: missing validation for empty ParentIDKey in flow/indexer/parent and flow/retriever/parent

3 participants