feat(proto): add ACCOUNT_TYPE_INVITATION to UserTrait.AccountType - #1102
feat(proto): add ACCOUNT_TYPE_INVITATION to UserTrait.AccountType#1102mstanbCO wants to merge 1 commit into
Conversation
Lets connectors mark an account that exists in the source system as a pending invitation rather than a real human or service account. Co-authored-by: c1-squire-dev[bot] <c1-squire-dev[bot]@users.noreply.github.com>
| // An invitation to join the app that has not been accepted yet. The | ||
| // account exists in the source system and can hold grants, but no person | ||
| // or service is behind it until the invite is accepted. | ||
| ACCOUNT_TYPE_INVITATION = 4; |
There was a problem hiding this comment.
🟡 Suggestion (confidence: medium-high): The PR description says older consumers will see this value "fall through to their default branch," which understates the rollout constraint. account_type carries (validate.rules).enum = {defined_only: true}, and the generated validator looks up UserTrait_AccountType_name at runtime (pb/c1/connector/v2/annotation_trait.pb.validate.go:181) — so any reader still on a pre-this-PR SDK that calls UserTrait.Validate()/ValidateAll() will reject value 4 rather than default it, and older protojson readers using DiscardUnknown will silently coerce it to ACCOUNT_TYPE_UNSPECIFIED.
The change itself is correctly additive; the ask is just a rollout note in the PR/commit stating that platform and downstream readers must be on an SDK containing this enum value before any connector starts emitting it.
General PR Review: feat(proto): add ACCOUNT_TYPE_INVITATION to UserTrait.AccountTypeBlocking Issues: 0 | Suggestions: 1 | Threads Resolved: 0 Review SummaryScanned the full PR diff for security and correctness. This is a purely additive proto enum addition ( Risk triage (per Verified during review:
Security IssuesNone found. Correctness IssuesNone found. Suggestions
Prompt for AI agents |
What
Adds a fourth value to
UserTrait.AccountTypeinproto/c1/connector/v2/annotation_trait.proto:Connectors can now mark an account as a pending invitation — it exists in the source system and can hold grants, but no person or service is behind it until the invite is accepted — instead of forcing it into
HUMAN,SERVICE, orSYSTEM.Changes
proto/c1/connector/v2/annotation_trait.proto— new enum value with a comment describing its semantics.pb/c1/connector/v2/annotation_trait{,_protoopaque}.pb.go— regenerated viabuf generate.pkg/types/resource/user_trait_test.go— test assertingWithAccountType(ACCOUNT_TYPE_INVITATION)survivesNewUserTrait(the human default only applies toUNSPECIFIED) and passesValidateAllunder thedefined_onlyenum rule.No Go helper changes were needed:
WithAccountTypealready takes the enum, andpkg/c1zsanitizecopies the field verbatim.Compatibility
Additive only — new enum number, nothing renumbered or removed.
buf breaking --against mainis clean. Consumers that switch on the enum will seeACCOUNT_TYPE_INVITATIONfall through to their default branch until they handle it explicitly.Verification
buf lint,buf format -w(no diff),buf breaking --against '.git#branch=main'— cleango build ./...go test ./pkg/types/resource/... ./pkg/c1zsanitize/...— passgolangci-lint run pkg/types/resource/...— 0 issues