Repository navigation
Conversation
… deleted The task that builds an audit log from a historical feature state reads the live FeatureSegment to name the segment in a creation message. When the segment override is deleted before the task runs, the cascade has already removed the FeatureSegment, so the task raises FeatureSegment.DoesNotExist and fails on every retry. Flagsmith#6792 handled this for update messages. Handle the creation path the same way, so the task returns without an audit log instead of failing. The deletion of the override is still logged from the FeatureSegment history.
|
@PDGamerSG is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval skipped because this PR is from an external contributor.
Re-trigger cubic
Zaimwa9
left a comment
There was a problem hiding this comment.
Thanks for the contribution, just one nit to remove an expendable comment
Co-authored-by: Zaimwa9 <wadii.zaim@gmail.com>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval skipped because this PR is from an external contributor.
Re-trigger cubic
|
Thanks @Zaimwa9 , I have removed the comment sir and you can have a look now |
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Follow-up to #6792, which fixed the same error for update messages.
create_audit_log_from_historical_recordbuilds the creation message for a segment override from the liveFeatureSegment. If the override is deleted before the task runs, the cascade has already removed theFeatureSegment. The task then raisesFeatureSegment.DoesNotExistand fails on all three attempts:We hit this on self-hosted 2.295.2 when an automated client created a segment override and deleted it a few seconds later. Six audit tasks failed this way in one run.
This PR handles the creation path the same way #6792 handled the update path.
FeatureState.get_create_log_messagenow returnsNonewhen theFeatureSegmentis gone, so the task exits without an audit log instead of failing and being retried. The deletion of the override is still logged from theFeatureSegmenthistory.No docs change is needed.
How did you test this code?
test_create_audit_log_from_historical_record__segment_override_deleted_before_create_task__does_nothing. It creates a segment override that differs from the environment default, so a creation message is due, then deletes theFeatureSegmentbefore running the task on the+historical record. Before the change, the test raisedFeatureSegment.DoesNotExist. It now passes.pytest tests/unit/audit tests/unit/features/test_unit_features_audit_helpers.py tests/unit/features/test_unit_features_models.py: 146 passed.ruff check,ruff format --checkandmypypass on both changed files.