Skip to content

Conversation

@JadeCara
Copy link
Contributor

@JadeCara JadeCara commented Nov 18, 2025

Ticket ENG-1290

Description Of Changes

🎯 As a user, I want to specify conditions that must be true to create manual tasks, which check the request data, so that I can create tasks conditionally based on data in the request.

This PR adds convenience columns for adding privacy request conditional dependencies. As well as a small refactor moving a function to improve re-usability.

  • Convenience cols: These are derived values that will make adding conditions a lot easier. An example: has_access_rule which is a boolean for evaluation. There is not a clear indicator on our models because policies can have multiple rules. If we just want this to run on policies with access then we can use privacy_request.policy.has_access_rule: True and if we want to exclude the ones with consent rules from that set privacy_request.policy.has_consent_rule: False
  • Updated and moved the extract_nested_value function. It can now be used on more things than dictionaries including objects and lists. It is now in the conditional_dependencies utils so multiple files can use it
  • Added util.py file with a set_nested_value function that is used in [ENG-1290] Privacy Request Fields #6984 and in fidesplus PR #2814

Code Changes

  • src/fides/api/task/conditional_dependencies/schemas.py- new class ConditionalDependencyFieldInfo
  • new src/fides/api/task/conditional_dependencies/privacy_request/convenience_fields.py
  • new src/fides/api/task/conditional_dependencies/privacy_request/util.py
  • updated src/fides/api/task/manual/manual_task_conditional_evaluation.py to use new function from utils
  • new src/fides/api/task/conditional_dependencies/util.py includes the refactored nested column function

Note: There are many tests for convenience cols and set_nested_value in the next PR #6984 where they are actually used.

Steps to Confirm

  1. Most of the changes are net new and not hooked up to anything. The only change that impacts production code is around manual tasks. Try creating several manual tasks that rely on conditional dependencies to verify they still create as expected.

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 Nov 18, 2025

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

Project Deployment Preview Comments Updated (UTC)
fides-plus-nightly Ready Ready Preview Comment Nov 24, 2025 8:05pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
fides-privacy-center Ignored Ignored Nov 24, 2025 8:05pm

@JadeCara JadeCara changed the title Eng 1290 convenience fields [ENG-1290] convenience fields Nov 18, 2025
@JadeCara JadeCara marked this pull request as ready for review November 18, 2025 20:17
@JadeCara JadeCara requested a review from a team as a code owner November 18, 2025 20:17
@JadeCara JadeCara requested review from erosselli and removed request for a team November 18, 2025 20:17
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 18, 2025

Greptile Overview

Greptile Summary

This PR adds convenience fields for privacy request conditional dependencies and refactors the extract_nested_field_value utility function for better reusability.

Key changes:

  • New convenience fields added for policy evaluation (has_access_rule, has_erasure_rule, rule_count, etc.) making conditional logic easier to write
  • Refactored extract_nested_field_value to support objects, dicts, and lists - moved to shared util module for reuse across files
  • Added set_nested_value utility function for creating nested dictionaries
  • Added eager loading of policy.rules, provided_identities, and custom_fields in get_privacy_request_and_task() to prevent N+1 query issues during manual task execution
  • Removed duplicate implementation of extract_nested_field_value from manual_task_conditional_evaluation.py

All changes are net-new infrastructure with minimal impact on existing code. The only production code change is in manual task conditional evaluation, which now uses the refactored utility function.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are primarily net-new code that isn't hooked up to production yet. The refactoring of extract_nested_field_value is a straightforward improvement, and the eager loading optimization follows SQLAlchemy best practices. Code is well-structured and type-annotated.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/fides/api/task/conditional_dependencies/privacy_request/init.py 5/5 Empty module initialization file - safe
src/fides/api/task/conditional_dependencies/privacy_request/convenience_fields.py 5/5 Adds convenience fields for policy rules - logic is straightforward and uses existing Policy method get_all_action_types()
src/fides/api/task/conditional_dependencies/privacy_request/schemas.py 5/5 Defines field enums and validation schemas for conditional dependencies - well-structured with proper validation
src/fides/api/task/conditional_dependencies/util.py 5/5 Utility functions for extracting and setting nested values - properly handles objects, dicts, and lists
src/fides/api/task/execute_request_tasks.py 5/5 Added eager loading for policy.rules, provided_identities, and custom_fields to optimize N+1 queries - good performance improvement
src/fides/api/task/manual/manual_task_conditional_evaluation.py 5/5 Refactored to use extract_nested_field_value from util module, removed duplicate implementation

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.

5 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 10.00000% with 108 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.03%. Comparing base (05842e4) to head (5990db6).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...onditional_dependencies/privacy_request/schemas.py 0.00% 73 Missing ⚠️
...dependencies/privacy_request/convenience_fields.py 0.00% 18 Missing ⚠️
...rc/fides/api/task/conditional_dependencies/util.py 34.61% 14 Missing and 3 partials ⚠️

❌ Your patch status has failed because the patch coverage (10.00%) 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    #6995      +/-   ##
==========================================
- Coverage   87.30%   87.03%   -0.28%     
==========================================
  Files         525      528       +3     
  Lines       34558    34668     +110     
  Branches     3993     4005      +12     
==========================================
+ Hits        30172    30174       +2     
- Misses       3515     3620     +105     
- Partials      871      874       +3     

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

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
JadeCara and others added 2 commits November 18, 2025 13:23
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@JadeCara JadeCara marked this pull request as draft November 19, 2025 16:57
@JadeCara JadeCara marked this pull request as ready for review November 19, 2025 18:06
@JadeCara JadeCara requested a review from erosselli November 24, 2025 16:30
@JadeCara
Copy link
Contributor Author

@greptile please review

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.

6 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@erosselli erosselli left a comment

Choose a reason for hiding this comment

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

thanks for making the changes. not sure if this one needs a changelog?

@JadeCara
Copy link
Contributor Author

thanks for making the changes. not sure if this one needs a changelog?
I will add one :D

@JadeCara JadeCara enabled auto-merge November 24, 2025 19:23
@JadeCara JadeCara added this pull request to the merge queue Nov 24, 2025
@JadeCara JadeCara removed this pull request from the merge queue due to a manual request Nov 24, 2025
@JadeCara JadeCara added this pull request to the merge queue Nov 24, 2025
Merged via the queue into main with commit c8a72f9 Nov 24, 2025
68 of 69 checks passed
@JadeCara JadeCara deleted the ENG-1290-convenience-fields branch November 24, 2025 22:08
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.

3 participants