Skip to content

nhi: emit ACCOUNT_TYPE_SERVICE for Temporal Cloud service accounts#82

Open
c1-squire-dev[bot] wants to merge 2 commits into
mainfrom
nhi/fix-account-type
Open

nhi: emit ACCOUNT_TYPE_SERVICE for Temporal Cloud service accounts#82
c1-squire-dev[bot] wants to merge 2 commits into
mainfrom
nhi/fix-account-type

Conversation

@c1-squire-dev
Copy link
Copy Markdown

@c1-squire-dev c1-squire-dev Bot commented May 31, 2026

NHI Phase-1 — Temporal Cloud (RFC v6 §6 row 21, §5.9.2 C1)

Fixes the K2 account-type classification for Temporal Cloud. Tagged class C + B in the coverage matrix.

Finding

pkg/connector/helpers.go (protoUserToResource) emitted WithAccountType(ACCOUNT_TYPE_HUMAN) unconditionally on every principal returned by GetUsers.

Grounding (the SA discriminator)

Verified against the real Temporal Cloud API (go.temporal.io/cloud-sdk@v0.3.1):

  • identityv1.User / UserSpec carry no human-vs-service discriminator field (UserSpec = {Email, Access}). GetUsers returns only human identities — so HUMAN on that path is actually correct, not a fabricated default.
  • Service accounts are a wholly distinct identity: CloudService.GetServiceAccountsidentityv1.ServiceAccount ({Id, Spec{Name, Access, Description}, ...}, no email). They were not synced at all today.

So the "wrong-type" finding (C) is in substance an under-syncing one (B): the fix is a new service-account syncer, not a discriminator on the user path.

Changes

  • resource_types.go — add service-account resource type (TRAIT_USER).
  • helpers.go — add protoServiceAccountToResource, emitting WithAccountType(ACCOUNT_TYPE_SERVICE); document the GetUsers-is-humans-only invariant on protoUserToResource.
  • service_accounts.go (new) — serviceAccountBuilder, List over GetServiceAccounts (paginated, mirrors userBuilder), Entitlements/Grants empty.
  • connector.go — register newServiceAccountBuilder.
  • go.mod — bump baton-sdk v0.10.0 → v0.11.0 (D-345 interim).

account_type has no axis-2 detail param (per RFC §2.8/§2.9) — none added.

Verification

  • go build ./... ✅ · go vet ./... ✅ · go test ./... ✅ · gofmt -l clean · golangci-lint run 0 issues

Ready for review — do not merge.

@c1-squire-dev c1-squire-dev Bot requested a review from a team May 31, 2026 15:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 31, 2026

Connector PR Review: nhi: emit ACCOUNT_TYPE_SERVICE for Temporal Cloud service accounts

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Review mode: full
View review run

Review Summary

This PR adds a new serviceAccountBuilder that syncs Temporal Cloud service accounts as user resources with ACCOUNT_TYPE_SERVICE. The implementation correctly follows existing patterns: pagination uses SDK bags with the shared paginate helper, the resource ID uses the stable API identifier (proto.GetId()), the display name falls back to the ID when the spec name is empty, and the builder is properly registered in ResourceSyncers(). Documentation and capabilities JSON are updated to reflect sync-only support. No security, correctness, or style issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

@c1-squire-dev c1-squire-dev Bot force-pushed the nhi/fix-account-type branch from 67253a5 to cbc343c Compare May 31, 2026 16:54
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

pquerna and others added 2 commits June 1, 2026 04:16
NHI Phase-1 class-C/B fix (RFC v6 §6 row 21, §5.9.2 C1).

helpers.go previously emitted ACCOUNT_TYPE_HUMAN for every principal. Per the
Temporal Cloud API, GetUsers returns only human identities (identityv1.User has
no human/service discriminator), so HUMAN there is correct — the wrong-type
finding is really an under-syncing one: service accounts are a distinct identity
(GetServiceAccounts -> identityv1.ServiceAccount) that was not synced at all.

- Add a service-account resource type (TRAIT_USER).
- Add protoServiceAccountToResource emitting WithAccountType(SERVICE).
- Add serviceAccountBuilder (List over GetServiceAccounts) and register it.
- Bump baton-sdk v0.10.0 -> v0.11.0 (D-345 interim).

Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
@c1-squire-dev c1-squire-dev Bot force-pushed the nhi/fix-account-type branch from 405b303 to 7f17088 Compare June 1, 2026 04:18
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

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