Remove id guid id roundtrips - #5318
Open
svkrieger wants to merge 7 commits into
Open
Conversation
Add readable_org_ids_for_domains_query and readable_security_group_ids_query, mirroring the existing *_guids_query helpers but returning the flat id UNION without the enclosing SELECT ... FROM organizations/security_groups WHERE id IN wrapper. Prerequisite for removing id -> guid -> id round-trips from V3 read-permission filters. Follow-up to #5157 and #5172.
Switch SecurityGroupListFetcher and SecurityGroupFetcher to the new bare-id readable_security_group_ids_query, removing the id -> guid -> id round-trip from the security group visibility filter. The single-resource guid lookup and the guid-membership checks on individual actions are left untouched. Follow-up to #5157 and #5172.
Switch IsolationSegmentOrganizationsFetcher (backing GET /v3/isolation_segments/:guid/relationships/organizations for non-admins) to the bare-id readable_org_ids_query. The IsolationSegmentListFetcher path is left as-is: its organizations association is keyed on guid through the join table, so no org id is in scope there. Follow-up to #5157 and #5172.
svkrieger
force-pushed
the
remove-id-guid-id-roundtrips
branch
from
July 30, 2026 10:12
3301d77 to
687013f
Compare
svkrieger
marked this pull request as ready for review
July 31, 2026 07:27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A short explanation of the proposed change:
Follow-up to #5157 and #5172.
Remove all guid -> id -> guid roundtrips mechanically.
An explanation of the use cases your change solves
Improves performance in the following API paths:
app/fetchers/org_list_fetcher.rb - GET /v3/organizations
app/fetchers/organization_quota_list_fetcher.rb - GET /v3/organization_quotas
app/fetchers/service_plan_visibility_fetcher.rb - marketplace visibility checks
app/fetchers/security_group_list_fetcher.rb / security_group_fetcher.rb - GET /v3/security_groups*
app/fetchers/isolation_segment_organizations_fetcher.rb - GET /v3/isolation_segments/:guid/organizations
app/fetchers/domain_fetcher.rb - GET /v3/domains*
app/presenters/v3/organization_quota_presenter.rb, domain_presenter.rb, domain_shared_orgs_presenter.rb
Before / After perf test results — id → guid → id round-trip removal (medians, N=3)
Analysis
Wins — non-admin permission filtering:
Neutral (expected):
can_read_globally?short-circuit — not touched.Noise, not regressions:
Bottom line: Large win on non-admin org_quotas (~40%), solid on organizations regular (−11%). Admin + unrelated paths unchanged.
Links to any other associated PRs
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests