Skip to content

UX-06: Idempotency-Key is generated by every client, never typed by a person #282

Open

Description

@ephico2real2

Part of #13

What is wrong

Every write needs an Idempotency-Key header (cmapi/src/cmapi/plugins/namespaces/router.py:45). Today a person has to make one up:

  • Swagger UI (/docs) shows an empty field. No requestInterceptor fills it (no match in cmapi/src).
  • The portal does not write yet, and no CLI or SDK exists, so no client generates one.

The owner, 2026-11-15: "no body is gonna remember this key"; "that should be auto generated and maybe valid for the session in swagger - it should auto generate one for you too".

What it must do

The API keeps requiring the key, because it is what makes an agent's retry after a timeout safe. Each client generates it, so a person never types one.

Client Behaviour
Swagger UI A requestInterceptor fills Idempotency-Key on a write when the field is empty. For the browser session it keeps one key for each distinct (method, path, body). Sending the same call again reuses its key, so it replays. A changed body gets a new key. The field is still editable, and a value the user types wins. The UI shows the key used
Portal One key for each form opening. Submitting again after an error reuses it
CLI and SDK One key for each command or call, reused on its own retries. --idempotency-key overrides it
docs/04 and the curl samples -H "Idempotency-Key: $(uuidgen)"

Why not one key for the whole Swagger session. The API returns 409 idempotency-replay when a key is reused with another request (router.py:60, repo.py:163). So a single key for the session would refuse the user's second, different write. "Valid for the session" is met by keeping one key for each distinct call for the session, which is how a retry stays safe.

Research mandate

  • Read the IETF draft "The Idempotency-Key HTTP Header Field" (httpapi WG), latest revision, for what a client must do. Read Stripe's SDK behaviour for automatic keys. Read the Swagger UI requestInterceptor documentation for the version cmapi serves.
  • Cite each with the date it was read.
  • Check CSP: the interceptor must be same-origin script under /docs's CSP (connect-src 'self' https://keycloak.apps-crc.testing), with no CDN.

How to prove it

  • A browser test on /docs: a POST with the field empty is sent with a UUID key. Sending it again sends the same key and gets the replayed response. A changed body sends a new key. A typed key is sent unchanged.
  • The test fails on the current main and passes after the change.
  • A screenshot of Swagger UI showing the key used.

Activity

  1. added
    enhancement
    status:open
    Backlog
    on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Backlogenhancementstatus:open

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions