Skip to content

feat: cancel expired invitations through the API and the CLI - #3246

Merged
vitorbari merged 3 commits into
mainfrom
2851-cancel-expired-invitations
Nov 23, 2026
Merged

vitorbari merged 3 commits into
mainfrom
2851-cancel-expired-invitations

Conversation

@vitorbari

Copy link
Copy Markdown
Contributor

Context

Summary

  • DELETE /invitations/{invitation_id} removes any invitation that wasn't accepted: pending, expired or rejected. Before, an expired one answered 404 and kept its row and metadata until a cleanup job that doesn't exist yet, so the only way to remove it was to replace it with a new link.
  • Cancel now uses DeleteUnacceptedInvitation, the statement replace already uses, and DeleteCancellableInvitation is removed from all three dialects. An accepted invitation still answers 404.
  • zitadel invitation cancel accepts expired invitations, offers them in its picker, and sends no invitation_cancelled for one, as for a declined invitation: an expired journey already counts as not accepted.
  • The mock API follows the server, and ADR 086 gets an amendment.

Notes

🤖 Generated with Claude Code

DELETE /invitations/{invitation_id} now removes any invitation that
wasn't accepted, expired ones included, so an administrator can drop an
expired invitation and its metadata without making a new link. Cancel
reuses DeleteUnacceptedInvitation, the statement replace already uses,
and DeleteCancellableInvitation is gone.

`zitadel invitation cancel` accepts and offers expired invitations, and
sends no invitation_cancelled for one, as for a declined invitation.
ADR 086 gets an amendment.

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

vercel Bot commented Nov 23, 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 23, 2026 3:11pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 2aa55eb

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

This PR includes changesets to release 27 packages
Name Type
@zitadel/cli Minor
@zitadel/server Minor
@zitadel/testing Minor
@zitadel/server-darwin-arm64 Minor
@zitadel/server-darwin-x64 Minor
@zitadel/server-linux-arm64 Minor
@zitadel/server-linux-x64 Minor
@zitadel/server-win32-x64 Minor
@zitadel/api Minor
@zitadel/components Minor
@zitadel/config Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-core Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-qwik-router Minor
@zitadel/sdk-react Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-sveltekit Minor
@zitadel/sdk-tanstack-start Minor
@zitadel/sdk-vue Minor
@zitadel/cloud Patch
@zitadel/client-sdk-contract Patch
@zitadel/server-sdk-contract 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

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

cursor Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Thermo-nuclear code quality review

Verdict: APPROVE

Structurally this is the right change. The dramatic code-judo move was taken: cancel collapses onto DeleteUnacceptedInvitation and DeleteCancellableInvitation is deleted end-to-end. Net complexity goes down.

What already looks good

  • Parallel storage API removed (interface + dialects + stmttest + mocks) instead of widened for expired
  • Cancel aligned with replace on one predicate: unaccepted rows
  • CLI/mock guards flipped to denylist (accepted only), matching the DB invariant
  • Docs/OpenAPI/changesets/SKILL and tests move with the behavior

Findings (inline below)

  1. Important — ADR invitation_cancelled wording can be misread as a domain-event rule
  2. Suggestion — cancellable status list still has no single source of truth
  3. Suggestion — nested ternary in cancellableHint

No file-size crossings, no spaghetti growth on the server path, no missed dramatic simplification. No structural rework required — ADR clarity + optional CLI DRY.

Full canvas: https://cursor.com/canvas/store-0f6ecd11-edf3-4341-b0b8-e199f87ca11d/49daf42e-ad29-482a-b1dc-ee6334f0bf73

Comment thread docs/adrs/086-invitations.md Resolved

@adlerhurst adlerhurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good to me. Cursor found some inconsistencies.

`invitation list`'s default and the cancel picker read one
UNACCEPTED_INVITATION_STATUSES, and cancel's hints point at the plain
list, which shows exactly those. The picker's hint switches on the
status. ADR 086's amendment names the product event and the audit event
apart.

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

Copy link
Copy Markdown
Contributor Author

looks good to me. Cursor found some inconsistencies.

@adlerhurst , thanks. I will address the Cursor findings and merge the PR.

@vitorbari
vitorbari added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit f7e9a4a Nov 23, 2026
17 checks passed
@vitorbari
vitorbari deleted the 2851-cancel-expired-invitations branch November 23, 2026 15:26
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Nov 23, 2026
fforootd added a commit that referenced this pull request Nov 24, 2026
fforootd added a commit that referenced this pull request Nov 24, 2026

This branch was successfully deployed

1 active deployment
Preview — 2aa55ebf Deployed Nov 23, 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.

2 participants