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

Protected block compatibility #6986

Merged
merged 13 commits into from
Sep 27, 2022
Merged

Conversation

anticorrelator
Copy link
Contributor

@anticorrelator anticorrelator commented Sep 27, 2022

The addition of protected block types is a breaking API version change. In order to prevent disruption to users we both bump the API version and add a passthrough for older clients.

Closes #6981

Example

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • This pull request includes tests or only affects documentation.
  • This pull request includes a label categorizing the change e.g. fix, feature, enhancement

@anticorrelator anticorrelator added the fix A fix for a bug in an existing feature label Sep 27, 2022
@netlify
Copy link

netlify bot commented Sep 27, 2022

Deploy Preview for prefect-orion ready!

Name Link
🔨 Latest commit 9721354
🔍 Latest deploy log https://app.netlify.com/sites/prefect-orion/deploys/63333ad70c7cc20009dea470
😎 Deploy Preview https://deploy-preview-6986--prefect-orion.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

The overall approach looks good to me. Just a couple of small nits on the tests.

response = await client_with_unprotected_block_api.delete(
f"/block_schemas/{block_schema.id}"
)
assert response.status_code != 403
Copy link
Member

Choose a reason for hiding this comment

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

Should we assert that status code is 204 like the other tests that have a successful deletion?

response = await client_with_unprotected_block_api.delete(
f"/block_types/{system_block_type.id}"
)
assert response.status_code != status.HTTP_403_FORBIDDEN
Copy link
Member

Choose a reason for hiding this comment

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

Should we assert that status code is 204 like the other tests that have a successful deletion?

description="Hi there!",
).dict(json_compatible=True),
)
assert response.status_code != status.HTTP_403_FORBIDDEN
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert response.status_code != status.HTTP_403_FORBIDDEN
assert response.status_code != status.HTTP_204_NO_CONTENT

json_compatible=True
),
)
assert response.status_code != 403
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
assert response.status_code != 403
assert response.status_code != 201

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use the fastapi.status enums?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do think this is mildly out of scope since I didn't want to go and change every assertion in the block schema test suite but I went ahead and did this anyway

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 thanks for taking it on anyway. Didn't realize the whole file was out of date.

Copy link
Collaborator

@zangell44 zangell44 left a comment

Choose a reason for hiding this comment

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

Nice!

@anticorrelator anticorrelator merged commit be4f1d9 into main Sep 27, 2022
@anticorrelator anticorrelator deleted the protected-block-compatibility branch September 27, 2022 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug in an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Prefect 2.4.2 server is not compatible with a client running 2.2
4 participants