Skip to content

Make segment deletion task idempotent#7380

Open
linhvo229 wants to merge 1 commit intoFlagsmith:mainfrom
linhvo229:make-delete-segment-idempotent
Open

Make segment deletion task idempotent#7380
linhvo229 wants to merge 1 commit intoFlagsmith:mainfrom
linhvo229:make-delete-segment-idempotent

Conversation

@linhvo229
Copy link
Copy Markdown
Contributor

@linhvo229 linhvo229 commented Apr 30, 2026

Summary

  • Make segments.tasks.delete_segment ignore already-deleted/missing segments by catching Segment.DoesNotExist
  • Add focused unit tests for existing segment deletion and missing segment no-op behavior

Fixes #7354.

Testing

  • git diff --check origin/main..HEAD
  • poetry run pytest tests/unit/segments/test_unit_segments_tasks.py -q
  • poetry run ruff format segments/tasks.py tests/unit/segments/test_unit_segments_tasks.py --check
  • poetry run ruff check segments/tasks.py tests/unit/segments/test_unit_segments_tasks.py

@linhvo229 linhvo229 requested a review from a team as a code owner April 30, 2026 10:18
@linhvo229 linhvo229 requested review from Zaimwa9 and removed request for a team April 30, 2026 10:18
Copy link
Copy Markdown

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

Someone is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the api Issue related to the REST API label Apr 30, 2026
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a19b91d. Configure here.

Comment thread api/tests/unit/segments/test_unit_segments_tasks.py Outdated
@linhvo229 linhvo229 force-pushed the make-delete-segment-idempotent branch from a19b91d to 986e993 Compare April 30, 2026 10:36
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.37%. Comparing base (413c9b8) to head (755ba14).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7380      +/-   ##
==========================================
- Coverage   98.44%   98.37%   -0.07%     
==========================================
  Files        1398     1399       +1     
  Lines       52628    52522     -106     
==========================================
- Hits        51808    51667     -141     
- Misses        820      855      +35     

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

@linhvo229 linhvo229 force-pushed the make-delete-segment-idempotent branch 2 times, most recently from 71cace6 to 34db9f7 Compare April 30, 2026 11:48
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 30, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@linhvo229 linhvo229 force-pushed the make-delete-segment-idempotent branch from 34db9f7 to e5cdfa5 Compare April 30, 2026 11:52
@linhvo229 linhvo229 force-pushed the make-delete-segment-idempotent branch from e5cdfa5 to 755ba14 Compare April 30, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition in deleting segments

1 participant