git:20261113.43d1baf to git:20261113.80fc7e8
1 added, 1 removed. Audit A to A.
What this update changes in the checks
No check changed: every fixed check gives the same answer before and after this update.
A tripped check is a label, not a verdict: read the matched text and the lines below. This week's updates that newly trip a check.
# Agent Instructions — `api/openapi`
The OpenAPI 3.1 sources, the contract of record for the HTTP API. Layout,
bundling, the ogen `oneOf`-null workaround and pagination how-tos are in
[`readme.md`](readme.md); read it before restructuring spec files.
## The generate loop
- Never hand-edit the ogen output, the server stubs in
`apps/api/internal/api/generated/` and the public client in
`packages/go/api/*_gen.go`, or orval's `packages/api/src/generated/`. Change
the spec, then run `turbo run generate --filter=@zitadel/server`; CI checks
the committed output with `@zitadel/server#check-generate`.
- Lint the spec with `turbo run lint --filter=@zitadel/server`: the server's
static checks include Redocly with the repo's
[`redocly.yaml`](../../../../redocly.yaml).
- Pin a known Redocly finding in `.redocly.lint-ignore.yaml` with its reason;
`scripts/lint-openapi.mjs` fails on an entry that suppresses nothing.
## Wire casing: snake_case
Wire fields, enum values and parameters are `snake_case`. Wrong casing fails
silently at runtime: an unknown property is dropped, not rejected.
- `rule/wire-field-snake-case`, `rule/wire-enum-no-camel-case` and
`rule/wire-parameter-no-camel-case` in `redocly.yaml` gate it, with
documented carve-outs (JSON Schema keywords, `x-` extensions, RFC
vocabularies, header and cookie names).
- `pnpm run check-openapi-rules` runs fixture tests
(`scripts/openapi-casing-rules.test.mjs`) that fail when a rule silently
stops matching. Keep the fixtures in step with the rules.
## Operation IDs and path parameters
An `operationId` is public: `zitadel api <operationId>`, the Go and TS client
method names, the API reference page URLs.
- Name an operation `<verb><Resource>` in camelCase, with a verb the spec
already uses and no `By…` suffix; `rule/operation-id-verb-camel-case` gates it.
- Name a path parameter after its resource (`{schema_id}`), never `{id}`;
`rule/path-parameter-not-id` gates it.
- Give a `{…_id}` path parameter a schema with a `pattern`, a $ref to its
resource's ID schema; `rule/path-id-parameter-pattern` gates it.
## Patterns say what a valid value looks like
- Give every `pattern` in the OpenAPI spec an `x-zitadel-pattern-message` beside it: the sentence
that follows the field's name when a value fails it (`must be a user ID:
user_ followed by letters, digits, _ or -`). orval's zod output carries no
message of its own, so `turbo run generate --filter=@zitadel/api` adds this one
(`packages/api/scripts/pattern-messages.ts`).
- A message belongs to the pattern's text, so fields that share a regex share
its wording. Generation fails when a pattern has no message, or when the same
pattern carries two different ones.
- Say the whole rule, not one part of it: a pattern that also refuses an empty
value or a bad character after a prefix says so.
- A pattern only in a server-side schema that the spec does not reach, such as
the `verified_claims` branch of `endpoints/schemas/idp-connection.yaml`, takes
no message: the mirror test there pins it exactly.
## Error codes
Errors are `{ code, message, details? }`
([`components/error-details.yaml`](components/error-details.yaml)). Codes are
stable, dot-namespaced (`att.invalid_proof`), and what clients branch on. The
taxonomy and producer contract:
[ADR 030](../../../../docs/adrs/030-error-model-mapping-and-reporting.md) and
[`error-details-producers.md`](../../../../docs/design/api/error-details-producers.md).
- `components/schemas/errors/` holds one schema per error code, generated by
`gen_error_schemas` from the domain errors.
- Each operation's error set is `endpoints/**/<operationId>-error-response.yaml`,
generated by `gen_openapi_errors` from what the implementation can return.
- `components/examples/errors/` holds one example per error code, also from
`gen_openapi_errors`; the error sets `$ref` it so the bundle carries it once.
- Never hand-edit either.
## Pagination and list queries
New endpoints are cursor-based (`page_token` / `next_page_token`, `limit`
default 20, max 100), and list queries are `POST /<resource>/query` with
structured `filter` / `sorting` bodies
([ADR 027](../../../../docs/adrs/027-cursor-based-pagination.md),
[ADR 031](../../../../docs/adrs/031-openapi-querying.md)). `POST /sessions/query` is
the reference implementation; the how-to is in
[`readme.md`](readme.md#api-design-conventions).
A list is the `GET` on a collection or the `POST` on its `/query`; a collection
is a path an ID follows (`/users` in `/users/{user_id}`), one that is queried,
or one a `list…` operation reads. `check-openapi-rules` checks these on the
bundle in [`openapi-list-conventions.test.mjs`](../../../../scripts/openapi-list-conventions.test.mjs).
- Return `{ <resource>: [...], next_page_token }` from a list and nothing else,
the array named after the collection's segment; `list-response-shape` gates it.
- Page a list by `page_token` and a `limit` of 1 to 100, default 20 (the shared
`limit` schema); `list-pagination` gates it.
- Sort a query by its own `<resource>-sort-field` enum, not its filter's enum;
`query-sort-field` gates it.
- Name a collection's segment as a plural snake_case noun (`/flow_definitions`);
`collection-plural` gates it.
- Name a departure in that test's `KNOWN_VIOLATIONS` (to fix) or `EXEMPT` (by
design), with its reason; an entry that finds nothing fails the test.
## Identifiers on the wire
Resource IDs are prefixed opaque strings (`user_01H…`, `proj_01H…`,
[ADR 047](../../../../docs/adrs/047-dialect-id-generation.md)); ephemeral IDs follow
[ADR 012](../../../../docs/adrs/012-ephemeral-id-api-representation.md). Use the
prefixed form in `example:` fields, never the retired dictionary slug
(`river-8421`).
- Name a resource's own ID `id`. A session, auth attempt, challenge and passkey
registration use `session_id`, `attempt_id`, `challenge_id`, `registration_id`.
## CLI commands — `x-zitadel-cli`
An operation the `zitadel` CLI runs names its command in `x-zitadel-cli`, on
- the line after its `operationId` (`x-zitadel-cli: users create`); the API
+ the line after its `operationId` (`x-zitadel-cli: user create`); the API
reference shows it beside the samples. The CLI's
[`api-coverage` test](../../../../apps/cli/tests/unit/cli/commands/api-coverage.test.ts)
fails until every command names exactly one operation it calls, and on a name
no command answers to.
## Destructive operations — `x-zitadel-destructive`
- Every `DELETE` is destructive; a `POST` that removes, revokes or rolls back
says so with `x-zitadel-destructive: true` after its `x-zitadel-cli`.
- A `PATCH` is not marked, though a merge-patch `null` removes what it names:
updates are not guarded yet, and need a follow-up of their own.
- The CLI's client only exposes a destructive operation behind a confirmation
([consent](../../../cli/src/lib/consent.ts)).
## Descriptions — the first sentence stands alone
Every operation and webhook has a `description`, the body of its API reference
page. Its first sentence, as plain text, is the page's description everywhere
else: the metadata and Open Graph image (cut at a word past 160 characters),
`llms.txt` and the MCP server's page list
([`apps/docs/lib/description.ts`](../../../../apps/docs/lib/description.ts)).
- Write in the docs' tone and terms ([`apps/docs/AGENTS.md`](../../../../apps/docs/AGENTS.md#writing)).
- Open an operation with a third-person verb ("Creates a user"); open a
webhook with what happened ("A token was revoked.").
- Keep the first sentence to 160 characters or fewer.
- Say where a required input comes from: the operation or `zitadel` command
that returns it ("the `id` that `createRelease` (`POST /releases`) returns").
- Name an operation by its `operationId` and its method and path, since API
renderers hide the ID; give the path at its first mention in a description.
- State side effects (what else changes, which webhooks fire) and how a caller
recovers from a failure it can cause.
- Leave the full error list to the operation's generated error set; describe
an error only when a caller must act on it.
- `rule/operation-description-opens-with-sentence` rejects a description that
starts with a heading, a quote (a `> **Deprecated**` note goes after the
sentence), a list, a table, a code fence or HTML.