Skip to content

Fix UI for latest deploys in Release page - #65587

Merged
saponifi3d merged 9 commits into
masterfrom
jcallender/fix-latest-deploy
Feb 22, 2024
Merged

saponifi3d merged 9 commits into
masterfrom
jcallender/fix-latest-deploy

Conversation

@saponifi3d

@saponifi3d saponifi3d commented Feb 21, 2024 •

Copy link
Copy Markdown
Contributor

Description

Fixes: https://github.com/getsentry/team-core-product-foundations/issues/59

Previously, we weren't filtering the latest deploys by project By using the ReleaseProjectEnvironment, we can map all the filters correctly.

Before

Screenshot 2024-02-21 at 3 01 15 PM

Before, we weren't filtering by project id, so we could have a release to a single project and it'd show up on all release pages as a deploy.

After

Screenshot 2024-02-21 at 2 59 14 PM

Now, we look at the ReleaseProjectEnvrinoments to map the org, version, and project_id to filter per release project view.

@saponifi3d
saponifi3d requested a review from a team as a code owner February 21, 2024 23:06
@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Feb 21, 2024
@github-actions

Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@nhsiehgit nhsiehgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice, can we get a test?


project_id = request.GET.get("project", None)
if project_id:
releases.filter(project_id=project_id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah - do we need to account for -1 here as well for "all projects"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hopefully this isn't the case because we force the user to select a project for the release details page?
but maybe add a check just in case?

@saponifi3d saponifi3d Feb 21, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 i'll add a test for this

the thought here is that we just don't filter if we don't have a project_id so by default we would select all projects and adding the project=.... to the url would filter.

Hopefully this isn't the case because we force the user to select a project for the release details page?

Yeah it's required on the project release page right now -- i was thinking by defaulting to it being the full list it'd show whatever the latest is for any of those releases (handy on things like the list view for all projects)

@nhsiehgit nhsiehgit Feb 22, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🙏

Yea - on other pages, we have project=-1 to signify all projects which is an annoying legacy decision we need to deal with :(

I might still add a check in case where project_id == ALL_ACCESS_PROJECT_ID then skip the filter or something :/

@codecov

codecov Bot commented Feb 21, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.16%. Comparing base (8057c4f) to head (265b244).
Report is 200 commits behind head on master.

❗ Current head 265b244 differs from pull request most recent head 99038a2. Consider uploading reports for the commit 99038a2 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #65587      +/-   ##
==========================================
+ Coverage   80.56%   84.16%   +3.60%     
==========================================
  Files        5259     5271      +12     
  Lines      231980   235797    +3817     
  Branches    45501    40818    -4683     
==========================================
+ Hits       186886   198460   +11574     
+ Misses      39000    37118    -1882     
+ Partials     6094      219    -5875     
Files Coverage Δ
src/sentry/api/endpoints/release_deploys.py 80.23% <100.00%> (+4.28%) ⬆️
static/app/views/releases/detail/index.tsx 2.50% <ø> (+0.03%) ⬆️

... and 2383 files with indirect coverage changes

@nhsiehgit
nhsiehgit requested a review from a team February 22, 2024 00:08

@nhsiehgit nhsiehgit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice 🙌

release__version=version,
)

project_id = request.GET.get("project", None)

@JoshFerge JoshFerge Feb 22, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please do not access projects directly. This is a security issue as we are not checking that the user has access to the project passed in.

use self.get_projects like in

projects = self.get_projects(request, organization)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@JoshFerge thanks for the heads up about this helper function! How's it look now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks great thank you! going forward will try and figure out a solution where project perms get checked automatically. thanks for the change!

@saponifi3d
saponifi3d enabled auto-merge (squash) February 22, 2024 19:10
@saponifi3d
saponifi3d disabled auto-merge February 22, 2024 19:21
@saponifi3d
saponifi3d deleted the jcallender/fix-latest-deploy branch February 22, 2024 23:07
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2024

This branch was successfully deployed

1 active deployment
Preview — 99038a24 Deployed Feb 22, 2024 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants