Skip to content

fix(contract): sync QuotaInfo lifetime response contract #60

Description

@robinbraemer

Problem

The released CLI v0.9.0 reproduces a response-contract failure on a read-only Production call:

printf "<JSON envelope with headers.akua-context>" | akua --output agent quotas list --input -
# HTTP 200, AKUA_API_CONTRACT_ERROR

No token or response payload needs to be captured to reproduce this. The authenticated request reaches GET /v1/quotas and fails while the generated CLI decodes the declared 200 response.

The same drift remains on current cli main (0019e0c, package 0.10.1): openapi/public.json and src/generated/openapi-api.gen.ts define QuotaInfo.type as only allocation, rate, concurrency. The authoritative CNAP public contract now also emits lifetime quotas after the durable lifetime-grant work. A normal lifetime row therefore fails strict decode. The CLI snapshot also omits producer fields scope (required; the metric/scope pair is the identity) and grant_state (optional on lifetime rows), so even a permissive decoder would lose essential semantics.

Producer history:

  • CNAP #1082 added required QuotaInfo.scope.
  • CNAP #1133 added QuotaInfo.type=lifetime and optional grant_state.
  • CNAP #1625 fixed the previous server-side Convex return-validator 500, allowing the current HTTP-200 client failure to surface.

Scope

CLI public-contract snapshot and generated artifacts only. Do not add a handwritten quotas client, raw-response fallback, response-validation bypass, or Production mutation.

The unrelated operations.list context-header drift is not part of this issue: CLI #58 already fixed that in source; an installed v0.9.0 artifact predates that release.

Acceptance criteria

  • The canonical openapi/public.json QuotaInfo fragment matches the current CNAP public producer: required scope with workspace/principal/cluster, type including lifetime, and optional grant_state with available/consumed/revoked.
  • Regenerate src/generated/commands.gen.ts, src/generated/openapi-api.gen.ts, and src/generated/public-operation-executor.gen.ts with mise run generate; do not hand-edit generated files.
  • Add a generated-command regression in test/generated-command.test.ts that supplies an HTTP-200 quotas.list payload containing a lifetime entry, scope, and grant_state, and proves the command returns a typed successful result.
  • The regression fails against the current generated schema and passes after the snapshot/generation update.
  • Run the focused test, mise run generate:check, and mise run check.

Likely minimal file set

  • openapi/public.json
  • src/generated/openapi-api.gen.ts
  • any generator-determined command/executor drift artifact
  • test/generated-command.test.ts

The implementation should source the narrow QuotaInfo snapshot fragment from the producer contract and then run the repository generator, following the targeted-contract pattern used by CLI #58 rather than weakening validation.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions