Add better handling for suborgproperties and suborgteams #1031
Open
avelizmu wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request optimizes suborg membership resolution when syncing a single repository by using repo-scoped queries for team membership and custom property values, avoiding org-wide enumeration that scales with the number of suborg configs.
Changes:
- Added a repo-scoped suborg resolution path (
getSubOrgConfigsForRepo) and wiredgetSubOrgConfigs(repo)into single-repo sync flows to reduce API fan-out. - Introduced helper methods to fetch a repo’s teams and custom property values, plus a local matcher (
repoMatchesProperties) for property-based suborg filters. - Added unit tests covering repo-scoped suborg resolution behavior and property matching/coercion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/settings.js | Adds repo-scoped suborg config resolution and helpers to minimize API calls during single-repo syncs. |
| test/unit/lib/settings.test.js | Adds unit coverage for repo-scoped suborg membership resolution and custom property matching behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Essentially changing the handling for suborgproperties and suborgteams when only checking a single repo (in the event of a webhook like repo.created or any other that target a specific repo), so that the API requests don't scale with the number of files that have suborgproperties or suborgteams defined.
AI Overview:
This pull request introduces a repo-scoped optimization for resolving suborg config membership in
lib/settings.js, significantly improving performance when syncing a single repository. Instead of making organization-wide API calls to enumerate all repos, teams, and properties for all suborgs, the new approach inspects only the relevant repository's teams and custom properties. Comprehensive unit tests are added to verify this behavior.Repo-scoped suborg config resolution:
getSubOrgConfigsForRepoto efficiently resolve suborg config membership for a single repo by checking only that repo's teams and custom properties, minimizing API calls (lib/settings.js).getSubOrgConfigsand its callers (loadConfigs,updateRepos) to use the new repo-scoped logic when appropriate (lib/settings.js). [1] [2] [3]getReposTeamsandgetRepoCustomPropertyValuesto fetch a repo's teams and custom property values, respectively (lib/settings.js).repoMatchesPropertieshelper to match repo properties against suborg config filters, handling type coercion and case-insensitive property names (lib/settings.js).Testing:
test/unit/lib/settings.test.js).