Skip to content

Audit non-accelerator enums for Go-type vs OpenAPI/docs drift (platform, error codes) #629

Description

@yuanchen8911

Context

While reviewing PR #625 (accelerator enum alignment), Codex surfaced two additional enum drifts that follow the same pattern but are structurally different enough to warrant their own PR. The new "enum update" rule added in #625 (.claude/CLAUDE.md line 559) prescribes the audit approach for both.

Scope

1. Platform enum drift + missing RecipeCriteria property

Code source of truth: pkg/recipe/criteria.go:210 defines CriteriaPlatformType with values kubeflow, dynamo, nim.

Drift:

  • api/aicr/v1/server.yaml platform enum still lists only kubeflow/any — missing dynamo and nim. At least two enum blocks to update, same pattern as the accelerator fix in fix(docs/api): fix, clean up docs and add doc update audit rule #625.
  • More substantively: the RecipeCriteria schema at api/aicr/v1/server.yaml:1222 has no platform property at all. This needs a new schema block written (not just an enum extension) — use the service / accelerator properties in the same schema as templates.
  • Doc pages that enumerate platforms need updating too (docs/README.md glossary and any contributor docs that list platform values).

2. Error-code drift

Code source of truth: pkg/errors/errors.go:21 defines ErrCode* constants (INTERNAL, NOT_FOUND, UNAUTHORIZED, TIMEOUT, SERVICE_UNAVAILABLE, INVALID_REQUEST).

Drift:

  • api/aicr/v1/server.yaml:1028,1167 advertise INTERNAL_ERROR — the actual wire value is INTERNAL (the server serializes string(code) directly, confirmed by running the binary: {"code":"INVALID_REQUEST",...}). Any API client that matches on INTERNAL_ERROR never sees those errors.
  • docs/user/api-reference.md:565,567 list NO_MATCHING_RULE and INTERNAL_ERROR. Neither exists in pkg/errorsNO_MATCHING_RULE appears to be entirely invented; INTERNAL_ERROR is the same typo as above.
  • Grep every INTERNAL_ERROR in docs/ and api/aicr/v1/server.yaml and reconcile with pkg/errors/errors.go.

Risk consideration: this is a wire-value correction. External clients that coded handlers against the documented (wrong) names never actually matched; the fix reveals accurate behavior but may surface latent handler bugs in caller code. Worth a visible call-out in the PR description so API consumers notice.

Acceptance criteria

  • api/aicr/v1/server.yaml platform enum matches CriteriaPlatformType exactly.
  • RecipeCriteria schema in server.yaml has a platform property (string, enum, default any) consistent with the other CriteriaXxx properties in the same schema.
  • Every error-code string advertised in server.yaml and in docs/user/api-reference.md matches a constant in pkg/errors/errors.go.
  • New "enum update" rule bullet (.claude/CLAUDE.md:559) is used as the audit driver, and any additional audit targets discovered during this work are added to the bullet.
  • make qualify passes.

Why not folded into #625

  • platform needs a new OpenAPI schema property, not just enum extension — different shape of change.
  • Error-code rename has potential external-client blast radius — warrants its own PR description and visibility, not buried in a multi-finding cleanup.
  • fix(docs/api): fix, clean up docs and add doc update audit rule #625 was already at 6+ force-pushes from iterative review rounds; further scope expansion increases review burden for diminishing per-round value.

Related

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions