Skip to content

Add ListTeamsIncludingProperties for batched team metadata reads - #643

Merged
saditya370 merged 3 commits into
mainfrom
aditya/OPS-27/list-teams-including-properties
Sep 4, 2026
Merged

Add ListTeamsIncludingProperties for batched team metadata reads#643
saditya370 merged 3 commits into
mainfrom
aditya/OPS-27/list-teams-including-properties

Conversation

@saditya370

@saditya370 saditya370 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Resolves OPS-27

Drafted with Claude, reviewed by me.

Problem

Team.Properties was tagged graphql:"-", so it was never selected by generated queries. Anything wanting properties for a list of teams had to call GetProperties per team.

Through the Terraform provider that's one request per team. On a 263-team account it took ~266 requests and 26 seconds — close enough to the provider's 30s client timeout that one of two runs died mid-read.

Solution

Removes the opt-out, per review. Team queries now select properties directly, so listing teams returns them with no extra request.

Hydrate gains a properties block mirroring the tags one — it issues no request unless a team holds more than one page of properties.

ListTeams now hydrates the nodes on each page, matching ListUsers. It previously hydrated only nodes returned by its recursive call, so with a default page size of 500 most accounts hydrated nothing at all. That's a prerequisite here rather than a drive-by: without it properties arrive on page one with TotalCount unset and overflow never fetched. It's user-visible, so it has its own changelog entry. The same pattern still exists in 16 other places across system.go, domain.go, service.go and repository.go — filing that separately.

This replaces the earlier ListTeamsIncludingProperties approach, which wasn't composable and leaned on shadowing the embedded field.

Note: removing the opt-out isn't limited to listing — Team is selected in 7 places, including the team create/update mutation payloads, so those return properties now too.

Verified against a local server: 10 teams, 1 GraphQL request, properties inline, with both TotalCount and unescaped Responsibilities confirming hydration ran on the first page.

Checklist

  • I have run this code, and it appears to resolve the stated issue.
  • This PR does not reduce total test coverage
  • This PR has no user interface changes or has already received approval from product management to change the interface.
  • Does this change require a Terraform schema change?
    • Yes — the OPS-27 provider PR consumes this and merges after this releases.
  • Make a changie entry that explains the customer facing outcome of this change

@saditya370
saditya370 force-pushed the aditya/OPS-27/list-teams-including-properties branch from d3deb22 to 0909c68 Compare August 25, 2026 12:22
Team.Properties is excluded from generated queries with `graphql:"-"`, so a
caller needing properties for many teams pays one extra request per team.

Add a TeamWithProperties type that embeds Team and redeclares Properties with
a graphql tag, selecting the connection inline, plus
ListTeamsIncludingProperties which returns every team with its tags and
properties at one request per page. Tags and memberships are completed by the
existing Team.Hydrate; a team holding more than 100 properties is topped up on
its own rather than charging every team an extra request.

Purely additive. Team.Properties, ListTeams, and Hydrate are untouched, so
existing callers execute identical code paths.
@saditya370
saditya370 force-pushed the aditya/OPS-27/list-teams-including-properties branch from 0909c68 to 3021749 Compare August 25, 2026 12:24
@saditya370 saditya370 self-assigned this Aug 25, 2026
Comment thread team.go Outdated
Replaces ListTeamsIncludingProperties with the approach Andrew suggested in
review: drop the properties opt-out so team queries select the connection
directly, and hydrate each page rather than each team.

Team.Properties loses `graphql:"-"`, so every team query returns properties
with no extra request. Hydrate gains a properties block mirroring tags, which
issues no request unless a team holds more than one page of them.

ListTeams now hydrates the nodes on each page, matching ListUsers. It
previously hydrated only nodes from its recursive call, so with a default page
size of 500 most accounts hydrated nothing at all - properties would arrive
with TotalCount unset and overflow never fetched.

Removes TeamWithProperties, ListTeamsIncludingProperties and hydrateProperties.
Comment thread team.go Outdated
Comment thread team.go Outdated
Comment on lines +113 to +114
// GetProperties appends onto team.Properties, so the pages already returned
// inline by the outer query are kept.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// GetProperties appends onto team.Properties, so the pages already returned
// inline by the outer query are kept.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done!

Comment thread team.go Outdated
Comment thread team.go
@saditya370
saditya370 merged commit 7872a54 into main Sep 4, 2026
4 checks passed
@saditya370
saditya370 deleted the aditya/OPS-27/list-teams-including-properties branch September 4, 2026 14:00
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