Skip to content

fix(hc): Add replacements for RPC methods that return tuples #67321

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

Closed
wants to merge 1 commit into from

Conversation

RyanSkonnord
Copy link
Contributor

This is a step in the process to replace all RPC methods that have a fixed-length tuple as a return type, for the purpose of representing them in OpenAPI.

See #67320

@RyanSkonnord RyanSkonnord requested a review from a team as a code owner March 20, 2024 08:40
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 20, 2024
Copy link

codecov bot commented Mar 20, 2024

Codecov Report

Attention: Patch coverage is 87.75510% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 84.33%. Comparing base (fbbabdb) to head (084e973).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #67321      +/-   ##
==========================================
- Coverage   84.33%   84.33%   -0.01%     
==========================================
  Files        5309     5309              
  Lines      237230   237271      +41     
  Branches    41029    41039      +10     
==========================================
+ Hits       200073   200105      +32     
- Misses      36939    36948       +9     
  Partials      218      218              
Files Coverage Δ
...c/sentry/services/hybrid_cloud/integration/impl.py 87.78% <100.00%> (+0.16%) ⬆️
.../sentry/services/hybrid_cloud/integration/model.py 90.00% <100.00%> (+0.52%) ⬆️
...sentry/services/hybrid_cloud/notifications/impl.py 97.05% <100.00%> (+0.18%) ⬆️
...entry/services/hybrid_cloud/notifications/model.py 100.00% <100.00%> (ø)
src/sentry/services/hybrid_cloud/user/impl.py 87.89% <100.00%> (+0.19%) ⬆️
src/sentry/services/hybrid_cloud/user/model.py 98.18% <100.00%> (+0.05%) ⬆️
...ntry/services/hybrid_cloud/notifications/serial.py 88.88% <83.33%> (-11.12%) ⬇️
...try/services/hybrid_cloud/notifications/service.py 82.14% <80.00%> (-0.22%) ⬇️
src/sentry/services/hybrid_cloud/user/service.py 86.40% <80.00%> (-0.47%) ⬇️
...entry/services/hybrid_cloud/integration/service.py 88.04% <57.14%> (-2.55%) ⬇️

... and 6 files with indirect coverage changes

integration_id: int | None = None,
provider: str | None = None,
external_id: str | None = None,
) -> tuple[RpcIntegration | None, RpcOrganizationIntegration | None]:
Copy link
Member

Choose a reason for hiding this comment

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

Should this method have the same signature as get_organization_context__tmp has in the impl module? The method defined in impl has a return of RpcOrganizationIntegrationContextResult

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is confusing because of the single/plural distinction between get_organization_context and get_organization_contexts. There is no corresponding impl for get_organization_context__tmp. Note also that RpcOrganizationIntegrationContextResult replaces a tuple that has a list of RpcOrganizationIntegration as the second element, whereas get_organization_context returns only a single nullable RpcOrganizationIntegration.

My goal with get_organization_context (singular) is to remove it as an @rpc_method. It's a convenience method that delegates to get_organization_contexts and unpacks a singleton result. That unpacking step currently happens remotely, but we can do it locally instead by pulling it up into the service class as a concrete method. The change has no performance benefit (it's a single round trip either way) but lets us delete get_organization_context from the RPC API

Copy link
Member

Choose a reason for hiding this comment

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

Ah bugger I missed the s when looking at the method names.

integration_id: int | None = None,
provider: str | None = None,
external_id: str | None = None,
) -> tuple[RpcIntegration | None, RpcOrganizationIntegration | None]:
Copy link
Member

Choose a reason for hiding this comment

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

Ah bugger I missed the s when looking at the method names.

@RyanSkonnord
Copy link
Contributor Author

Replaced by #68345

@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants