Skip to content

Conversation

@JadeCara
Copy link
Contributor

@JadeCara JadeCara commented Dec 10, 2025

Ticket ENG-2206

Description Of Changes

Fixed a logic error which caused country to sometimes be None

Code Changes

  • Checks if location is country and returns that value.

Steps to Confirm

  1. Test along with Manual task conditions improvements #7101 Run FidesPlus pointed at this branch
  2. create a Manual Task condition which has a location country equals or starts with and pick a known problematic country (We found both Portugal and Argentina but I am sure lots will work for this)
Screenshot 2025-12-11 at 12 05 53 PM Screenshot 2025-12-11 at 12 06 06 PM Screenshot 2025-12-11 at 12 06 21 PM
  1. In the privacy center Create a Privacy request setting your location to that place. It should create a manual task
Screenshot 2025-12-11 at 12 05 14 PM Screenshot 2025-12-11 at 12 07 06 PM
  1. In the privacy center: Create a Privacy request setting your location to somewhere else. It should skip the manual task and continue or complete.
Screenshot 2025-12-11 at 12 05 30 PM Screenshot 2025-12-11 at 12 07 02 PM

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link

vercel bot commented Dec 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Dec 11, 2025 4:05pm
fides-privacy-center Ignored Ignored Dec 11, 2025 4:05pm

@JadeCara JadeCara marked this pull request as ready for review December 10, 2025 20:37
@JadeCara JadeCara requested a review from a team as a code owner December 10, 2025 20:37
@JadeCara JadeCara requested review from vcruces and removed request for a team December 10, 2025 20:37
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 10, 2025

Greptile Overview

Greptile Summary

Fixed a logic bug in get_location_convenience_fields where location_country was incorrectly set to None for country-level locations (e.g., France). The old logic only set location_country for subdivisions with parents, missing the case where the location itself is already a country.

Key Changes:

  • Added explicit handling for location_data.is_country to return the country's normalized ID
  • Improved code comments to clarify the two distinct cases
  • Updated test assertion to expect correct behavior (country code 'fr' instead of None)

This fix ensures conditional dependencies based on country codes work correctly for both subdivisions (e.g., US-CA → 'us') and countries (e.g., FR → 'fr').

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix is straightforward, well-tested, and addresses a clear logic bug. The change explicitly handles both country and subdivision cases with improved clarity. Existing test coverage validates the fix and no edge cases are missed.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/fides/api/task/conditional_dependencies/privacy_request/convenience_fields.py 5/5 Fixed logic bug where location_country was None for country-level locations; now correctly returns the country code for both countries and subdivisions
tests/api/task/conditional_dependencies/privacy_request/test_privacy_request_data.py 5/5 Updated test assertion to expect correct country code ('fr') instead of None for country-level locations

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.31%. Comparing base (44d6566) to head (342df34).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...dependencies/privacy_request/convenience_fields.py 83.33% 0 Missing and 2 partials ⚠️

❌ Your patch status has failed because the patch coverage (84.61%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7103      +/-   ##
==========================================
- Coverage   87.31%   87.31%   -0.01%     
==========================================
  Files         532      532              
  Lines       34970    34982      +12     
  Branches     4048     4051       +3     
==========================================
+ Hits        30533    30543      +10     
  Misses       3560     3560              
- Partials      877      879       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JadeCara JadeCara requested a review from a team as a code owner December 11, 2025 11:57
@JadeCara JadeCara requested review from jpople and removed request for a team December 11, 2025 11:57
@JadeCara JadeCara changed the base branch from ENG-2014-Feedback to main December 11, 2025 11:58
Jade Wibbels added 2 commits December 11, 2025 11:58
Copy link
Contributor

@vcruces vcruces left a comment

Choose a reason for hiding this comment

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

The code looks great! Thanks for adding tests!

extra_fields[
PrivacyRequestLocationConvenienceFields.location_regulations.value
] = (location_data.regulation or [])
return extra_fields
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a small detail, but I don’t think this return is needed, it looks like line 164 will return the same value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep! good call, updating :)

@JadeCara JadeCara enabled auto-merge December 11, 2025 16:37
@JadeCara JadeCara added this pull request to the merge queue Dec 11, 2025
Merged via the queue into main with commit a9b9ccc Dec 11, 2025
68 of 69 checks passed
@JadeCara JadeCara deleted the nested_field_error branch December 11, 2025 17:16
JadeCara added a commit that referenced this pull request Dec 11, 2025
Co-authored-by: Lucano Vera <lucanovera@live.com.ar>
Co-authored-by: Jade Wibbels <jade@ethyca.com>
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.

4 participants