Skip to content

Fix: delete tasklet - #16778

Merged
yingfeng merged 7 commits into
infiniflow:mainfrom
xugangqiang:feat/del-tasklet
Jul 9, 2026
Merged

yingfeng merged 7 commits into
infiniflow:mainfrom
xugangqiang:feat/del-tasklet

Conversation

@xugangqiang

Copy link
Copy Markdown
Contributor

Summary

  1. Fix: delete tasklet
  2. Remove panic in text processing

1. e2e - execute pipeline to parse pdf file and save chunks to ES
2. chunks can be retrieved for using in chat
@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Ingestion tasklet support is removed: the TaskTypeIngestionTasklet constant, IngestionTasklet/IngestionTaskletLog entities, their DAOs, and Tasklets fields from TaskInfo are deleted. MustGetChunkTextString now returns errors instead of panicking, with callers updated accordingly. Ack failure handling changed, and a test helper was renamed.

Changes

Ingestion Tasklet Removal and Chunk Text Error Handling

Layer / File(s) Summary
Task type and entity model removal
internal/common/task.go, internal/dao/database.go, internal/entity/ingestion_task.go
TaskTypeIngestionTasklet constant removed; IngestionTasklet/IngestionTaskletLog entities removed and dropped from auto-migration list.
Ingestion DAO and TaskInfo cleanup
internal/dao/ingestion.go
TaskletInfo/Tasklets removed from TaskInfo; tasklet fetching/aggregation removed from RemoveByAPIServerOrAdminServer; IngestionTaskletDAO/IngestionTaskletLogDAO types and methods deleted.
Ingestor DAO fields and Ack error handling
internal/ingestion/service/ingestion_service.go
ingestionTaskletDAO/ingestionTaskletLogDAO fields and their initialization removed; terminal-state Ack failure now logs and returns instead of issuing a Nack.
MustGetChunkTextString error-returning rewrite
internal/ingestion/task/chunk_utils.go, internal/ingestion/task/chunk_process.go
MustGetChunkTextString changed from panic-on-invalid-type to returning (string, error); callers in PrepareTextsForDataflowEmbedding and ProcessChunksForDataflow updated to log errors and continue; imports reordered.
Tests for no-panic text extraction and Ack
internal/ingestion/task/chunk_process_test.go, internal/ingestion/task/chunk_utils_test.go
Panic-expecting tests replaced with non-panic/error-based assertions; output-length guards added before indexing results.
Tokenizer pool helper rename in integration tests
internal/ingestion/pipeline/template_integration_test.go
requireTokenizerPool(t) calls renamed to RequireTokenizerPool(t) across all template integration tests.

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

Possibly related PRs

  • infiniflow/ragflow#15327: Introduced the tasklet types/fields/DAOs for ingestion-task lifecycle that this PR removes.
  • infiniflow/ragflow#16549: Also modifies MustGetChunkTextString and downstream ProcessChunksForDataflow/embedding text handling.

Poem

A tasklet hops away for good,
No more panics in the wood 🌲,
Errors now return with grace,
Ack and log at their own pace.
Tokenizer pools renamed with care —
This rabbit thumps, the code is fair! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.00% 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 accurately reflects the main change: removing tasklet-related functionality.
Description check ✅ Passed The description includes the required Summary section and covers the main changes, though it is brief and lacks extra context.

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.

@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 08:43
@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 9, 2026
@xugangqiang
xugangqiang marked this pull request as draft July 9, 2026 08:45
@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 08:45

@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: 2

🧹 Nitpick comments (2)
internal/ingestion/task/chunk_process_test.go (1)

264-267: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert the malformed-text outcome, not only non-nil metadata.

This check would pass for any non-nil input because ProcessChunksForDataflow initializes metadata. Add an assertion for the intended malformed-text behavior, especially the generated/omitted 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_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 win

Rename or unexport MustGetChunkTextString

It no longer has “must” semantics, and all call sites are package-local. getChunkTextString or chunkTextString fits 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

📥 Commits

Reviewing files that changed from the base of the PR and between b29a4a6 and 98f6bec.

📒 Files selected for processing (10)
  • internal/common/task.go
  • internal/dao/database.go
  • internal/dao/ingestion.go
  • internal/entity/ingestion_task.go
  • internal/ingestion/pipeline/template_integration_test.go
  • internal/ingestion/service/ingestion_service.go
  • internal/ingestion/task/chunk_process.go
  • internal/ingestion/task/chunk_process_test.go
  • internal/ingestion/task/chunk_utils.go
  • internal/ingestion/task/chunk_utils_test.go
💤 Files with no reviewable changes (2)
  • internal/dao/database.go
  • internal/entity/ingestion_task.go

Comment on lines +150 to 154
text, err := MustGetChunkTextString(ck)
if err != nil {
common.Error("unexpected error", err)
}
ck["id"] = ChunkID(text, docID)

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.

🗄️ 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.

Comment on lines +145 to +147
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)

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.

🔒 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.

Suggested change
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.

@xugangqiang
xugangqiang marked this pull request as draft July 9, 2026 08:59
@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 08:59
@xugangqiang
xugangqiang marked this pull request as draft July 9, 2026 09:00
@xugangqiang
xugangqiang marked this pull request as ready for review July 9, 2026 09:00
@xugangqiang xugangqiang added the ci Continue Integration label Jul 9, 2026
@yingfeng
yingfeng merged commit 8bd6257 into infiniflow:main Jul 9, 2026
24 checks passed
@xugangqiang
xugangqiang deleted the feat/del-tasklet branch August 7, 2026 12:26
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 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