Skip to content

Conversation

@JadeCara
Copy link
Contributor

@JadeCara JadeCara commented Dec 16, 2025

Ticket ENG-2185

Description Of Changes

This ticket was originally asking for consent manual tasks. We are going forward with a work around #7102 because consent task graphs and access/erasure task graphs are different and have different capabilities - especially around conditional dependencies.

There are going to be a few PRs cleaning up some un-used functionality or adjusting functionality for improved usage patterns. This PR adds a condition tree which will hold the full conditional dependency tree in a jsonb column on the "root condition." It also migrates current conditions to store their full tree on their root node. This will allow us to access the full tree without building it or having to build out all of the conditions each time. It is a clean up based on the first few rounds of customer use and learning actual usage patterns.

This PR:

  • Update the Conditional Dependency table with a JSONB dictionary column. This will allow us to thoroughly test the migration without being destructive.

Future PRs:

  • Remove the extra columns and rows for conditional dependencies once the tree has been implemented and tested.
  • The logging being used by manual tasks and front end data is entirely the general audit logs so the manual task log table and utilities are now redundant. ENG-2185 #7124
  • Allow conditional dependencies to be assigned to a specific policy type or id
  • Allow users to be assigned to specific submissions rather than the whole task.

Code Changes

  • .fides/db_dataset.yml - removed ManualTaskLog table
  • src/fides/api/alembic/migrations/versions/ remove the manual task table.
  • src/fides/api/db/base.py - removed ManualTaskLog
  • src/fides/api/models/manual_task/manual_task.py removed the log class and updated the functions where manual task logs were created.
  • Updated all tests removing the manual task log.

Steps to Confirm

  1. There should be NO change in functionality.
  2. Manual tasks, conditional dependencies etc should continue to function as before.
  3. Please test with FidesPlus 2932
  4. Run FidesPlus branch above pointed at this branch.
  5. Create a ManualTask with several submissions required and several conditions, both dataset and privacy request based.
  6. Create privacy requests that meet and do not meet the requirements. Verify that they create/do not create as expected.
  7. Verify that you can complete the manual tasks with no errors.
  8. Verify that you can see the skipped logs and the manual task and manual task actions appear on the DSR activity log.
  9. Verify that you receive the access package with all expected manual task inclusions (attachments and text)
  10. Update the ManualTask submission types, delete one or more.
  11. Delete manual task integration

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 16, 2025

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

2 Skipped Deployments
Project Deployment Review Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Dec 30, 2025 3:33pm
fides-privacy-center Ignored Ignored Dec 30, 2025 3:33pm

@JadeCara JadeCara mentioned this pull request Dec 16, 2025
18 tasks
@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 91.89189% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.17%. Comparing base (cfbf98a) to head (eb5d0aa).

Files with missing lines Patch % Lines
src/fides/api/task/manual/manual_task_utils.py 88.23% 0 Missing and 2 partials ⚠️
.../task/manual/manual_task_conditional_evaluation.py 90.90% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7133      +/-   ##
==========================================
- Coverage   87.17%   87.17%   -0.01%     
==========================================
  Files         535      535              
  Lines       35330    35318      -12     
  Branches     4113     4117       +4     
==========================================
- Hits        30800    30787      -13     
+ Misses       3639     3637       -2     
- Partials      891      894       +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.

@JadeCara JadeCara marked this pull request as ready for review December 29, 2025 18:10
@JadeCara JadeCara requested a review from a team as a code owner December 29, 2025 18:10
@JadeCara JadeCara removed the request for review from a team December 29, 2025 18:10
@JadeCara JadeCara requested a review from erosselli December 29, 2025 18:10
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 29, 2025

Greptile Summary

Added a condition_tree JSONB column to store complete conditional dependency trees as single JSON objects, improving performance by eliminating the need to recursively build trees from parent-child row relationships.

Key Changes:

  • Added condition_tree JSONB column to manual_task_conditional_dependency and digest_condition tables
  • Migration automatically populates condition_tree for existing conditions by recursively building trees from row-based storage
  • Updated get_root_condition() methods to read directly from JSONB column instead of traversing parent-child relationships
  • Added extract_field_addresses() utility to recursively parse field addresses from JSONB trees
  • All tests updated to create and validate JSONB-based condition trees

Architecture:

  • Root conditions (where parent_id IS NULL) store the full tree in condition_tree
  • Child rows remain in place for backward compatibility (to be removed in future PR)
  • JSONB format matches existing Pydantic schemas (ConditionLeaf and ConditionGroup)
  • Uses Pydantic TypeAdapter for safe deserialization of JSONB to typed condition objects

Performance Impact:

  • Eliminates recursive database queries when evaluating conditions
  • Single query to fetch root condition instead of N queries for N-level trees
  • Improves graph building for manual tasks with complex conditional dependencies

Confidence Score: 4/5

  • This PR is safe to merge with careful migration monitoring
  • The implementation is solid with comprehensive test coverage and maintains backward compatibility. The migration logic correctly handles existing data. However, the migration involves a data transformation that should be monitored during deployment, and there are comments indicating the previous review caught issues that were addressed.
  • Pay close attention to src/fides/api/alembic/migrations/versions/xx_2025_12_16_1630_85ce2c1c9579_add_jsonb_tree_column.py during deployment to ensure the data migration completes successfully for all existing conditional dependencies.

Important Files Changed

Filename Overview
src/fides/api/alembic/migrations/versions/xx_2025_12_16_1630_85ce2c1c9579_add_jsonb_tree_column.py Adds condition_tree JSONB column to both tables and migrates existing row-based condition trees to JSONB format. Migration logic looks good with recursive tree building.
src/fides/api/models/conditional_dependency/conditional_dependency_base.py Simplifies base model by removing deprecated methods and adding condition_tree JSONB column. Well-documented architecture with clear usage patterns.
src/fides/api/models/manual_task/conditional_dependency.py Updated get_root_condition() to read from JSONB condition_tree column instead of building tree from parent-child relationships. Clean implementation.
src/fides/api/task/manual/manual_task_utils.py Added extract_field_addresses() function to parse JSONB condition trees. Updated collection creation to use JSONB tree format.

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.

20 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@JadeCara JadeCara mentioned this pull request Dec 30, 2025
18 tasks
@JadeCara
Copy link
Contributor Author

@greptile please review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 30, 2025

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

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