Closed
Remove redundant label validation in BatchValidateLabels#37746
Conversation
fleet-release
approved these changes
Dec 30, 2025
fleet-release
approved these changes
Dec 30, 2025
…te call The verifyLabelsToAssociate call in BatchValidateLabels was redundant because BatchValidateLabels already performs the same validation (checking label existence and accessibility) via LabelIDsByName. The redundant call was causing test failures because it requires a non-nil user, but BatchValidateLabels uses the authorization context pattern which doesn't require a user in the context. Co-authored-by: iansltx <472804+iansltx@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix failed test in fleet actions
Remove redundant label validation in BatchValidateLabels
Dec 30, 2025
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 36758-team-labels-feedback-be #37746 +/- ##
=================================================================
- Coverage 64.29% 59.61% -4.69%
=================================================================
Files 2363 2331 -32
Lines 187537 180530 -7007
Branches 8002 8002
=================================================================
- Hits 120575 107616 -12959
- Misses 55305 63093 +7788
+ Partials 11657 9821 -1836
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
BatchValidateLabelswas callingverifyLabelsToAssociate, which fails whenauthz.UserFromContextreturns nil. This broke tests using the authorization context pattern (authz_ctx.SetChecked()) without a viewer context.The call was redundant -
BatchValidateLabelsalready validates label existence and accessibility viaLabelIDsByNamewith aTeamFilteron line 810.Changes:
verifyLabelsToAssociatecall fromBatchValidateLabels(lines 822-824 inserver/service/labels.go)Checklist for submitter
Testing
Existing tests
TestBatchValidateLabelsandTestValidateSoftwareLabelsnow pass. Full service test suite passes.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build3525966261/b001/service.test /tmp/go-build3525966261/b001/service.test -test.testlogfile=/tmp/go-build3525966261/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=Test.* .cfg ux-amd64/pkg/tool/linux_amd64/vet -p ws-sdk-go-v2/int-atomic mpile ux-amd64/pkg/too-buildtags -o 9329512/b1175/_p-errorsas mpile 0.1-go1.25.5.lin-nilfunc -p github.com/open-test t 0.1-go1.25.5.lin./server/service(dns block)/tmp/go-build327650879/b001/service.test /tmp/go-build327650879/b001/service.test -test.testlogfile=/tmp/go-build327650879/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 9329512/b1087/_p-errorsas .cfg ux-amd64/pkg/tool/linux_amd64/vet -p dm/fleet/v4/serv-F mpile cG14DVMI3GmR(dns block)/tmp/go-build2908409442/b001/service.test /tmp/go-build2908409442/b001/service.test -test.testlogfile=/tmp/go-build2908409442/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true se 9329512/b223/vet.cfg 0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -p github.com/micro-c t 0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -uns�� til.go t rg/toolchain@v0.0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports t rg/toolchain@v0../server/service/software_title_icons_test.go(dns block)fleetdm.com/tmp/go-build3525966261/b001/service.test /tmp/go-build3525966261/b001/service.test -test.testlogfile=/tmp/go-build3525966261/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=Test.* .cfg ux-amd64/pkg/tool/linux_amd64/vet -p ws-sdk-go-v2/int-atomic mpile ux-amd64/pkg/too-buildtags -o 9329512/b1175/_p-errorsas mpile 0.1-go1.25.5.lin-nilfunc -p github.com/open-test t 0.1-go1.25.5.lin./server/service(dns block)/tmp/go-build327650879/b001/service.test /tmp/go-build327650879/b001/service.test -test.testlogfile=/tmp/go-build327650879/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 9329512/b1087/_p-errorsas .cfg ux-amd64/pkg/tool/linux_amd64/vet -p dm/fleet/v4/serv-F mpile cG14DVMI3GmR(dns block)/tmp/go-build2908409442/b001/service.test /tmp/go-build2908409442/b001/service.test -test.testlogfile=/tmp/go-build2908409442/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true se 9329512/b223/vet.cfg 0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -p github.com/micro-c t 0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -uns�� til.go t rg/toolchain@v0.0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports t rg/toolchain@v0../server/service/software_title_icons_test.go(dns block)https://api.github.com/repos/fleetdm/fleet/actions/runs/20588132768/artifacts/usr/bin/curl curl -s -H Accept: application/vnd.github.v3+json REDACTED(http block)vpp.itunes.apple.com/tmp/go-build3525966261/b001/service.test /tmp/go-build3525966261/b001/service.test -test.testlogfile=/tmp/go-build3525966261/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=Test.* .cfg ux-amd64/pkg/tool/linux_amd64/vet -p ws-sdk-go-v2/int-atomic mpile ux-amd64/pkg/too-buildtags -o 9329512/b1175/_p-errorsas mpile 0.1-go1.25.5.lin-nilfunc -p github.com/open-test t 0.1-go1.25.5.lin./server/service(dns block)/tmp/go-build327650879/b001/service.test /tmp/go-build327650879/b001/service.test -test.testlogfile=/tmp/go-build327650879/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 9329512/b1087/_p-errorsas .cfg ux-amd64/pkg/tool/linux_amd64/vet -p dm/fleet/v4/serv-F mpile cG14DVMI3GmR(dns block)/tmp/go-build2908409442/b001/service.test /tmp/go-build2908409442/b001/service.test -test.testlogfile=/tmp/go-build2908409442/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true se 9329512/b223/vet.cfg 0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -p github.com/micro-c t 0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -uns�� til.go t rg/toolchain@v0.0.1-go1.25.5.linux-amd64/pkg/tool/linux_amd64/vet -c=4 -nolocalimports t rg/toolchain@v0../server/service/software_title_icons_test.go(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.