Skip to content

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

Merged
laurenleach merged 1 commit into
mainfrom
lauren.leach/use-resource-attr-helpers
Jul 31, 2026
Merged

Use baton-sdk resource attribute helpers for profile/status reads#60
laurenleach merged 1 commit into
mainfrom
lauren.leach/use-resource-attr-helpers

Conversation

@laurenleach

Copy link
Copy Markdown
Contributor

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
laurenleach requested a review from a team July 31, 2026 21:22
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: Use baton-sdk resource attribute helpers for profile/status reads

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

Review Summary

The full PR diff was scanned for security and correctness. This change swaps two direct resource.GetProfile() reads in pkg/connector/role.go (Grants and Grant) for the SDK's rs.GetProfile(...) helper, which reads the resource-level attribute first and falls back to the deprecated trait annotation. I verified the vendored helper (baton-sdk/pkg/types/resource/resource_attrs.go at v0.20.6) matches this signature and fallback behavior exactly, so profiles synced before the trait migration now resolve correctly. The remaining accountInfo.GetProfile() in collaborator.go operates on *v2.AccountInfo (not a *v2.Resource) and is correctly left unchanged. 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.

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
laurenleach force-pushed the lauren.leach/use-resource-attr-helpers branch from 5ca8fea to 18ffc35 Compare July 31, 2026 23:36

@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 57dcd1d into main Jul 31, 2026
12 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