Repository navigation
Fix: delete tasklet - #16778
Fix: delete tasklet#16778
Conversation
1. e2e - execute pipeline to parse pdf file and save chunks to ES 2. chunks can be retrieved for using in chat
📝 WalkthroughWalkthroughIngestion tasklet support is removed: the ChangesIngestion Tasklet Removal and Chunk Text Error Handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
internal/ingestion/task/chunk_process_test.go (1)
264-267: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the malformed-text outcome, not only non-nil metadata.
This check would pass for any non-nil input because
ProcessChunksForDataflowinitializesmetadata. Add an assertion for the intended malformed-text behavior, especially the generated/omittedid.🤖 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/chunk_process_test.go` around lines 264 - 267, The current test for ProcessChunksForDataflow only verifies that metadata is non-nil, which can pass even when malformed-text handling is wrong. Update the assertion to check the intended malformed-text outcome in the result from ProcessChunksForDataflow, especially the generated or omitted id in the returned metadata, so the test validates the actual behavior instead of just initialization.internal/ingestion/task/chunk_utils.go (1)
133-135: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename or unexport
MustGetChunkTextStringIt no longer has “must” semantics, and all call sites are package-local.
getChunkTextStringorchunkTextStringfits better.🤖 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/chunk_utils.go` around lines 133 - 135, Rename MustGetChunkTextString to a package-local name such as getChunkTextString or chunkTextString in chunk_utils.go, and update every internal caller accordingly. The function no longer has strict “must” behavior and is only used within the package, so remove the exported/public naming convention and keep the same string-extraction behavior while preserving the existing error handling contract.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/chunk_process.go`:
- Around line 150-154: The chunk ID generation in MustGetChunkTextString
handling is using an empty text value after extraction failures, which can
collapse multiple malformed chunks onto the same ChunkID in the same document.
Update the chunk processing logic in the chunk_process flow to either skip/drop
chunks when MustGetChunkTextString returns an error or assign a deterministic
per-chunk fallback before setting ck["id"]. Make sure the fix is applied around
the code that computes ChunkID(text, docID) so failed text extraction never
produces a shared empty-text ID.
In `@internal/ingestion/task/chunk_utils.go`:
- Around line 145-147: The type-error path in chunk text handling is logging
sensitive chunk contents via the current message in the chunk text validation
logic. Update the chunk validation in the relevant helper in chunk_utils.go to
stop including the full chunk in the error message, return a typed error from
the chunk text type check instead, and let the caller’s existing error
handling/logging decide what to emit. Keep the message focused on the invalid
text type and preserve the existing common.Error flow only for the non-sensitive
error details.
---
Nitpick comments:
In `@internal/ingestion/task/chunk_process_test.go`:
- Around line 264-267: The current test for ProcessChunksForDataflow only
verifies that metadata is non-nil, which can pass even when malformed-text
handling is wrong. Update the assertion to check the intended malformed-text
outcome in the result from ProcessChunksForDataflow, especially the generated or
omitted id in the returned metadata, so the test validates the actual behavior
instead of just initialization.
In `@internal/ingestion/task/chunk_utils.go`:
- Around line 133-135: Rename MustGetChunkTextString to a package-local name
such as getChunkTextString or chunkTextString in chunk_utils.go, and update
every internal caller accordingly. The function no longer has strict “must”
behavior and is only used within the package, so remove the exported/public
naming convention and keep the same string-extraction behavior while preserving
the existing error handling contract.
🪄 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: e5b99c2b-55f0-49f2-8e56-0aab8e4af861
📒 Files selected for processing (10)
internal/common/task.gointernal/dao/database.gointernal/dao/ingestion.gointernal/entity/ingestion_task.gointernal/ingestion/pipeline/template_integration_test.gointernal/ingestion/service/ingestion_service.gointernal/ingestion/task/chunk_process.gointernal/ingestion/task/chunk_process_test.gointernal/ingestion/task/chunk_utils.gointernal/ingestion/task/chunk_utils_test.go
💤 Files with no reviewable changes (2)
- internal/dao/database.go
- internal/entity/ingestion_task.go
| text, err := MustGetChunkTextString(ck) | ||
| if err != nil { | ||
| common.Error("unexpected error", err) | ||
| } | ||
| ck["id"] = ChunkID(text, docID) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Avoid generating chunk IDs from failed text extraction.
When MustGetChunkTextString returns an error, text remains "", so every malformed id-less chunk in the same document can collapse to ChunkID("", docID). Skip/drop malformed chunks or use an explicit deterministic per-chunk fallback before assigning ck["id"].
🤖 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/chunk_process.go` around lines 150 - 154, The chunk
ID generation in MustGetChunkTextString handling is using an empty text value
after extraction failures, which can collapse multiple malformed chunks onto the
same ChunkID in the same document. Update the chunk processing logic in the
chunk_process flow to either skip/drop chunks when MustGetChunkTextString
returns an error or assign a deterministic per-chunk fallback before setting
ck["id"]. Make sure the fix is applied around the code that computes
ChunkID(text, docID) so failed text extraction never produces a shared
empty-text ID.
| msg := fmt.Sprintf("invalid chunk text type %T, expected string, chunk=%v", val, chunk) | ||
| err := fmt.Errorf("unexpected chunk text type - not string") | ||
| common.Error(msg, err) |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Do not log the whole chunk on type errors.
chunk=%v can expose ingested document text/metadata, and callers already log the returned error. Return a typed error here and let callers decide what to log.
Proposed fix
- msg := fmt.Sprintf("invalid chunk text type %T, expected string, chunk=%v", val, chunk)
- err := fmt.Errorf("unexpected chunk text type - not string")
- common.Error(msg, err)
- return "", err
+ return "", fmt.Errorf("invalid chunk text type %T, expected string", val)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| msg := fmt.Sprintf("invalid chunk text type %T, expected string, chunk=%v", val, chunk) | |
| err := fmt.Errorf("unexpected chunk text type - not string") | |
| common.Error(msg, err) | |
| return "", fmt.Errorf("invalid chunk text type %T, expected string", val) |
🤖 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/chunk_utils.go` around lines 145 - 147, The
type-error path in chunk text handling is logging sensitive chunk contents via
the current message in the chunk text validation logic. Update the chunk
validation in the relevant helper in chunk_utils.go to stop including the full
chunk in the error message, return a typed error from the chunk text type check
instead, and let the caller’s existing error handling/logging decide what to
emit. Keep the message focused on the invalid text type and preserve the
existing common.Error flow only for the non-sensitive error details.
Summary