Skip to content

fix: reject case-insensitive duplicate cross-encoder registrations - #795

Merged
joein merged 2 commits into
qdrant:mainfrom
wToTw123:codex/fix-reranker-case-registration
Oct 12, 2026
Merged

joein merged 2 commits into
qdrant:mainfrom
wToTw123:codex/fix-reranker-case-registration

Conversation

@wToTw123

@wToTw123 wToTw123 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

TextCrossEncoder.add_custom_model checks duplicate names case-sensitively, while model selection and description lookup compare lowercase names. Registering a case-only variant is accepted but resolves to the earlier entry, silently selecting its original source. Case-only aliases of built-in names are affected as well.

Use the same lowercase comparison during registration and raise the existing duplicate-name ValueError. Document that model names must be unique regardless of case. Tests cover built-in and custom names, four case variants, registry preservation on rejection, and actual lazy construction of distinct custom models with case-variant names and the expected sources. This aligns with the existing TextEmbedding.add_custom_model behavior rather than changing model lookup semantics.

Validation

  • Before the production fix: 6 failed, 3 passed in the new regression module.
  • After the fix: 20 passed, 5 deselected, including existing common/custom-model unit tests, with sockets disabled. The five deselected tests download and run models.
  • mypy: no issues in 66 source files; pyright: zero errors/warnings with the isolated interpreter.
  • Ruff 0.3.4 lint and format checks, plus git diff --check: passed.
  • Full downloaded-model suite, GPU runs and the full CI matrix were not run locally. Focused offline regressions are the alternative validation.

All Submissions

  • Followed the Contributing guidelines.
  • Checked all open PRs and related closed PRs for the same change as of 2026-10-09.

New-feature and new-model checklist items are not applicable to this bug fix. No pre-commit hook was installed for this uncommitted preview; its configured Ruff checks were run directly.

AI assistance: the patch and tests were prepared with Codex and reviewed and approved for submission by the contributor.

No separate issue has been opened.

Additional offline public-API verification: register differently cased names with different sources, then construct TextCrossEncoder with lazy_load and a local model path. The baseline accepts the alias but selects the first source; the patch rejects the duplicate and still constructs the original model correctly. No ONNX inference was run.

@wToTw123
wToTw123 requested a review from joein as a code owner October 9, 2026 09:43
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bfd9b2a6-5c26-42fb-9036-65cd5edcab7f

📥 Commits

Reviewing files that changed from the base of the PR and between 2a859a5 and a8dfe94.


📒 Files selected for processing (1)
  • tests/test_custom_models.py

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



📝 Walkthrough

Walkthrough

TextCrossEncoder.add_custom_model now checks for duplicate model names without regard to letter case. Tests verify that a custom model registered as Org/Model can be retrieved as org/model, and that case variants of built-in and custom names raise ValueError.

Priority: ⬇️ Low

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

Change: Bug fix


Merge Risk: ⚪ Minimal · up to a8dfe

No merge-blocking issue is identified; proceed with normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description clearly explains the case-insensitive duplicate-registration bug, the fix, affected behavior, tests, and validation results.
Title check Passed The title concisely and accurately identifies the main change: rejecting case-insensitive duplicate cross-encoder registrations.
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.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • 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

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

@joein joein left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for fixing this @wToTw123 !

@joein
joein merged commit d088990 into qdrant:main Oct 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants