Skip to content

feat: create, revise and read registered applications - #2901

Merged
gayathri-r-v merged 22 commits into
feat/applications-storagefrom
feat/applications-service
Nov 12, 2026
Merged

gayathri-r-v merged 22 commits into
feat/applications-storagefrom
feat/applications-service

Conversation

@gayathri-r-v

@gayathri-r-v gayathri-r-v commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Context

Summary

The third of three PRs for #2788. It adds the service layer and the API
wiring of POST /applications and GET /applications/{id}.

  • Service:
    • CreateOrRevise checks the document against application.json and the
      rules of ValidateApplicationDocument.
    • It creates the application when its slug is new in the project, and
      revises it otherwise.
    • A revise locks the row and reads the newest revision inside the
      transaction, so two concurrent revisions cannot both treat the same
      client as new.
    • Get returns the newest revision.
  • Secrets:
    • Each client a write creates gets one from secrets.Generator
      (sk_client_ + 32 base62 characters).
    • Its domain.HashSecret is stored in application_client_secrets, in the
      same transaction as the client.
    • The plaintext is returned once in client_secrets, with the client's slug
      and client_id.
    • A write that creates no client returns no client_secrets.
  • Events:
    • A create emits application.created with slug, name, client_ids and
      revision_id.
    • A revise emits application.updated with revision_id, name when it
      changed, and the client_ids the revision added.
    • client_ids lists the clients the write created, each of which got a
      secret.
    • Each event is written in the same transaction as the write. A create that
      loses the slug race emits only the update.
    • The event types, their payload schema and webhooks, and the catalog rows
      are part of this PR.
  • Unique errors are told apart by reading state after the transaction has
    ended:
    • On a create, the slug is read first. If another caller created the same
      application, that application is revised. Otherwise a supplied
      client_id that another client holds is app.client_id_taken.
    • On a revise, a held client_id is client_id_taken, anything else
      app.revision_conflict.
  • Errors: app.invalid, app.field_immutable, app.not_found,
    app.client_id_taken, app.permission_denied and
    app.revision_conflict, with their schemas, examples and status mapping
    (400, 400, 404, 409, 403, 409). The operation text lists them.
  • API:
    • the two handlers, and an access entry for ResourceKindApplication
    • The GET accepts the project secret only.
    • Idempotency-Key is accepted but not used yet; the operation text says
      so.

Validation

  • cd apps/api && go build ./... && go test ./internal/service/... ./internal/api/... ./internal/domain/... ./internal/audit/... ./api/cmd/gen_event_schemas/ ./cmd/...
  • go test -tags {sqlite,postgres}_integration ./internal/api/integration_test/ -run 'TestCreateApplication|TestApplicationAccess'
  • moon run server:generate, moon run server:openapi, moon run server:check-generate-pruned

Release notes / changeset

  • Changeset: .changeset/applications-service.md — @zitadel/server minor:
    POST /applications creates or revises an application and returns each
    new client's secret once, and GET /applications/{id} returns its newest
    revision. Each write records an application.created or
    application.updated event. Idempotency-Key is accepted but not used
    yet.

Notes

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 9, 2026

Copy link
Copy Markdown

Deployment failed for project cloud with the following error:

You don't have permission to create a Preview Deployment for this Vercel project: cloud.

View Documentation: https://vercel.com/docs/accounts/team-members-and-roles

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 0df9aa0

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

@gayathri-r-v
gayathri-r-v force-pushed the feat/applications-service branch from ae3d0d5 to 0681a39 Compare November 10, 2026 09:48
@gayathri-r-v
gayathri-r-v force-pushed the feat/applications-service branch from 4a5dcf5 to 6cf5d44 Compare November 10, 2026 10:37
@gayathri-r-v
gayathri-r-v force-pushed the feat/applications-service branch from 6cf5d44 to 63d1284 Compare November 10, 2026 10:51
@gayathri-r-v
gayathri-r-v added this pull request to stack #2924 November 10, 2026 10:52
@gayathri-r-v
gayathri-r-v force-pushed the feat/applications-service branch from 63d1284 to 71a46ee Compare November 10, 2026 11:36
@gayathri-r-v
gayathri-r-v marked this pull request as ready for review November 10, 2026 11:36
Copilot AI balanced review requested due to automatic review settings November 10, 2026 11:36

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@gayathri-r-v
gayathri-r-v force-pushed the feat/applications-service branch 4 times, most recently from 06743d0 to d3e0207 Compare November 10, 2026 16:15
@gayathri-r-v
gayathri-r-v force-pushed the feat/applications-service branch from d3e0207 to 2919220 Compare November 11, 2026 09:19
@wim07101993 wim07101993 self-assigned this Nov 12, 2026
@wim07101993
wim07101993 self-requested a review November 12, 2026 08:54
@wim07101993 wim07101993 moved this from Inbox to In progress in Engineering Kanban Nov 12, 2026
@wim07101993 wim07101993 linked an issue Nov 12, 2026 that may be closed by this pull request
6 tasks
Comment thread apps/api/cmd/server/server.go Resolved
if err != nil {
return nil, err
}
app, err := toAPIApplicationResponse(result.Application)

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.

why map the application twice? First toAPIApplicationResponse then manually to the CreateApplicationResponse.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

toAPIApplicationResponse decodes the stored document into definition, and GET uses it too. ogen generates CreateApplicationResponse and ApplicationResponse as two separate structs, because create adds client_secrets. So the second step is only a field copy between the two types. Calling the helper keeps the decode in one place.

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.

but why do the intermediate step, it does not seem to contain any logic except unmarshaling the document

Comment thread apps/api/internal/api/error_handler.go Resolved
…_denied and revision_conflict errors

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gayathri-r-v and others added 17 commits November 12, 2026 11:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… service

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n and IdP services

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ation call

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@gayathri-r-v
gayathri-r-v enabled stacked auto-merge November 12, 2026 11:40
@gayathri-r-v
gayathri-r-v added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit faac989 Nov 12, 2026
18 of 19 checks passed
@gayathri-r-v
gayathri-r-v deleted the feat/applications-service branch November 12, 2026 11:52
@github-project-automation github-project-automation Bot moved this from In progress to Done in Engineering Kanban Nov 12, 2026
fforootd added a commit that referenced this pull request Nov 12, 2026
…orm project

main gained registered applications (#2901). An application's clients sign
people in to its project, so on the reserved platform project one is
configuration, as an origin is: applicationAccess sets `configuration`, and
createApplication there asks for the admin role (D42, Console ADR 0004 §1,
ADR 082).

The gate contract's table still lists createApplication as not implemented,
so its rows did not show the new resource. The platform test now reads the
resources the gate declares from its source, so one without a row in the
table has to be classed too, and it holds createApplication with a row of
its own until the table has one.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

Applications: create and read registered applications with their OAuth clients

3 participants