fix(Segments): Fix project reference in segment creation#6929
fix(Segments): Fix project reference in segment creation#6929gagantrivedi merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Docker builds report
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test doesn't verify successful creation, masks failures
- The test now asserts a 201 response and verifies the new segment is created in the URL project while still ensuring nothing is created in the other project.
Or push these changes by commenting:
@cursor push 55ce27cb21
Preview (55ce27cb21)
diff --git a/api/tests/unit/segments/test_unit_segments_views.py b/api/tests/unit/segments/test_unit_segments_views.py
--- a/api/tests/unit/segments/test_unit_segments_views.py
+++ b/api/tests/unit/segments/test_unit_segments_views.py
@@ -1895,7 +1895,7 @@
other_project = Project.objects.create(name="Other Project", organisation=other_org)
# When
- admin_client.post(
+ response = admin_client.post(
f"/api/v1/projects/{project.id}/segments/",
data={
"name": "a_wild_pokemon",
@@ -1906,4 +1906,6 @@
)
# Then
+ assert response.status_code == status.HTTP_201_CREATED
+ assert Segment.objects.filter(project=project, name="a_wild_pokemon").exists()
assert not Segment.objects.filter(project=other_project).exists()This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6929 +/- ##
=======================================
Coverage 98.31% 98.31%
=======================================
Files 1335 1335
Lines 49717 49730 +13
=======================================
+ Hits 48879 48892 +13
Misses 838 838 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
9d8eb8e to
6e5a709
Compare
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on April 10. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |

Thanks for submitting a PR! Please check the boxes below:
I have added information todocs/if required so people know about the feature.Changes
Closes #6914.
This patch prevents referencing any project when creating a segment, restricting to the one referenced in the URL, which has its association with the user validated.
How did you test this code?
Included unit tests.