fix: prevent system segments from being overwritten via change request drafts - #8298
fix: prevent system segments from being overwritten via change request drafts#8298srijantrpth wants to merge 7 commits into
Conversation
…t drafts and add unit test
|
@srijantrpth is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
for more information, see https://pre-commit.ci
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change request commit now runs within an atomic transaction. The segment publishing workflow rejects drafts that target system segments before revision creation or live-segment updates. A unit test verifies the Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🟡 Moderate · up to The change correctly blocks system-segment drafts, but rejection can still trigger external updates before the database transaction commits, potentially causing inconsistent downstream state. The PR should address this transaction-boundary issue and the remaining formatting check before merge. ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7d4c283a-be0a-47ee-8f1c-4983a6315816
📒 Files selected for processing (2)
api/core/workflows_services.pyapi/tests/unit/features/workflows/core/test_unit_workflows_models.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8298 +/- ##
==========================================
- Coverage 98.76% 98.62% -0.15%
==========================================
Files 1594 1594
Lines 63657 63667 +10
==========================================
- Hits 62873 62793 -80
- Misses 784 874 +90 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3549c7b1-2004-485c-80d0-cf7dfa1ca444
📒 Files selected for processing (2)
api/core/workflows_services.pyapi/tests/unit/features/workflows/core/test_unit_workflows_models.py
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #8269
ChangeRequestCommitService._publish_segments(api/core/workflows_services.py) to prevent change request drafts from overwriting system segments (is_system_segment=True).How did you test this code?
Added a new unit test (
test_change_request_commit__system_segment_draft__raises_value_error) intests/unit/features/workflows/core/test_unit_workflows_models.pyto verify that attempting to commit a change request targeting a system segment correctly raises aValueError.