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

Build: remove usage of addons field #11846

Merged
merged 2 commits into from
Dec 12, 2024
Merged

Build: remove usage of addons field #11846

merged 2 commits into from
Dec 12, 2024

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Dec 11, 2024

We can remove the field itself after deploying this PR.

@stsewd stsewd requested a review from a team as a code owner December 11, 2024 19:20
@stsewd stsewd requested a review from humitos December 11, 2024 19:20
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

We can remove the field itself after deploying this PR.

Why you don't create a migration with Safe.after_deploy that deletes the field?

@@ -304,7 +304,7 @@ def test_build_updates_documentation_type(self, load_yaml_config):
assert self.requests_mock.request_history[8]._request.method == "PATCH"
assert self.requests_mock.request_history[8].path == "/api/v2/version/1/"
assert self.requests_mock.request_history[8].json() == {
"addons": True,
"addons": False,
Copy link
Member

Choose a reason for hiding this comment

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

We should not even send the addons fields on these API calls now.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is because we use a APIVersion model that inherits from the Version model, it will be removed when the field is removed from the model.

@stsewd
Copy link
Member Author

stsewd commented Dec 12, 2024

Why you don't create a migration with Safe.after_deploy that deletes the field?

Old code/tasks will try to use that field, but will error since it doesn't exist in the new code.

@humitos
Copy link
Member

humitos commented Dec 12, 2024

I don't follow you. If the old code is executed, the field is there. If the new code is executed the field is not there. In both cases, the field is in the db. After the deploy, new code won't make usage of the field and that time, the migration will be executed and the field deleted from the db.

I'm not seeing where is the potential error you are describing.

@stsewd
Copy link
Member Author

stsewd commented Dec 12, 2024

An example: Builders with new code hit the API (old code), the extra field will be returned, but the model from the builder doesn't have that field anymore. An error occurs.

@humitos
Copy link
Member

humitos commented Dec 12, 2024

Well, that particular example won't happen since we deploy webs first. I get your idea, but I think it's not a problem, tho.

@stsewd stsewd merged commit 0c556f5 into main Dec 12, 2024
8 checks passed
@stsewd stsewd deleted the remove-usage-of-addons-field branch December 12, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants