Fix: Patch comparison for Teams plugin to match on slug instead of name on NOP - #1070
Open
StephHope wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns the Teams plugin’s nop-mode (dry-run PR comment) diff behavior with the real sync logic by ensuring array-item identity matches on team slug rather than GitHub’s display name, eliminating phantom add/delete noise when nothing actually changes.
Changes:
- Normalize fetched team records so
nameis set toslug(aftercheckSecurityManager) to keepMergeDeep.compareDeep()pairing consistent with slug-based sync decisions. - Add a regression unit test covering the slug-vs-display-name mismatch case in nop mode (both unchanged and permission-changed scenarios).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/plugins/teams.js | Normalizes team name to slug post-security-manager filtering so nop diffs pair teams correctly and avoid phantom add/delete output. |
| test/unit/lib/plugins/teams.slug-fix.test.js | Adds regression coverage ensuring nop-mode output is quiet for unchanged teams and remains focused for real permission changes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
StephHope
force-pushed
the
fix-teams-slug-comparison
branch
from
August 21, 2026 04:48
df99e75 to
79cbca7
Compare
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.
Fixes #1033
Problem
In nop mode (PR comment / dry-run diffing), the Teams plugin's diff compares existing GitHub teams against the configured teams by matching on
name. GitHub's team list API returns each team's displayname(e.g. "Platform Engineering"), whilesettings.ymlconfigures teams byslug(e.g.platform-engineering). Whenever a team's display name differs from its slug, the comparator treats the existing team and the configured team as unrelated entries, reporting a phantom addition + deletion for a team that hasn't actually changed - even though the real (non-nop) sync already matches correctly on slug.Fix
Teams.find()now normalizes each fetched team'snameto itsslug(after thecheckSecurityManagerfilter), so the nop-mode diff pairs teams the same way the real sync does.Testing
Added
test/unit/lib/plugins/teams.slug-fix.test.js, covering: