Skip to content

fix(api): drop unemitted metadata.created from spec - #2034

Merged
mchmarny merged 2 commits into
mainfrom
fix/openapi-remove-unemitted-metadata-created
Aug 4, 2026
Merged

mchmarny merged 2 commits into
mainfrom
fix/openapi-remove-unemitted-metadata-created

Conversation

@varmesh

@varmesh varmesh commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes metadata.created from the OpenAPI contract. The spec declared an optional creation timestamp on recipe responses that the runtime has never emitted.

Motivation / Context

RecipeResultMetadata (pkg/recipe/metadata.go) has no created field and no code path emits one, so a client generated from this spec carries an accessor that is always nil, and the examples show a body shape the server
never produces.

Fixes: #1963
Related: N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • Build/CI/tooling

Component(s) Affected

  • CLI (cmd/aicr, pkg/cli)
  • API server (cmd/aicrd, pkg/server)
  • Recipe engine / data (pkg/recipe)
  • Bundlers (pkg/bundler, pkg/component/*)
  • Collectors / snapshotter (pkg/collector, pkg/snapshotter)
  • Validator (pkg/validator)
  • Core libraries (pkg/errors, pkg/k8s)
  • Docs/examples (docs/, examples/)
  • Other: ____________

Implementation Notes

Three sites in api/aicr/v1/server.yaml: the property on RecipeResponseBase.metadata, and the two examples that showed it (GET /v1/recipe 200, POST /v1/bundle request body).

Removal preferred over starting to emit a timestamp: recipes are digested for reproducibility (MarshalYAMLDeterministic), so a wall-clock value in metadata would break that contract — see the artifact-generator rule in CLAUDE.md.

No handler change: the runtime is already correct. No docs change: created was never referenced outside the spec. No new contract test: docs/contributor/api-server.md scopes new openapi_sync_test.go cases to enum-bearing fields and the /v1/bundle schema, neither of which applies.

Testing

make lint                                        # exit 0
go test -count=1 -run 'TestOpenAPI' ./pkg/server/...   # ok
make qualify                                     

Risk Assessment

  • Low — Isolated change, well-tested, easy to revert
  • Medium — Touches multiple components or has broader impact
  • High — Breaking change, affects critical paths, or complex rollout

Rollout notes: N/A

Checklist

  • Tests pass locally (make test with -race)
  • Linter passes (make lint)
  • I did not skip/disable tests to make CI green
  • I added/updated tests for new functionality
  • I updated docs if user-facing behavior changed
  • Changes follow existing patterns in the codebase
  • Commits are cryptographically signed (git commit -S)
The OpenAPI contract declared an optional metadata.created timestamp on
recipe responses, but RecipeResultMetadata has no such field and no code
path emits one, so a generated client carries an accessor that is always
nil.

Removes the property from RecipeResponseBase.metadata and scrubs it from
the two examples that showed it.

The spec was also inconsistent with itself: the strict v1alpha3 metadata
wrapper constrains propertyNames to an enum that already excluded
created, so a client generated against v1alpha3 got a field the same
spec rejects.

Removal is preferred over starting to emit a timestamp: recipes are
digested for reproducibility (MarshalYAMLDeterministic), and a
wall-clock value in metadata would break that contract.

Fixes #1963

Signed-off-by: Varun Ramesh <varamesh@nvidia.com>
@varmesh varmesh self-assigned this Aug 4, 2026
@varmesh
varmesh requested a review from a team as a code owner August 4, 2026 15:47
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The OpenAPI specification removes the created timestamp from RecipeResponseBase.metadata. It also removes the timestamp from the GET /v1/recipe and POST /v1/bundle examples.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: mchmarny, yuanchen8911

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes remove metadata.created from the schema and both examples, satisfying all coding objectives in issue #1963.
Out of Scope Changes check ✅ Passed The pull request only changes the specified OpenAPI schema and examples; no unrelated changes are present.
Title check ✅ Passed The title clearly summarizes the main change: removing the unemitted metadata.created field from the OpenAPI specification.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation, implementation details, and rationale for removing metadata.created from the spec.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/openapi-remove-unemitted-metadata-created

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Coverage Report ✅

Metric Value
Coverage 81.6%
Threshold 80%
Status Pass
Coverage Badge
![Coverage](https://img.shields.io/badge/coverage-81.6%25-brightgreen)

No Go source files changed in this PR.

@mchmarny mchmarny left a comment

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.

APPROVE — reviewed the OpenAPI contract cleanup at fdc1ff7; 0 blockers. Focused OpenAPI tests and YAML lint pass, and required CI is green.

@mchmarny
mchmarny enabled auto-merge (squash) August 4, 2026 17:24
@mchmarny
mchmarny merged commit b8d410f into main Aug 4, 2026
39 checks passed
@mchmarny
mchmarny deleted the fix/openapi-remove-unemitted-metadata-created branch August 4, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants