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: Move call to GitHub integration tasks out from trigger_feature_state_change_webhooks #3905

Conversation

novakzaballa
Copy link
Contributor

@novakzaballa novakzaballa commented May 8, 2024

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

  • Move call to GitHub integration tasks out from trigger_feature_state_change_webhooks_signal for compatibility with versioning v2

How did you test this code?

  • Create a GitHub integration, add any repository, link a feature with a GH issue, and update the feature values, show the comment in your GH issue

Copy link

vercel bot commented May 8, 2024

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 0:26am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 0:26am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 0:26am

Copy link

sentry-io bot commented May 8, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: api/features/tasks.py

Function Unhandled Issue
trigger_feature_state_change_webhooks TypeError: 'GithubData' object is not subscriptable /api/v1/environments/{environment_api_key}/featurestates/{p...
Event Count: 1
trigger_feature_state_change_webhooks AttributeError: 'Project' object has no attribute 'organisationn_id' /api/v1/environments/{environment_api_key}...
Event Count: 1

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot added the api Issue related to the REST API label May 8, 2024
@novakzaballa novakzaballa requested review from a team and khvn26 and removed request for a team May 8, 2024 19:28
Copy link
Contributor

github-actions bot commented May 8, 2024

Uffizzi Preview deployment-51466 was deleted.

Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.98%. Comparing base (b975831) to head (eafb5f5).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3905      +/-   ##
==========================================
+ Coverage   95.92%   95.98%   +0.05%     
==========================================
  Files        1134     1135       +1     
  Lines       35958    36141     +183     
==========================================
+ Hits        34493    34689     +196     
+ Misses       1465     1452      -13     

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

api/features/signals.py Outdated Show resolved Hide resolved
api/features/signals.py Outdated Show resolved Hide resolved
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.

Left two comments. Also, the code needs test coverage.

Comment on lines 1010 to 1014
github_configuration = (
Organisation.objects.prefetch_related("github_config")
.get(id=self.environment.project.organisation_id)
.github_config.first()
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Err... what? Why not just:

Suggested change
github_configuration = (
Organisation.objects.prefetch_related("github_config")
.get(id=self.environment.project.organisation_id)
.github_config.first()
)
github_configuration = (
GithubConfig.objects.get(organisation_id=self.environment.project.organisation_id)
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Long story, but basically I had issues with the soft-delete model and the one-to-one relationship and other things, but that complex query is not needed. Removed

@novakzaballa novakzaballa enabled auto-merge May 9, 2024 19:59
@novakzaballa novakzaballa disabled auto-merge May 9, 2024 20:00
@novakzaballa novakzaballa added this pull request to the merge queue May 10, 2024
Merged via the queue into main with commit dec9afa May 10, 2024
24 checks passed
@novakzaballa novakzaballa deleted the fix/relocate_calls_to_github_tasks_for_compatibility_with_versioning_v2 branch May 10, 2024 10:43
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.

3 participants