Skip to content

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

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#19
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.

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
@laurenleach
laurenleach merged commit 173b5f7 into main Jul 31, 2026
9 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

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

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

Review Summary
Scanned the full PR diff for security and correctness. The only functional change is pkg/connector/users.go:99, switching res.GetProfile() to resource.GetProfile(res); I verified against the vendored SDK that resource.GetProfile reads the resource-level profile first and falls back to the deprecated UserTrait profile, so this correctly restores grant generation for data synced before the trait-profile migration. The write side (WithResourceProfile) is unchanged, so both new and old data resolve. The remaining ~1400 lines are gofmt doc-comment reformatting across vendor/ and conf.gen.go (verified: comments/whitespace only, no functional code and no go.mod/go.sum change). No new issues found.

Security Issues
None found.

Correctness Issues
None found.

Suggestions

  • Diff-wide: a one-line fix is bundled with ~1400 lines of unrelated gofmt vendor/generated-file churn (164 vendor files + pkg/config/conf.gen.go), which obscures review; consider isolating toolchain reformatting into a separate commit/PR.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

Suggestions:

In pkg/config/conf.gen.go and vendor:
- This PR mixes one functional line (pkg/connector/users.go line 99) with ~1400 lines
  of gofmt doc-comment/whitespace reformatting across 164 vendor files and the generated
  conf.gen.go. These reformatting changes are benign (comments and blank-line/tab
  normalization only, with no go.mod/go.sum change), but they make the functional change
  hard to review. Consider committing toolchain-driven gofmt/vendor reformatting
  separately from the behavioral fix so future diffs stay focused.

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

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