Repair main golangci-lint SA1019 baseline (trait-profile deprecations)#181
Conversation
The 2026-07-21 baton-sdk dependency bump deprecated the trait-level profile/status/icon/created_at options, turning `verify / lint` red on main across untouched trait-profile call sites (15 SA1019 findings, golangci-lint v2.11.4). Migrate producers to the resource-level replacements (WithResourceProfile / WithResourceStatus / WithResourceIcon / WithResourceCreatedAt) and switch reads to the fallback-aware resourceSdk.GetProfile. Connector output is preserved: profile/icon/ created_at relocate from the deprecated, duplicated trait fields to their canonical Resource-level attributes with identical values, and status is preserved on both levels. Invitation status intentionally keeps WithStatus(UNSPECIFIED) under a targeted //nolint:staticcheck: WithResourceStatus would let NewUserTrait force the (unset) trait status to ENABLED, misrepresenting a pending or expired invite as an enabled user. Verified with CI-exact golangci-lint v2.11.4 (0 issues), the full test suite + race on pkg/connector, go build, and go generate. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Connector PR Review: Repair main golangci-lint SA1019 baseline (trait-profile deprecations)Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0 Review SummaryFull PR diff scanned for security and correctness. This PR migrates deprecated trait-level Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. |
What & why
main'sverify / lintjob has been red since the 2026-07-21 dependency bump(last green run
2026-07-21T11:27:49Z; the followingchore: update dependency & Go versionscommit turned it red). The bump shipped a baton-sdk that deprecatesthe trait-level
profile/status/icon/created_atoptions — the datamoved from the individual traits to canonical attributes on
Resource. golangci-lintv2.11.4 (the version the reusable
verifyworkflow installs) reports exactly15
SA1019findings across trait-profile call sites that this PR does nototherwise change.
This is a standalone prerequisite that repairs that baseline. It contains no
feature work.
Baseline (pristine
main, CI-exact golangci-lint v2.11.4 → 15 issues)api_token.go:30WithSecretCreatedAtWithResourceCreatedAtapp.go:42WithAppProfileWithResourceProfileapp_test.go:41,44app.GetProfile(read)resourceSdk.GetProfile(resource)invitation.go:67WithUserProfileWithResourceProfileinvitation.go:68WithStatusinvitation_test.go:260,261ut.Profile(read)resourceSdk.GetProfile(r)org_role.go:57WithRoleProfileWithResourceProfileteam.go:48WithGroupProfileWithResourceProfileteam.go:167,288teamTrait.Profile/groupTrait.Profile(read)rType.GetProfile(resource)user.go:51,52,60WithUserProfile/WithStatus/WithUserIconWithResourceProfile/WithResourceStatus/WithResourceIconApproach — smallest behavior-preserving migration
field both on the trait and (via a sync helper) on the resource; the new options
write the resource-level attribute directly. Values are identical — profile/icon/
created_at simply move to their canonical, non-deprecated home. Each resource still
carries its trait annotation (
WithAppTrait()/ empty trait-option slices), soGetAppTrait/GetUserTrait/etc. still resolve.GetProfile. Both the production reads inteam.go(org-ID lookup forteam grants) and the test reads now use the SDK's fallback-aware
GetProfile(resource)(resource-level first, trait fallback for older data), so theconnector's own write/read path stays consistent.
userstatus is drift-free.WithResourceStatus(RESOURCE_STATUS_ENABLED)setsthe resource status;
NewUserTraitstill defaults the unset trait status toENABLED,so both levels match the previous output exactly.
expired user that must not be reported as enabled.
WithResourceStatuscannotexpress this: dropping the trait option would let
NewUserTraitforce the traitstatus to
ENABLED, flipping the emitted status fromUNSPECIFIEDtoENABLED. Theline keeps
WithStatus(UNSPECIFIED)under a targeted, explained//nolint:staticcheck(the same backward-compat pattern the SDK itself uses),preserving
UNSPECIFIEDon both the trait and the mirrored resource level.The
repository.go:158G115gosec finding some local golangci-lint versions emit isnot part of this baseline — CI's v2.11.4 does not report it, it is not
SA1019, andit is not from the dependency bump. It is left untouched.
Verification
0 issueson this branch (was 15 onmain).go test ./... -count=1green;go test -race ./pkg/connector/ -count=1green, no race warnings.go build ./...andmake build(runsgo generate ./pkg/config) clean; no generated-file drift.identical, relocated to the Resource-level attributes the SDK now reads; status preserved
on both levels (ENABLED for users, UNSPECIFIED for invitations).
Relationship to #180
PR #180 (delete-marker idempotency) adds zero new lint issues but cannot go fully
green while
main's lint baseline is red. This PR is the prerequisite that makesmainlint-green. #180 should rebase onto
mainafter this merges — no changes to #180'sbranch or semantics are needed or included here.
🤖 Generated with Claude Code