Skip to content

Migrate off deprecated trait profile/status attributes - #28

Merged
laurenleach merged 1 commit into
mainfrom
lauren/migrate-deprecated-trait-attrs
Aug 7, 2026
Merged

Migrate off deprecated trait profile/status attributes#28
laurenleach merged 1 commit into
mainfrom
lauren/migrate-deprecated-trait-attrs

Conversation

@laurenleach

Copy link
Copy Markdown
Contributor

baton-sdk v0.20.6 moved profile, status, and created_at off the trait
messages onto attributes on Resource, deprecating the trait-level options and
getters. staticcheck flags every remaining call with SA1019, so verify / lint
is red on main.

This migrates the connector to the resource-level API:

  • With{User,Group,Role,App}Profile -> WithResourceProfile
  • WithStatus / WithDetailedStatus -> WithResourceStatus
  • WithCreatedAt / WithSecretCreatedAt -> WithResourceCreatedAt
  • trait GetProfile() / GetStatus() reads -> the equivalent read on the resource

The option type changes from a *TraitOption to a ResourceOption, so the calls
move out of the trait slice and into the variadic tail of the New*Resource call.
The two status enums are numerically identical, so the values map 1:1. Non-deprecated
trait data (login, aliases, emails, secret type/expiry) is untouched.

No behavioural change intended: the deprecated options already populated the
resource-level fields. golangci-lint run ./... reports 0 issues after this
change, and the package tests pass.

baton-sdk v0.20.6 moved `profile`, `status`, and `created_at` off the trait
messages onto attributes on `Resource`, deprecating the trait-level options and
getters. staticcheck flags every remaining call with `SA1019`, so `verify / lint`
is red on `main`.

This migrates the connector to the resource-level API:

- `With{User,Group,Role,App}Profile` -> `WithResourceProfile`
- `WithStatus` / `WithDetailedStatus` -> `WithResourceStatus`
- `WithCreatedAt` / `WithSecretCreatedAt` -> `WithResourceCreatedAt`
- trait `GetProfile()` / `GetStatus()` reads -> the equivalent read on the resource

The option type changes from a `*TraitOption` to a `ResourceOption`, so the calls
move out of the trait slice and into the variadic tail of the `New*Resource` call.
The two status enums are numerically identical, so the values map 1:1. Non-deprecated
trait data (login, aliases, emails, secret type/expiry) is untouched.

No behavioural change intended: the deprecated options already populated the
resource-level fields. `golangci-lint run ./...` reports 0 issues after this
change, and the package tests pass.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: Migrate off deprecated trait profile/status attributes

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base fb558ceeb6ac.
Review mode: full
View review run

Review Summary

The full PR diff was scanned for security and correctness. The change is confined to pkg/connector/user.go: it moves WithUserProfile and WithStatus out of the UserTraitOption slice and into the variadic ResourceOption tail as WithResourceProfile and WithResourceStatus. I verified against baton-sdk v0.22.0 (already pinned in go.mod, which is unchanged in this PR) that NewUserResource appends WithUserTrait last, and that syncUserTraitToResource only mirrors trait fields onto the resource when the resource-level field is not already set, so the new explicit resource options win and are not clobbered by the trait sync. The SDK source also documents that UserTrait_Status_Status and Status_ResourceStatus have identical enum values, confirming the 1:1 status mapping, and the empty details argument matches the previously-empty value. No remaining deprecated trait profile/status/created-at calls exist elsewhere in pkg/, and no resource IDs, entitlement slugs, parent hierarchy, or trait types changed, so this is not a breaking change. No new issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.


Reviewed head SHA: a3b9d42 (base fb558ce)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

@laurenleach
laurenleach merged commit 8668dc6 into main Aug 7, 2026
11 checks passed
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