Skip to content

ENG-3250 - Add group_id to MonitorTask#8115

Open
vcruces wants to merge 12 commits intomainfrom
ENG-3250
Open

ENG-3250 - Add group_id to MonitorTask#8115
vcruces wants to merge 12 commits intomainfrom
ENG-3250

Conversation

@vcruces
Copy link
Copy Markdown
Contributor

@vcruces vcruces commented May 6, 2026

Ticket ENG-3250

Description Of Changes

Add group_id column to MonitorTask model and is_cancelled() class method to support task cancellation in fidesplus.

  • group_id: nullable indexed column that groups tasks spawned from a single classify operation, enabling batch cancellation
  • is_cancelled(): checks if a task's status is awaiting_processing (the cancellation status)

This is the fides-side companion to fidesplus PR #3525.

Code Changes

  • Added group_id column to MonitorTask model
  • Added MonitorTask.is_cancelled() class method
  • Added Alembic migration 9f21507db078
  • Added tests for group_id and is_cancelled()

Steps to Confirm

  1. Run migration: verify group_id column is added to monitortask table
  2. Run migration downgrade: verify column is removed

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
Copy Markdown
Contributor

vercel Bot commented May 6, 2026

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

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment May 8, 2026 4:18pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored May 8, 2026 4:18pm

Request Review

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.23%. Comparing base (292d8b2) to head (1117fda).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8115   +/-   ##
=======================================
  Coverage   85.23%   85.23%           
=======================================
  Files         638      638           
  Lines       42011    42017    +6     
  Branches     4937     4938    +1     
=======================================
+ Hits        35807    35814    +7     
  Misses       5096     5096           
+ Partials     1108     1107    -1     

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

@vcruces vcruces changed the title Eng 3250 ENG-3250 - Add group_id to MonitorTask May 6, 2026
@vcruces vcruces force-pushed the ENG-3250 branch 2 times, most recently from a06b423 to f9a34f7 Compare May 6, 2026 14:38
@vcruces
Copy link
Copy Markdown
Contributor Author

vcruces commented May 6, 2026

/code-review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Title Lines Statements Branches Functions
admin-ui Coverage: 8%
6.6% (3042/46031) 5.92% (1572/26517) 4.62% (630/13611)
fides-js Coverage: 78%
79.56% (2028/2549) 66.4% (1259/1896) 73.31% (349/476)
privacy-center Coverage: 85%
82.53% (364/441) 79.74% (189/237) 74.07% (60/81)

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Code Review: Add group_id to MonitorTask (#8115)

The overall shape of the change is clean and focused: add a group_id column + index to MonitorTask, introduce an is_cancelled helper that maps awaiting_processing status to cancellation semantics, and stop showing paused tasks in the in-progress list on the frontend.

Must Fix

is_cancelled is mistyped as @classmethod (monitor_task.py:66): cls is unused in the method body — the method takes a db: Session + celery_id and performs a concrete record lookup. The existing module-level function pattern (create_monitor_task_with_execution_log, update_monitor_task_with_execution_log) is a better fit for this kind of named DB query. Using @classmethod here obscures intent and breaks the semantic contract of classmethods.

Suggestions

  • isInProgress uses raw string literals instead of ExecutionLogStatus enum values (InProgressMonitorTaskItem.tsx:97): the enum is already imported in the hook layer; using it here prevents silent breakage if values change.
  • formatStatusForDisplay is duplicated in two co-located files (InProgressMonitorTaskItem.tsx:35 and InProgressMonitorTasksList.tsx:21): this PR simplified both copies simultaneously, which is a natural moment to extract it into a shared utils.ts in the same directory.
  • Test cleanup uses db.delete() + db.commit() instead of task.delete(db=db) (test_monitor_task.py:545–547, 579–580): inconsistent with the rest of the test file.

Looks Good

  • group_id column definition (String(255), nullable, indexed) is consistent with celery_id.
  • Alembic migration down_revision = 'd76443a8a2e3' correctly extends the current head — no fork introduced.
  • Removing ExecutionLogStatus.PAUSED from defaultStatusFilters and isInProgress is the right approach; the loader-for-paused-tasks behaviour was the stated problem.
  • The is_cancelled docstring clearly explains the awaiting_processing ↔ "paused/cancelled" mapping — good documentation for a non-obvious semantic.
  • Parametrized test_is_cancelled covers all relevant status branches cleanly.

🔬 Codegraph: unavailable


💡 Write /code-review in a comment to re-run this review.

Comment thread src/fides/api/models/detection_discovery/monitor_task.py Outdated
Comment thread tests/ops/models/detection_discovery/test_monitor_task.py
Copy link
Copy Markdown
Contributor

@speaker-ender speaker-ender left a comment

Choose a reason for hiding this comment

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

minor nits but approving as is

const isInProgress = [
"pending",
"in_processing",
"paused",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed the paused state here because it was showing a spinner, which made it look like the process was still running

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