Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pb/c1/connector/v2/annotation_trait.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions pb/c1/connector/v2/annotation_trait_protoopaque.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pkg/types/resource/user_trait_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,13 @@ func TestUserTrait(t *testing.T) {
require.Equal(t, ut.GetEmails()[1].GetAddress(), "bob@example.com")
require.Equal(t, v2.UserTrait_ACCOUNT_TYPE_SERVICE, ut.GetAccountType())
}

func TestUserTraitInvitationAccountType(t *testing.T) {
ut, err := NewUserTrait(
WithEmail("invitee@example.com", true),
WithAccountType(v2.UserTrait_ACCOUNT_TYPE_INVITATION),
)
require.NoError(t, err)
require.Equal(t, v2.UserTrait_ACCOUNT_TYPE_INVITATION, ut.GetAccountType())
require.NoError(t, ut.ValidateAll())
}
4 changes: 4 additions & 0 deletions proto/c1/connector/v2/annotation_trait.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ message UserTrait {
ACCOUNT_TYPE_HUMAN = 1;
ACCOUNT_TYPE_SERVICE = 2;
ACCOUNT_TYPE_SYSTEM = 3;
// 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;

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.

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

}
AccountType account_type = 5 [(validate.rules).enum = {defined_only: true}];

Expand Down
Loading