fix: migrate off deprecated SDK trait options to fix lint#43
Conversation
baton-sdk v0.19.0 marked the trait-level profile/created_at/status options and group-trait GetProfile as deprecated (SA1019). Migrate to the resource-level equivalents: - WithGroupProfile/WithUserProfile -> WithResourceProfile - WithCreatedAt -> WithResourceCreatedAt - WithStatus -> WithResourceStatus (status enum: UserTrait_Status_Status -> Status_ResourceStatus) - groupTrait.GetProfile() -> resourceSdk.GetProfile(resource) Fixes the 6 SA1019 staticcheck failures on the Verify / lint job. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Connector PR Review: fix: migrate off deprecated SDK trait options to fix lintBlocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0 Review SummaryThe full PR diff was scanned for security and correctness. This change migrates Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. |
Recent baton-sdk versions moved profile, status, icon, and created_at from the individual traits to attributes on Resource, deprecating the trait-level options. CI's staticcheck flags the old ones as SA1019. Following the same migration as ConductorOne/baton-procore#43: WithUserProfile / WithGroupProfile / WithRoleProfile -> WithResourceProfile WithStatus(v2.UserTrait_Status_STATUS_*) -> WithResourceStatus(v2.Status_RESOURCE_STATUS_*, "") userTrait.GetProfile() -> resource.GetProfile(res) The trait options move out of the trait slice and into the variadic ResourceOption list. Traits themselves are unchanged: users keep their email trait, groups keep GroupTrait, roles keep RoleTrait. resource.GetProfile falls back to the deprecated trait-level profile, so reads still work against data written by earlier connector versions. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Why lint broke on main
baton-sdkwas bumped v0.18.4 → v0.19.0 (commit89aee42), which addedSA1019deprecation annotations to several trait-level resource options. PR #42'sverify / linthad passed because its branch was last linted against v0.18.4, where those functions weren't yet deprecated — GitHub doesn't re-run a PR's checks against latest main at merge time. Once #42 merged, the post-merge push to main linted the SDK bump and the connector code together for the first time, and staticcheck fired on all 6 call sites.Fix
Migrate off the deprecated trait options to the resource-level equivalents:
WithGroupProfile/WithUserProfileWithResourceProfileWithCreatedAtWithResourceCreatedAtWithStatus(UserTrait_Status_Status)WithResourceStatus(Status_ResourceStatus)groupTrait.GetProfile()resourceSdk.GetProfile(resource)The profile/created_at/status options move out of the trait-option slice into the variadic
ResourceOptions ofNewUserResource/NewGroupResource.Verification
go build ./cmd/baton-procore✅golangci-lint run --timeout=6m→ 0 issues ✅go test -mod=vendor ./...✅🤖 Generated with Claude Code