fix(api): drop unemitted metadata.created from spec - #2034
Merged
Merged
Conversation
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>
Contributor
📝 WalkthroughWalkthroughThe OpenAPI specification removes the Estimated code review effort: 1 (Trivial) | ~3 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Contributor
Coverage Report ✅
Coverage BadgeNo Go source files changed in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes
metadata.createdfrom 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 nocreatedfield 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 servernever produces.
Fixes: #1963
Related: N/A
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component/*)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)Implementation Notes
Three sites in
api/aicr/v1/server.yaml: the property onRecipeResponseBase.metadata, and the two examples that showed it (GET /v1/recipe200,POST /v1/bundlerequest 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:
createdwas never referenced outside the spec. No new contract test:docs/contributor/api-server.mdscopes newopenapi_sync_test.gocases to enum-bearing fields and the/v1/bundleschema, neither of which applies.Testing
Risk Assessment
Rollout notes: N/A
Checklist
make testwith-race)make lint)git commit -S)