Skip to content

Enhance UserQuery model with optional ids and is_blocked fields#406

Open
julietteceb16 wants to merge 2 commits into
mainfrom
feat/users-filter-by-ids-and-blocked
Open

Enhance UserQuery model with optional ids and is_blocked fields#406
julietteceb16 wants to merge 2 commits into
mainfrom
feat/users-filter-by-ids-and-blocked

Conversation

@julietteceb16
Copy link
Copy Markdown
Contributor

@julietteceb16 julietteceb16 commented May 29, 2026

Note

Low Risk
Additive optional fields on validation DTOs with list-size limits; no auth or persistence logic changed in this diff.

Overview
Extends shared query validation so API clients can filter by multiple user IDs and by blocked state.

QueryParams now accepts an optional ids list (capped at 100 entries, same as page size). UserQuery adds optional is_blocked. Downstream services that already use these Pydantic models can adopt the new filters without breaking existing fields. Tests cover max-length rejection, empty lists, and model_dump(exclude_none=True) behavior.

Package version is bumped to 2.1.35.dev2.

Reviewed by Cursor Bugbot for commit e4b8d52. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • User query can now filter by multiple user IDs and by blocked status, with validation to prevent overly large ID lists.
  • Tests

    • Added tests covering the new ID filtering and blocked-status flag, including validation, edge cases, and serialization behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3c6cfa68-1d1f-4c4f-844d-8ad33f1ccd28

📥 Commits

Reviewing files that changed from the base of the PR and between 3eb12ba and e4b8d52.

📒 Files selected for processing (3)
  • cuenca_validations/types/queries.py
  • cuenca_validations/version.py
  • tests/test_types.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • cuenca_validations/version.py
  • tests/test_types.py

Walkthrough

QueryParams now accepts an optional ids: Optional[list[str]] field constrained by MAX_PAGE_SIZE. UserQuery gains an optional is_blocked: Optional[bool] field. Tests were added to validate ids handling, size validation, empty-list acceptance, serialization behavior, and is_blocked exposure. The package version was bumped to 2.1.35.dev2.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: adding optional ids and is_blocked fields to the UserQuery model.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/users-filter-by-ids-and-blocked

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bb508a6) to head (e4b8d52).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #406   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         1474      1476    +2     
=========================================
+ Hits          1474      1476    +2     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cuenca_validations/types/queries.py 100.00% <100.00%> (ø)
cuenca_validations/version.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb508a6...e4b8d52. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread cuenca_validations/types/queries.py Outdated


class UserQuery(QueryParams):
ids: Optional[list[str]] = Field(default=None, max_length=MAX_PAGE_SIZE)
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.

Este va en QueryParams para que sea comun a todos.

@julietteceb16 julietteceb16 requested a review from rogelioLpz June 2, 2026 22:29
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