Skip to content

fix(diff): treat VPP teams as the legacy alias of fleets - #68

Merged
robbiet480 merged 1 commit into
mainfrom
fix/vpp-teams-alias
Oct 8, 2026
Merged

robbiet480 merged 1 commit into
mainfrom
fix/vpp-teams-alias

Conversation

@robbiet480

@robbiet480 robbiet480 commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

In fleet-gitops#162's plan, org_settings.mdm.volume_purchasing_program showed as modified (tagged drift), but nothing had changed. Fleet 4.92 renamed a VPP token's teams to fleets and the API now returns both, with identical members. fleet-gitops' YAML sets only fleets. The config diff compares the value as a JSON string, so the extra teams key read as a change on every plan that touched global config.

Changes

  • internal/diff: when JSON is normalized for comparison, foldTeamsAlias handles each map that has a teams key:

    • teams equal to fleets: dropped
    • teams with no fleets: renamed to fleets, so YAML using the old spelling still matches
    • teams that differs from fleets: kept, so a real mismatch still shows

    Only the compared strings change. The Old and New values in the output stay as Fleet and the YAML have them.

Test plan

  • go build ./...
  • go vet ./...
  • go test -race ./...: new TestDiffConfigVPPTeamsAlias (written first, failed before the fix) and TestFoldTeamsAlias
  • golangci-lint run reports no issues
  • Coverage did not regress (92.4% total)
  • Validated against a live Fleet instance: after release and pin bump, the VPP row is gone from fleet-gitops#162's plan

Invariants

  • API client still issues GET only — no Fleet state is mutated
  • HTTPS still enforced (FLEET_PLAN_INSECURE=1 remains the only escape hatch)
  • No secrets in code, logs, output, fixtures, or CI comments
  • No platform-specific code

🤖 Generated with Claude Code

https://claude.ai/code/session_0119pJv9MF97RkJrWyNnChjn

Summary by CodeRabbit

  • Bug Fixes
    • Configuration comparisons now recognize legacy team-membership settings and fleet settings as equivalent when they contain the same values, preventing false change reports caused by the different names.
    • Differences are still reported when the membership values do not match.

Fleet 4.92 renamed a VPP token's `teams` to `fleets` and returns both with
the same members. YAML that sets only `fleets` showed
org_settings.mdm.volume_purchasing_program as modified on every plan that
touched global config. Fold the alias when normalizing JSON for comparison:
drop a `teams` equal to `fleets`, rename a lone `teams` to `fleets`, and keep
a differing `teams` so a real mismatch still shows. Displayed values are
unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0119pJv9MF97RkJrWyNnChjn
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: c826d11d-3e16-4a88-959f-81fbad9f2851
📥 Commits

Reviewing files that changed from the base of the PR and between 13becc6 and d03f91e.

📒 Files selected for processing (2)
  • internal/diff/differ.go
  • internal/diff/differ_test.go

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

The configuration diff normalizer now handles the legacy teams key as an alias for fleets. Tests cover normalization outcomes and VPP membership comparisons.

Changes

VPP team alias normalization

Layer / File(s) Summary
Normalize team aliases in configuration diffs
internal/diff/differ.go, internal/diff/differ_test.go
The normalizer renames teams to fleets when fleets is absent, removes teams when both values match, and retains both keys when values differ. Tests cover these cases and compare equivalent VPP membership values in configuration diffs.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: ads-0x1

Merge Risk: ⚪ Minimal · up to d03f9

No actionable issue is established for this change; it is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: treating VPP teams as the legacy alias of fleets in diff handling.
Description check ✅ Passed The description follows the required template and explains the problem, implementation, tests, and invariants. Live Fleet validation remains unchecked, but the description is otherwise substantially c…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the keys at dawn,
“Teams” hops in; “fleets” carries on.
Equal lists merge and settle down,
Different lists remain around.
The diff grows quiet when values align,
Then nibbles clover by the sign.

Comment @coderabbitai help to get the list of available commands.

@robbiet480
robbiet480 merged commit 396afc3 into main Oct 8, 2026
7 checks passed
@robbiet480
robbiet480 deleted the fix/vpp-teams-alias branch October 8, 2026 06:17
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.

1 participant