-
Notifications
You must be signed in to change notification settings - Fork 415
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: segment overrides stale feature state value while creating GitHub comment #3961
fix: segment overrides stale feature state value while creating GitHub comment #3961
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3961 +/- ##
=======================================
Coverage 96.01% 96.02%
=======================================
Files 1138 1138
Lines 36443 36460 +17
=======================================
+ Hits 34992 35009 +17
Misses 1451 1451 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments but nothing show-stopping. Make sure to add the typing though.
if ( | ||
fs.get("segment_name") is not None | ||
and fs["segment_name"] != last_segment_name | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that last_segment_name
is never None
this should simplify to the below.
if ( | |
fs.get("segment_name") is not None | |
and fs["segment_name"] != last_segment_name | |
): | |
if ( | |
fs.get("segment_name") != last_segment_name | |
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs.get("segment_name") can be None
return ( | ||
"| Environment | Enabled | Value | Last Updated (UTC) |\n" | ||
"| :--- | :----- | :------ | :------ |\n" | ||
f"| [Test Environment](https://example.com/project/{project_id}/" | ||
f"environment/{environment_api_key}/features?feature={feature_id}&tab=value) " | ||
f"| {feature_state_enabled} | {feature_state_value} | {feature_state_updated_at} |\n" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you double check this? I don't think the data will line up in columns properly but maybe you already know this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def expected_segment_comment_body( | ||
project_id, | ||
environment_api_key, | ||
feature_id, | ||
segment_override_updated_at, | ||
segment_override_enabled, | ||
segment_override_value, | ||
) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing typing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
def expected_default_body( | ||
project_id, | ||
environment_api_key, | ||
feature_id, | ||
feature_state_updated_at, | ||
feature_state_enabled="❌ Disabled", | ||
feature_state_value="`value`", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing typing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
AFTER_SAVE
hook within thefeature
model to create a GitHub comment when the feature is deleted (we useAFTER_SAVE
because it's a soft delete).How did you test this code?