Repository navigation
fix(diff): treat VPP teams as the legacy alias of fleets - #68
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
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. WalkthroughThe configuration diff normalizer now handles the legacy ChangesVPP team alias normalization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable issue is established for this change; it is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
A rabbit checks the keys at dawn, Comment |
Summary
In fleet-gitops#162's plan,
org_settings.mdm.volume_purchasing_programshowed as modified (tagged drift), but nothing had changed. Fleet 4.92 renamed a VPP token'steamstofleetsand the API now returns both, with identical members. fleet-gitops' YAML sets onlyfleets. The config diff compares the value as a JSON string, so the extrateamskey read as a change on every plan that touched global config.Changes
internal/diff: when JSON is normalized for comparison,foldTeamsAliashandles each map that has ateamskey:teamsequal tofleets: droppedteamswith nofleets: renamed tofleets, so YAML using the old spelling still matchesteamsthat differs fromfleets: kept, so a real mismatch still showsOnly 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 ./...: newTestDiffConfigVPPTeamsAlias(written first, failed before the fix) andTestFoldTeamsAliasgolangci-lint runreports no issuesInvariants
GETonly — no Fleet state is mutatedFLEET_PLAN_INSECURE=1remains the only escape hatch)🤖 Generated with Claude Code
https://claude.ai/code/session_0119pJv9MF97RkJrWyNnChjn
Summary by CodeRabbit