Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deleting change requests with change sets throws 500 error #4439

Conversation

matthewelwell
Copy link
Contributor

Changes

Fixes this Sentry issue.

How did you test this code?

Added a unit test.

@matthewelwell matthewelwell requested a review from a team as a code owner July 31, 2024 14:33
@matthewelwell matthewelwell requested review from khvn26 and removed request for a team July 31, 2024 14:33
Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Jul 31, 2024 2:33pm
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Jul 31, 2024 2:33pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Jul 31, 2024 2:33pm

@github-actions github-actions bot added the api Issue related to the REST API label Jul 31, 2024
Copy link
Contributor

github-actions bot commented Jul 31, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-4439 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-4439 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-4439 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api:pr-4439 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4439 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4439 Finished ✅ Results

@matthewelwell matthewelwell changed the title Fix live_from for change requests with change sets fix: deleting change requests with change sets throws 500 error Jul 31, 2024
Copy link
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 271 to 282
# live_from.
if first_feature_state := self.feature_states.order_by("live_from").first():
return first_feature_state.live_from

# Then we do the same for environment feature versions. Note that a change request
# can not have feature states and environment feature versions.
# Then we check the change sets.
elif first_change_set := self.change_sets.order_by("live_from").first():
return first_change_set.live_from

# Finally, we do the same for environment feature versions.
elif first_environment_feature_version := self.environment_feature_versions.order_by(
"live_from"
).first():
Copy link
Member

Choose a reason for hiding this comment

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

Just a design question — are we going to deprecate feature_states and environment_feature_versions in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to, for sure, yep!

Copy link
Contributor

github-actions bot commented Jul 31, 2024

Uffizzi Preview deployment-54860 was deleted.

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.85%. Comparing base (f03b479) to head (21165d0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4439   +/-   ##
=======================================
  Coverage   96.85%   96.85%           
=======================================
  Files        1170     1170           
  Lines       38786    38797   +11     
=======================================
+ Hits        37566    37577   +11     
  Misses       1220     1220           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matthewelwell matthewelwell added this pull request to the merge queue Jul 31, 2024
Merged via the queue into main with commit 670ede9 Jul 31, 2024
34 checks passed
@matthewelwell matthewelwell deleted the fix(versioning)/handle-change-request-live_from-for-change-sets branch July 31, 2024 14:46
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.

2 participants