Skip to content

Feat/max age validation - #417

Open
gmorales96 wants to merge 3 commits into
mainfrom
feat/max-age-validation
Open

Feat/max age validation#417
gmorales96 wants to merge 3 commits into
mainfrom
feat/max-age-validation

Conversation

@gmorales96

@gmorales96 gmorales96 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Age validation now enforces an inclusive 18–99 range, rejecting users whose computed age is above 99 (in addition to rejecting under-18).
  • Tests
    • Added unit tests for the age validator, including a valid case and an overage rejection scenario.
    • Adjusted date-of-birth test fixtures to ensure validation scenarios target the intended errors.
  • Chores
    • Updated the package version to 2.1.40.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Age validation now rejects computed ages below 18 or above 99 while preserving the existing error message and successful return value. Tests update related birth-date fixtures and add frozen-time cases for overage rejection and valid input. The package version is incremented to 2.1.40.

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

Suggested reviewers: rcabrera-py

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a maximum age validation rule.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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/max-age-validation

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

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #417   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         1510      1510           
=========================================
  Hits          1510      1510           
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/helpers.py 100.00% <100.00%> (ø)
cuenca_validations/version.py 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Harness.

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

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

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

🧹 Nitpick comments (1)
tests/test_types.py (1)

510-520: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the inclusive age boundaries.

Add cases for exactly 18 and 99 years old (for example, July 27, 2008 and July 27, 1927 under the existing frozen date) to lock in the new boundary contract.

🤖 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 `@tests/test_types.py` around lines 510 - 520, Extend the
validate_age_requirement tests with cases for users exactly 18 and exactly 99
years old under the existing 2026-07-27 freeze. Use July 27, 2008 and July 27,
1927, and assert both dates are accepted and returned unchanged, preserving the
inclusive age boundaries.
🤖 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 `@tests/test_types.py`:
- Line 496: Update the stale comment near the request date-of-birth setup to
state that the date represents a valid age and that the test is verifying the
missing state_of_birth error, while leaving the test data unchanged.

---

Nitpick comments:
In `@tests/test_types.py`:
- Around line 510-520: Extend the validate_age_requirement tests with cases for
users exactly 18 and exactly 99 years old under the existing 2026-07-27 freeze.
Use July 27, 2008 and July 27, 1927, and assert both dates are accepted and
returned unchanged, preserving the inclusive age boundaries.
🪄 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: 5aa07abf-532b-4441-b313-f798ea5f5059

📥 Commits

Reviewing files that changed from the base of the PR and between e5b3765 and 3e11545.

📒 Files selected for processing (3)
  • cuenca_validations/types/helpers.py
  • cuenca_validations/version.py
  • tests/test_types.py

Comment thread tests/test_types.py

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/test_types.py (1)

510-522: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add tests for the inclusive age boundaries.

The new tests cover overage and an interior valid age, but not exactly 18 or 99. Add frozen-time cases for 1927-07-27 (99) and 2008-07-27 (18) to verify both limits remain accepted.

🤖 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 `@tests/test_types.py` around lines 510 - 522, Extend the age validation tests
around validate_age_requirement with frozen-time cases for birth dates
1927-07-27 and 2008-07-27, asserting both return the original date without
raising. Keep the existing overage and interior valid-age tests unchanged.
🤖 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.

Outside diff comments:
In `@tests/test_types.py`:
- Around line 510-522: Extend the age validation tests around
validate_age_requirement with frozen-time cases for birth dates 1927-07-27 and
2008-07-27, asserting both return the original date without raising. Keep the
existing overage and interior valid-age tests unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 385db5c7-de85-403c-8d9e-029815d02c24

📥 Commits

Reviewing files that changed from the base of the PR and between 3e11545 and fcdd997.

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

@gmorales96
gmorales96 requested a review from rogelioLpz July 28, 2026 15:26
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.

1 participant