Squad sync: one squad per module (replace stale squads)#29852
Open
a0x1ab wants to merge 1 commit into
Open
Conversation
AddSquadLabelsToYaml was add-only: it appended a module's mapped squad without removing a squad that was already present, so when ownership changed a rule accumulated two squads (e.g. Bot Service had both act-codegen-extensibility-squad and act-experience-enablement-squad). Port the canonical replace-not-accumulate logic: derive the target squad(s) from the rule's component (module) labels and OVERWRITE existing squad label/reviewer/mentionee lines in place with the current mapping, inserting only when none exist. A single-module rule now carries exactly one squad. Also add IsSquadValue/ToSquadLabel helpers and replace the mentionee-only normalization with NormalizeSquadTeamForms (handles reviewers + mentionees -> Azure/ team form; labels stay bare).
| Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status. |
Contributor
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the tools/Github/ParseSquadMappingList.ps1 squad-mapping sync logic so squad ownership in .github/policies/resourceManagement.yml is normalized and intended to be replaced (not accumulated) when mappings change, while also normalizing squad reviewer/mentionee team references into Azure/<team> form.
Changes:
- Adds
IsSquadValue/ToSquadLabelhelpers to identify squad values and convert team-form squads to label-form. - Reworks
AddSquadLabelsToYamlto derive target squad(s) from component (module) labels and overwrite existing squad label/reviewer/mentionee entries instead of only appending. - Replaces
NormalizeExistingSquadMentioneeswithNormalizeSquadTeamFormsto normalize both reviewers and mentionees to theAzure/<team>form.
Comment on lines
+304
to
+308
| if ($t -lt $addLabelSquadLines.Count) { | ||
| $lineIndex = $addLabelSquadLines[$t] | ||
| $indent = " " * (GetIndentLength -Line $work[$lineIndex]) | ||
| $work[$lineIndex] = "${indent}label: $squadLabel" | ||
| } elseif ($lastAddLabelLine -ge 0) { |
|
|
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.
Problem
The squad-mapping sync produced rules with two squads for the same module. Example from the latest sync (#29849), the Bot Service triage rule:
Cause
AddSquadLabelsToYamlwas add-only: it appended the module's mapped squad but never removed a squad already present. When a module's squad ownership changed, the rule accumulated both the old and new squad.Fix
Port the canonical replace-not-accumulate logic:
IsSquadValue/ToSquadLabelhelpers; replace the mentionee-only pass withNormalizeSquadTeamForms(reviewers + mentionees →Azure/team form;addLabellabels stay bare).Validation
Ran against
main's config with a mock mapping (Bot Service → act-experience-enablement-squad). The Bot Service block ends with a single squad — the stalecodegen-extensibilityis replaced, human handles (e.g.sgellock) preserved:PowerShell syntax validated. This supersedes the add-only behaviour from #29837; the next scheduled sync will emit one squad per rule.