Skip to content

feat(api): add the invitation event contract - #2930

Merged
vitorbari merged 5 commits into
mainfrom
2850-invitation-events
Nov 11, 2026
Merged

vitorbari merged 5 commits into
mainfrom
2850-invitation-events

Conversation

@vitorbari

Copy link
Copy Markdown
Contributor

Summary

The contract for invitation events, per ADR 086 §5. Spec, generated clients, catalog and Go payload structs only; nothing emits them yet.

  • invitation.created, invitation.accepted, invitation.rejected and invitation.cancelled in the events API union and as webhooks.
  • created and accepted carry type and its object, reusing the invitation resource's project_member / team_member schemas from feat(api): add invitations OpenAPI contract #2918.
  • cancelled carries reason (cancelled or replaced) and replaced_by_invitation_id.
  • No payload carries the invitation's metadata or its token.
  • The four types sit in events-catalog.md's Contracted section; the Go payload structs in domain/event_payload.go are for the producers to share.

Notes

Closes #2850

🤖 Generated with Claude Code

Declare invitation.created, invitation.accepted, invitation.rejected and
invitation.cancelled with the payloads from ADR 086 §5. They sit in the
events catalog's Contracted section until the invitation service emits
them (#2852, #2853). Payloads never carry metadata or the token.

The type objects reuse the invitation resource's project_member and
team_member schemas.

Closes #2850

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Nov 11, 2026 2:15pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: fdc76c5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@zitadel/server Minor
@zitadel/cli Minor
@zitadel/testing Minor
@zitadel/server-linux-x64 Minor
@zitadel/server-linux-arm64 Minor
@zitadel/server-darwin-x64 Minor
@zitadel/server-darwin-arm64 Minor
@zitadel/server-win32-x64 Minor
@zitadel/api Minor
@zitadel/config Minor
@zitadel/components Minor
@zitadel/sdk-core Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-react Minor
@zitadel/sdk-vue Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-sveltekit Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-qwik-router Minor
@zitadel/sdk-tanstack-start Minor
@zitadel/cloud Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vitorbari
vitorbari marked this pull request as ready for review November 10, 2026 13:50
Copilot AI balanced review requested due to automatic review settings November 10, 2026 13:50

Copilot AI 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.

🟡 Changes recommended

The invitation event payloads allow missing or mismatched member objects for their declared type, so consumers may not receive the promised grant details.

1 open issue
2 files not reviewed
  • packages/go/api/oas_interfaces_gen.go: Generated file
  • packages/go/api/oas_operations_gen.go: Generated file
What changed in this PR

Publishes the invitation event contract for the events API and webhooks, preparing clients for the invitation producers planned in #2852 and #2853. No events are emitted yet.

Changes:

  • Defines four invitation events and their payloads, excluding invitation metadata and tokens.
  • Adds shared Go payload structs and regenerates API schemas and client types.
  • Documents the contracted events and adds payload-mapping coverage and release notes.
File Description
packages/​go/​api/​oas_validators_gen.go Adds generated invitation event validation.
packages/​go/​api/​oas_schemas_gen.go Adds generated event and payload types.
packages/​go/​api/​oas_operations_gen.go Adds webhook operation names.
packages/​go/​api/​oas_interfaces_gen.go Adds webhook response interfaces.
docs/​design/​api/​events-catalog.md Lists invitation events as contracted.
apps/​api/​internal/​domain/​event.go Defines four invitation event constants.
apps/​api/​internal/​domain/​event_payload.go Adds shared producer payload structs.
apps/​api/​internal/​api/​generated/​oas_validators_gen.go Adds generated server-side validation.
apps/​api/​internal/​api/​generated/​oas_operations_gen.go Adds generated webhook operation names.
apps/​api/​internal/​api/​generated/​oas_interfaces_gen.go Adds generated webhook response interfaces.
apps/​api/​internal/​api/​event_map_test.go Tests invitation payload decoding into API events.
apps/​api/​api/​openapi/​openapi-spec.yaml Registers the four webhooks.
apps/​api/​api/​openapi/​endpoints/​events/​webhooks/​invitation-rejected.yaml Defines the rejection webhook contract.
apps/​api/​api/​openapi/​endpoints/​events/​webhooks/​invitation-created.yaml Defines the creation webhook contract.
apps/​api/​api/​openapi/​endpoints/​events/​webhooks/​invitation-cancelled.yaml Defines the cancellation webhook contract.
apps/​api/​api/​openapi/​endpoints/​events/​webhooks/​invitation-accepted.yaml Defines the acceptance webhook contract.
apps/​api/​api/​openapi/​endpoints/​events/​types/​invitation-rejected-event.yaml Connects rejection payload to the event envelope.
apps/​api/​api/​openapi/​endpoints/​events/​types/​invitation-created-event.yaml Connects creation payload to the event envelope.
apps/​api/​api/​openapi/​endpoints/​events/​types/​invitation-cancelled-event.yaml Connects cancellation payload to the event envelope.
apps/​api/​api/​openapi/​endpoints/​events/​types/​invitation-accepted-event.yaml Connects acceptance payload to the event envelope.
apps/​api/​api/​openapi/​endpoints/​events/​payloads/​invitation-rejected-payload.yaml Defines journey and declining-user fields.
apps/​api/​api/​openapi/​endpoints/​events/​payloads/​invitation-created-payload.yaml Defines invitation details, replacement link and expiry.
apps/​api/​api/​openapi/​endpoints/​events/​payloads/​invitation-cancelled-payload.yaml Defines cancellation reason and replacement reference.
apps/​api/​api/​openapi/​endpoints/​events/​payloads/​invitation-accepted-payload.yaml Defines invitation details and accepting-user fields.
apps/​api/​api/​openapi/​endpoints/​events/​event.yaml Extends the event union and discriminator.
apps/​api/​api/​openapi/​bundled/​openapi.json Includes the new contracts in the generated bundle.
apps/​api/​api/​cmd/​gen_event_schemas/​main.go Registers payload mappings and webhook descriptions.
apps/​api/​api/​cmd/​gen_event_schemas/​main_test.go Updates the expected event-type count.
.changeset/​invitation-events-contract.md Adds a server minor-release note.

Review effort: Balanced

Model the invitation.created and invitation.accepted payloads as a oneOf
discriminated on type, as the invitation resource is, so each variant
requires its project_member or team_member object.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI 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.

🟡 Changes recommended

The invitation-acceptance descriptions incorrectly promise a companion event for every acceptance, even when an identical active grant already exists and no new grant is created.

1 open issue
1 resolved since last review

Review effort: Balanced

Accepting with an identical active grant writes no grant, so the
invitation.accepted description no longer promises a companion event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI 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.

🟢 Approval recommended

No active review issues block the invitation event contract changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Comment thread apps/api/internal/domain/event.go Resolved
Comment thread apps/api/internal/api/event_map_test.go Resolved
vitorbari and others added 2 commits November 11, 2026 15:08
Split the invitation.cancelled payload on reason so a replaced one requires
replaced_by_invitation_id. Narrow the accepted wording to ADR 086 §4: no
grant event only when the user holds an identical active grant. List the
invitation types in the console's EVENT_TYPES, which main now checks
against the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vitorbari
vitorbari added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 2147c37 Nov 11, 2026
25 checks passed
@vitorbari
vitorbari deleted the 2850-invitation-events branch November 11, 2026 14:36
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 11, 2026

This branch was successfully deployed

1 active deployment
Preview — fdc76c53 Deployed Nov 11, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Invitations: events

3 participants