Stop finding tagless releases
What does this MR do and why?
Stop finding tagless releases
Releases with nil or empty string tags are causing problems in presenters that make it fail to load pages that would include these tagless releases.
We can fix page load issues by treating empty string tags the same way we're already treating nil tag values by stopping loading them in the ReleasesFinder.
Eventually, it would be good to find a way to clean up any existing invalid data. I don't want to simply delete the tagless releases because
- I don't know what all consequences that might have and researching that might take considerable time compared to this iteration
- the DestroyRelease service depends on a tag existing to work. There are a number of side effects around this that I think we'd want to make sure happen instead of just destroying the records manually.
It's a relatively small number of a records in this state. It might be best in the long run to add a service that can destroy releases based on ID instead of tag, and provide a way for support engineers to run so that if a user wants to delete the tagless release altogether, they can do so.
database
.tagged
scope
query from SELECT "releases".* FROM "releases" WHERE NOT (("releases"."tag" = '' OR "releases"."tag" IS NULL))
usage in ReleasesFinder
Where this scope is actually being used is the ReleasesFinder. Example SQL in development.log from loading https://gdk.test:3443/flightjs/Flight/-/releases
SELECT "releases".* FROM "releases" WHERE "releases"."project_id" = 278964 AND NOT (("releases"."tag" = '' OR "releases"."tag" IS NULL)) ORDER BY "releases"."released_at" DESC, "releases"."id" DESC LIMIT 2
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
on master
- Create at least 2 releases on a project
- Verify the releases index page works (leave the page open to refresh later)
- In rails console, select one of the releases
- To bypass validations
my_release.update_column(:tag, '')
- Refresh the releases index page
- Verify the page doesn't load and there is an error message at the top
switch to hustewart-stop-finding-tagless-releases
- refresh the releases index page
- the releases page should load and show the valid release
- you should not see the invalid release that has no tag
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.