Skip to content

test(nlp): add pagination guard coverage for RetrievalService.Retrieval - #21557

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
zzy1017-crypto:test/retrieval-pagination
Oct 27, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
zzy1017-crypto:test/retrieval-pagination

Conversation

@zzy1017-crypto

Copy link
Copy Markdown
Contributor

Summary

Add package-level tests for the rerank pagination guards in RetrievalService.Retrieval. Neither guard had direct coverage: the only existing page-related unit test asserted the candidate-set slicing, and the REST suite exercised only the unknown-rerank_id failure, so the page != 1 rejection in retrieval.go:146 was never reached.

The three tests mirror Python 0.27.x's test/unit_test/rag/test_search_pagination.py: one verifies that a non-nil RerankModel with page=2 (inside the candidates window) is rejected with "Pagination is not supported"; a second pins the ordering contract that the rerank_candidates_count guard wins over the pagination guard when page*page_size overflows the window; and a third asserts the page=1 positive path still reaches the cross-encoder via captureDriver. No production code changes.

REST-level coverage of the resolved-rerank-model path is intentionally omitted: Python 0.27.x never carried a page+rerank combination at that layer either.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0eb1a2cc-886d-4455-8180-672cbdeedb1f
Commits

Reviewing files that changed from the base of the PR and between f39b66e and a93912a.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 122d3de3-8c7a-46ec-9226-8f7d4999cec8
Commits

Reviewing files that changed from the base of the PR and between 580b844 and f39b66e.

Files selected for processing: 1
  • internal/service/nlp/retrieval_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

This change adds retrieval tests for rerank pagination rejection, validation guard precedence, and successful reranking on page one.

Changes: Rerank pagination test coverage

Layer / File(s) Summary
Retrieval guard and reranking coverage
internal/service/nlp/retrieval_test.go
Adds tests for pagination rejection when reranking is configured, missing rerank_candidates_count guard precedence, and page-one retrieval passing one document to the reranker.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related PRs

Suggested reviewers: wangq8, qinling0210, 6ba3i

Merge Risk: Minimal · previous review f39b6

The change adds retrieval tests without an identified merge-blocking issue.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title is a conventional-commit style summary that names the scope (nlp), the type (test), and the specific subject (pagination guard coverage for RetrievalService.Retrieval). The raw summary and o…
Description check Passed The description has a Summary section, which is the only heading in the template. It explains the purpose and background: the rerank pagination guards lacked direct coverage, the page != 1 rejection w…
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.
Full details: Title check

Explanation

The title is a conventional-commit style summary that names the scope (nlp), the type (test), and the specific subject (pagination guard coverage for RetrievalService.Retrieval). The raw summary and objectives confirm the changeset adds three package-level tests for the rerank pagination guards and makes no production changes, so the title matches the main change.

Full details: Description check

Explanation

The description has a Summary section, which is the only heading in the template. It explains the purpose and background: the rerank pagination guards lacked direct coverage, the page != 1 rejection was never reached, and the three tests mirror a Python 0.27.x test file. It also states that no production code changes. The template asks only for a brief summary with background context, and the author provides both, so the description is mostly complete.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 1 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks page one with care,
Then asks if reranking can go there.
Page two receives a guarded no,
Missing counts take precedence, so.
One document joins the reranker’s queue,
The tests record what it should do.

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

@zzy1017-crypto zzy1017-crypto added the ci Continue Integration label Oct 27, 2026
@zzy1017-crypto
zzy1017-crypto requested a balanced review from Copilot October 27, 2026 09:46

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@wangq8
wangq8 merged commit 1e6c3e1 into infiniflow:main Oct 27, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants