Skip to content

fix: migrate trait profile/status to resource-level APIs (SA1019) - #143

Merged
btipling merged 1 commit into
mainfrom
bt/fix-main-golangci-sa1019
Jul 25, 2026
Merged

fix: migrate trait profile/status to resource-level APIs (SA1019)#143
btipling merged 1 commit into
mainfrom
bt/fix-main-golangci-sa1019

Conversation

@btipling

Copy link
Copy Markdown
Contributor

Summary

Fixes Verify workflow golangci-lint SA1019 failures on main (18 staticcheck issues) after baton-sdk deprecations moved profile/status off trait protos onto Resource.

Changes

  • pkg/bcel/bcel.go: CEL resource.profile now uses sdkResource.GetProfile (resource-level with trait fallback) instead of deprecated Get*Trait(...).GetProfile().
  • pkg/bsql/resources.go:
    • User/app/group/role/agent profile mapping → WithResourceProfile
    • User/agent status mapping → WithResourceStatus (Status_ResourceStatus; agent READY maps to ENABLED)
  • pkg/bsql/nhi_test.go: assertions updated to resource-level status/profile

Non-goals

  • No CE-1007 feature work
  • No dependency version bumps
  • No new metrics

Test plan

  • golangci-lint v2.11.4 (CI version): 0 issues
  • go test ./... green
  • GitHub Actions Verify green on this PR

Resolve golangci-lint SA1019 failures on main by using
WithResourceProfile/WithResourceStatus and GetProfile/GetStatus
instead of deprecated trait-level profile and status APIs.

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@btipling
btipling requested a review from a team July 25, 2026 21:13
@github-actions

Copy link
Copy Markdown
Contributor

Connector PR Review: fix: migrate trait profile/status to resource-level APIs (SA1019)

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

Review Summary

Full PR diff scanned for security and correctness. This is a clean deprecation migration moving profile/status off trait protos onto Resource via WithResourceProfile/WithResourceStatus, with reads going through GetProfile/GetStatus (resource-level first, trait fallback). Verified against the vendored SDK v0.20.2: the option and getter functions exist and behave as described, and the AgentTrait_AgentStatus to Status_ResourceStatus mapping is safe because both enums share identical numeric values (UNSPECIFIED=0, READY/ENABLED=1, DISABLED=2, DELETED=3). All trait-level profile/status readers were migrated (only pkg/bcel/bcel.go read them), status-detail handling is preserved, and no dependency, scope, or public-behavior changes are present. No new issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@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.

@btipling
btipling merged commit 9f01eeb into main Jul 25, 2026
9 checks passed
laurenleach added a commit to ConductorOne/baton-asana that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the migration.
baton-sdk's resource.GetProfile / GetStatus read the resource-level attribute
first and fall back to the deprecated trait field, so previously-synced data
still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-freshbooks that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the migration.
baton-sdk's resource.GetProfile / GetStatus read the resource-level attribute
first and fall back to the deprecated trait field, so previously-synced data
still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-asana that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-freshbooks that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-wiz-win that referenced this pull request Jul 31, 2026
Follow-up to the trait profile/status migration.

That migration moved reads from the deprecated trait fields to the resource
itself (`r.GetProfile()`). That is correct for data written by a connector which
has already migrated, but it returns nothing for data synced **before** the
migration, where the profile still lives on the trait annotation.

baton-sdk provides compatibility getters for exactly this
(`pkg/types/resource/resource_attrs.go`): `GetProfile`, `GetStatus`,
`GetCreatedAt`, and `GetIcon` read the resource-level attribute first and fall
back to the deprecated trait field. This switches the reads to those helpers so
previously-synced data still resolves.

Reads only — the write side (`WithResourceProfile` / `WithResourceStatus`) is
unchanged. Reference: ConductorOne/baton-sql#143.

`golangci-lint run ./...` reports 0 issues and the package tests pass.
laurenleach added a commit to ConductorOne/baton-ms365 that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-notion that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-paylocity that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-rippling that referenced this pull request Jul 31, 2026
Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-freshbooks that referenced this pull request Jul 31, 2026
* Migrate off deprecated trait profile/status attributes

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.

* Use baton-sdk resource attribute helpers for profile/status reads

Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-rippling that referenced this pull request Jul 31, 2026
* Migrate off deprecated trait profile/status attributes

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` -> `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. Login and
login-alias data stays on `UserTrait` and 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.

* Use baton-sdk resource attribute helpers for profile/status reads

Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-workato that referenced this pull request Jul 31, 2026
Follow-up to the trait profile/status migration.

That migration moved reads from the deprecated trait fields to the resource
itself (`r.GetProfile()`). That is correct for data written by a connector which
has already migrated, but it returns nothing for data synced **before** the
migration, where the profile still lives on the trait annotation.

baton-sdk provides compatibility getters for exactly this
(`pkg/types/resource/resource_attrs.go`): `GetProfile`, `GetStatus`,
`GetCreatedAt`, and `GetIcon` read the resource-level attribute first and fall
back to the deprecated trait field. This switches the reads to those helpers so
previously-synced data still resolves.

Reads only — the write side (`WithResourceProfile` / `WithResourceStatus`) is
unchanged. Reference: ConductorOne/baton-sql#143.

`golangci-lint run ./...` reports 0 issues and the package tests pass.
laurenleach added a commit to ConductorOne/baton-asana that referenced this pull request Jul 31, 2026
* Migrate off deprecated trait profile/status attributes

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.

* Use baton-sdk resource attribute helpers for profile/status reads

Reading r.GetProfile() directly only resolves data written after the trait
migration. baton-sdk's resource.GetProfile / GetStatus read the resource-level
attribute first and fall back to the deprecated trait field, so previously-synced
data still resolves. Reads only; the write side is unchanged.

Reference: ConductorOne/baton-sql#143.
laurenleach added a commit to ConductorOne/baton-workato that referenced this pull request Jul 31, 2026
Follow-up to the trait profile/status migration.

That migration moved reads from the deprecated trait fields to the resource
itself (`r.GetProfile()`). That is correct for data written by a connector which
has already migrated, but it returns nothing for data synced **before** the
migration, where the profile still lives on the trait annotation.

baton-sdk provides compatibility getters for exactly this
(`pkg/types/resource/resource_attrs.go`): `GetProfile`, `GetStatus`,
`GetCreatedAt`, and `GetIcon` read the resource-level attribute first and fall
back to the deprecated trait field. This switches the reads to those helpers so
previously-synced data still resolves.

Reads only — the write side (`WithResourceProfile` / `WithResourceStatus`) is
unchanged. Reference: ConductorOne/baton-sql#143.

`golangci-lint run ./...` reports 0 issues and the package tests pass.
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