Skip to content

Untagged Enum for FeedbackStrategy - #8171

Merged
generall merged 2 commits into
devfrom
fix-rest-api-for-feedback-strategy
Feb 18, 2026
Merged

generall merged 2 commits into
devfrom
fix-rest-api-for-feedback-strategy

Conversation

@generall

Copy link
Copy Markdown
Member

Should fix python client generation

@generall
generall requested a review from joein February 18, 2026 11:55
coderabbitai[bot]

This comment was marked as resolved.

@qdrant qdrant deleted a comment from coderabbitai Bot Feb 18, 2026
@coderabbitai

coderabbitai Bot commented Feb 18, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This pull request refactors the FeedbackStrategy schema structure across multiple layers. The OpenAPI schema extracts NaiveFeedbackStrategy and NaiveFeedbackStrategyParams as separate schema definitions instead of embedding them inline. Correspondingly, the Rust implementation changes FeedbackStrategy serialization from snake_case to untagged and wraps NaiveFeedbackStrategy parameters in a nested field. The From trait conversion is updated to destructure the new nested structure, and test assertions are adjusted to expect the updated nested error path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Untagged Enum for FeedbackStrategy' directly describes the main technical change: converting FeedbackStrategy from snake_case to an untagged enum serialization approach.
Description check ✅ Passed The description 'Should fix python client generation' is related to the changeset, as the commit messages indicate the untagged enum change was specifically made to address Python client generation issues.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-rest-api-for-feedback-strategy

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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 and usage tips.

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

🧹 Nitpick comments (2)
lib/api/src/rest/schema.rs (1)

914-920: Consider adding doc comments to NaiveFeedbackStrategyParams

The new public struct and its fields lack documentation. Comparable nearby types (Mmr, Rrf, etc.) carry per-field doc comments.

📝 Suggested doc comments
+/// Coefficients for the naive feedback scoring formula.
 #[derive(Debug, Serialize, Deserialize, JsonSchema, Validate)]
 pub struct NaiveFeedbackStrategyParams {
+    /// Score scaling coefficient for positive feedback.
     pub a: f32,
+    /// Score scaling coefficient; must be non-negative.
     #[validate(range(min = 0.0))]
     pub b: f32,
+    /// Offset coefficient.
     pub c: f32,
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/api/src/rest/schema.rs` around lines 914 - 920, The public struct
NaiveFeedbackStrategyParams and its fields (NaiveFeedbackStrategyParams, a, b,
c) lack documentation; add doc comments for the struct and each field matching
style of nearby types (e.g., Mmr, Rrf) describing what the struct represents and
what each parameter controls/units/constraints (noting that b has a validation
range), so code consumers and generated docs are informative and consistent.
tests/openapi/test_relevance_feedback.py (1)

61-82: Consider adding coverage for a and c range constraints.

Only b (must be ≥ 0) has a dedicated negative-value test. If a and c also carry range constraints (e.g., c between 0–1), a quick extra assertion per parameter would guard against silent regressions in those validators.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/openapi/test_relevance_feedback.py` around lines 61 - 82, Add negative
tests for the remaining relevance_feedback parameters by invoking
request_with_validation against the same endpoint
("/collections/{collection_name}/points/query") with modified body values for
"a" and "c" that violate their expected ranges and assert the response is not ok
and that response.json()["status"]["error"] contains the corresponding
validation message; replicate the pattern used for "b" (the existing negative
test using a=-1.0) but send an out-of-range value for "a" (e.g., below its
minimum) and for "c" (e.g., outside 0–1 if that is the constraint) and assert
the error text references internal.query.relevance_feedback.strategy.naive.a and
...naive.c respectively so regressions in those validators are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@lib/api/src/rest/schema.rs`:
- Around line 914-920: The public struct NaiveFeedbackStrategyParams and its
fields (NaiveFeedbackStrategyParams, a, b, c) lack documentation; add doc
comments for the struct and each field matching style of nearby types (e.g.,
Mmr, Rrf) describing what the struct represents and what each parameter
controls/units/constraints (noting that b has a validation range), so code
consumers and generated docs are informative and consistent.

In `@tests/openapi/test_relevance_feedback.py`:
- Around line 61-82: Add negative tests for the remaining relevance_feedback
parameters by invoking request_with_validation against the same endpoint
("/collections/{collection_name}/points/query") with modified body values for
"a" and "c" that violate their expected ranges and assert the response is not ok
and that response.json()["status"]["error"] contains the corresponding
validation message; replicate the pattern used for "b" (the existing negative
test using a=-1.0) but send an out-of-range value for "a" (e.g., below its
minimum) and for "c" (e.g., outside 0–1 if that is the constraint) and assert
the error text references internal.query.relevance_feedback.strategy.naive.a and
...naive.c respectively so regressions in those validators are caught.

@generall
generall merged commit 6e79f8b into dev Feb 18, 2026
20 of 21 checks passed
@generall
generall deleted the fix-rest-api-for-feedback-strategy branch February 18, 2026 15:55
timvisee pushed a commit that referenced this pull request Feb 18, 2026
* [manual] make untagged enum for consistent API for FeedbackStrategy

* add #[validate(nested)]

---------

Co-authored-by: Luis Cossío <[email protected]>
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* [manual] make untagged enum for consistent API for FeedbackStrategy

* add #[validate(nested)]

---------

Co-authored-by: Luis Cossío <[email protected]>
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