Skip to content

Squad sync: one squad per module (replace stale squads)#29852

Open
a0x1ab wants to merge 1 commit into
Azure:mainfrom
a0x1ab:squad-mapping-single-squad
Open

Squad sync: one squad per module (replace stale squads)#29852
a0x1ab wants to merge 1 commit into
Azure:mainfrom
a0x1ab:squad-mapping-single-squad

Conversation

@a0x1ab

@a0x1ab a0x1ab commented Jul 15, 2026

Copy link
Copy Markdown
Member

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:

mentionees:
- sgellock
- Azure/act-codegen-extensibility-squad
- Azure/act-experience-enablement-squad   # ← second squad
- addLabel: { label: act-codegen-extensibility-squad }
- addLabel: { label: act-experience-enablement-squad }   # ← second squad

Cause

AddSquadLabelsToYaml was 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:

  • Derive the target squad(s) from the rule's component (module) labels via the wiki mapping.
  • Overwrite existing squad label/reviewer/mentionee lines in place with the current mapping; only insert when none exist.
  • A single-module rule now carries exactly one squad.
  • Add IsSquadValue/ToSquadLabel helpers; replace the mentionee-only pass with NormalizeSquadTeamForms (reviewers + mentionees → Azure/ team form; addLabel labels 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 stale codegen-extensibility is replaced, human handles (e.g. sgellock) preserved:

mentionees:
- sgellock
- Azure/act-experience-enablement-squad
- addLabel: { label: act-experience-enablement-squad }

PowerShell syntax validated. This supersedes the add-only behaviour from #29837; the next scheduled sync will emit one squad per rule.

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).
Copilot AI review requested due to automatic review settings July 15, 2026 10:56
@azure-client-tools-bot-prd

Copy link
Copy Markdown
Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

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.

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 / ToSquadLabel helpers to identify squad values and convert team-form squads to label-form.
  • Reworks AddSquadLabelsToYaml to derive target squad(s) from component (module) labels and overwrite existing squad label/reviewer/mentionee entries instead of only appending.
  • Replaces NormalizeExistingSquadMentionees with NormalizeSquadTeamForms to normalize both reviewers and mentionees to the Azure/<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) {
@github-actions

Copy link
Copy Markdown

‼️ DO NOT MERGE THIS PR ‼️
This PR was labeled "Do Not Merge" because it contains code change that cannot be merged. Please contact the reviewer for more information.

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.

3 participants