Skip to content

feat(recipe): implement the ADR-015 profile core - #1933

Merged
yuanchen8911 merged 1 commit into
NVIDIA:mainfrom
yuanchen8911:feat/adr15-profile-core
Jul 30, 2026
Merged

yuanchen8911 merged 1 commit into
NVIDIA:mainfrom
yuanchen8911:feat/adr15-profile-core

Conversation

@yuanchen8911

@yuanchen8911 yuanchen8911 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implement the ADR-015 configuration-profile core without adopting it in an existing recipe family. This adds fail-closed profile resolution and ownership locking, strict v2 API and artifact contracts, and documentation for the supported integration boundaries.

Motivation / Context

Recipes need to capture mutually exclusive, qualified installation modes as part of the resolved recipe rather than relying on bundle-time overrides. This is the first roll-in PR: AKS adoption will follow, then GKE adoption.

Fixes: N/A
Related: #1761, #1716

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: API contract, client SDK, serializer, configuration, mirror discovery, evidence, and TestGrid publishing

Implementation Notes

  • Enforce one effective profile declaration per resolved composition. Selection is deterministic through the declared default or an explicit name=value.
  • Validate declaration structure, union totality (every value assigns the same flattened override paths), ownership conflicts, canonical JSON/YAML-shaped override containers with recursively string-keyed and acyclic values, and an explicit scalar allowlist with finite numbers, JSON round-trip-safe integers, and YAML timestamps.
  • Limit value-bearing profile ownership to Helm components. Kustomize components may participate only through a valueless presence lock because their deployment path does not consume Helm values.
  • Record the selected profile and owned paths in aicr.run/v1alpha3 RecipeResult artifacts. Unprofiled results retain the legacy API version and behavior.
  • Resolve directly loaded profile overlays through the active catalog and require the effective applied declaration to structurally match after JSON normalization. Equivalent renamed overlays are accepted; stale or divergent declarations fail closed.
  • Revalidate inline and hydrated profile-owned values when adopting or loading raw RecipeResult artifacts, before observation or serialization, and enforce the same lock at recipe, bundle, mirror, and Argo CD Helm boundaries.
  • Honor cancellation throughout catalog profile projection and response conversion. Sort profile-owned component checks so invalid external compositions produce deterministic diagnostics.
  • Preserve v1 compatibility while exposing strict profile-aware /v2/recipe, /v2/query, and /v2/bundle routes. V2 POST bodies accept only application/json and application/x-yaml, and nested criteria reject unknown fields.
  • Keep HTTP route versions and persisted recipe apiVersions independent. /v2/recipe can return either aicr.run/v1alpha2 or aicr.run/v1alpha3, while /v2/bundle accepts both plus versionless legacy artifacts.
  • Align the published /v1/bundle request schema with the input the runtime already accepts. BundleRecipeRequest requires neither header field and admits an empty apiVersion or kind, matching a legacy artifact decoded and remarshaled through RecipeResult (neither field carries omitempty). Header enums move from RecipeResponseBase onto each wrapper, so GET /v1/recipe responses stay strict. Fixes the same contract drift as Align /v1/bundle OpenAPI schema with versionless legacy recipe support #1941 on the v1 route.
  • Model /v2/bundle as a version-partitioned union without an apiVersion discriminator. Legacy artifacts stamped aicr.run/v1alpha2 or omitting apiVersion reuse the additive known-field schema and cannot carry a profile lock; aicr.run/v1alpha3 is closed and requires metadata.selectedProfile.
  • Decode metadata.excludedOverlays by artifact version. Legacy artifacts accept string entries and additive objects with a nonempty name; v1alpha3 requires closed objects with a nonempty name and a recognized optional reason. Profile artifacts also require complete constraintWarnings entries; the schema defines every ComponentRef field type and closes nested expected-resource objects.
  • Document supported 401, 404, 503, and 504 /v2/bundle failures from vendored-chart and upstream operations.
  • Preserve ConfigMap authorization failures as UNAUTHORIZED and context or Kubernetes API timeout failures as TIMEOUT. Warn when a preinstalled driver conflicts with a profile-owned driver setting.
  • Keep unsupported advertiser, allocation-policy, canonical-descriptor, and qualification-evidence fields fail closed. No recipe family adopts profiles in this PR.

Testing

# Full PR validation completed before the final review-fix deltas.
unset GITLAB_TOKEN && make qualify
golangci-lint run -c .golangci.yaml ./...

# Focused validation of the latest review-fix delta, rerun after the latest rebase.
GOFLAGS="-mod=vendor" go test -race -count=1 ./pkg/recipe \
  -run '^(TestValidateProfileDeclaration|TestValidateRecipeMetadataProfileYAMLScalars|TestProfileResolutionGuards|TestListCatalogWithProfiles_ProjectsEffectiveDeclaration|TestListCatalogWithProfilesCanceled|TestValidateProfileValuesRejectsInvalidBaseline|TestValidateProfileValuesRejectsUnsupportedArtifactScalars|TestValidateProfileValuesScopesArtifactValidationToOwnedPaths|TestValidateProfileValuesKustomizeOwnership)$'
GOFLAGS="-mod=vendor" go test -race -count=1 ./pkg/client/v1 \
  -run '^(TestResolveRecipeWithProfile|TestAdoptRecipe_DeepCopiesForClientIsolation|TestAdoptRecipe_RejectsCyclicProfileOverridesBeforeDeepCopy)$'
GOFLAGS="-mod=vendor" go test -race -count=1 ./pkg/bundler/deployer/argocdhelm \
  -run '^(TestGenerate_ProfileLockTemplate|TestHasGeneratedProfileLockHeader_BoundedRead|TestWriteProfileLockTemplateRejectsUnownedExistingFile)$'

# Focused OpenAPI validation from the preceding review-fix delta.
GOFLAGS="-mod=vendor" go test -race -count=1 ./pkg/server \
  -run '^TestOpenAPIV2BundleContract$'

# Focused validation from the preceding review-fix delta.
GOFLAGS="-mod=vendor" go test -race ./pkg/recipe \
  -run '^(TestMetadataStore_EvaluateOverlayConstraints|TestEvaluateMixinConstraintsRejectsIncompleteConstraint)$'
GOFLAGS="-mod=vendor" go test -race ./pkg/serializer \
  -run '^TestClassifyConfigMapGetError$'
GOFLAGS="-mod=vendor" go test -race ./pkg/server \
  -run '^TestProfileAwareBundleEndpoints$'

# Affected-package lint and contract checks across the review-fix deltas.
golangci-lint run -c .golangci.yaml \
  ./pkg/recipe/... ./pkg/server/... ./pkg/serializer/...
yamllint -c .yamllint.yaml api/aicr/v1/server.yaml
git diff --check origin/main...HEAD

# Documentation-only version-axis clarification.
./tools/check-docs-mdx
lychee --offline --no-progress \
  docs/user/api-reference.md docs/integrator/data-flow.md docs/integrator/go-library.md

The full qualification run passed, including race-enabled unit tests, the 80% aggregate coverage gate (81.0%), lint, 23 end-to-end suites, vulnerability scanning, license checks, and repository-specific validation. Coverage comparisons against origin/main found no affected package decrease greater than 0.5 percentage points.

Across the review-fix deltas, the focused race tests above and affected-package Go lint passed with zero issues. Focused YAML lint and diff checks passed, and independent review feedback on the delta was addressed. The final documentation changes passed the MDX safety check, offline link checks, diff check, and an independent review with zero findings. Full qualification, full-module lint, and coverage were not rerun after those deltas.

Independent verification (commit a941f19e5)

The CLI, server, and aicrd were rebuilt from this revision and compared against main at 905bec6e1. Every comparison asserts non-empty output and reports byte or file counts. A run that fails identically on both binaries is classified separately and never registers as a pass.

Regression — no output difference anywhere. 800 comparisons across the full catalog (all 100 resolvable entries; monitoring-hpa is excluded because its criteria are entirely any and nothing resolves it).

  • recipe: 100 comparisons, 8,306,000 bytes of generated YAML, 0 diffs
  • bundle: 500 comparisons (100 entries × helm, argocd, argocd-helm, flux, helmfile), 22,603 files compared with diff -r, 0 diffs
  • query: 100 comparisons, 0 diffs
  • mirror list: 100 comparisons, 0 diffs
  • recipe list: identical, 14,240 bytes

Fifty bundle comparisons produced no comparison: the ten AKS entries fail on both binaries at the keyless-toleration gate, which requires --accelerated-node-toleration. They are counted as bothfail, not as agreement. The AKS bundle path is covered separately by the live-cluster run below, which passes that flag.

Profile mechanism. The catalog declares no profile, so the regression sweep above exercises only the unprofiled path. Two things cover the new path instead.

TestProfileResolutionEndToEnd and its siblings in pkg/recipe/profile_integration_test.go layer a profiled overlay from testdata/profile-overlay/ over the embedded catalog and resolve through the ordinary Builder, so criteria matching, declaration discovery, value selection, override merging, and ownership locking run together rather than as isolated units. Eleven subtests cover default and explicit selection, the owned-path union, override delivery to the componentRefs, the raw-artifact gate, four fail-closed selections, and the legacy half of the biconditional. Both directions were confirmed to fail when the fixture is perturbed: flipping the declared default fails the selection assertion, and dropping one value's override trips union totality.

The fixture is test input, not catalog. It carries no distinguishing constraint, which ADR-015 requires of a shippable declaration, and the file says so — the driver-ownership signal does not exist yet.

Beyond CI, the same mechanism was driven manually through an out-of-tree --data overlay to cover bundle rendering, which the integration tests do not reach.

  • Both values resolve to aicr.run/v1alpha3 with metadata.selectedProfile populated, and bundle cleanly under helm (321 files), argocd (290), and argocd-helm (307) — 1,836 files in total.
  • Selecting the other value changes exactly the two owned paths plus the recorded selection, and nothing else: a three-line diff between the resolved recipes.
  • ownedPaths spans both components, including the synthetic enabled presence path.
  • Fail-closed paths reject as expected: unknown profile value, wrong profile name, and a --set diverging from a profile-owned path.
  • The main binary reads the same profiled overlay as aicr.run/v1alpha2 with no selectedProfile, confirming the mechanism is inert to anything that does not understand it.

Live cluster — AKS H100 (aicr-test6, 2× ND96isr_H100_v5, Kubernetes 1.35). Run against a pinned kubeconfig with the cluster identity verified before use.

  • Snapshot captured from real hardware: 111,221 bytes.
  • Recipe resolved from that live snapshot is identical on both binaries: 79,057 bytes.
  • Bundles from the live recipe are identical across all five deployers: 274 files.
  • aicr validate passed all three phases against the cluster — deployment, conformance, and performance including nccl-all-reduce-bw.

API surface, live against aicrd. Fifteen checks, all passing; byte counts are asserted so a 200 with an empty body fails.

  • /v1/recipe and /v2/recipe return identical bodies for unprofiled criteria: 76,439 bytes each.
  • /v2 accepts application/json and application/x-yaml, and rejects a missing content type, text/plain, and the undeclared application/yaml alias.
  • /v2 rejects unknown envelope fields and unknown query parameters; /v1 remains lenient as designed. Both reject explicit profile input against an unprofiled composition.
  • /v2/query returns a 16,168-byte body.

Review-fix verification. Each fix in this round was checked against a failing state rather than only a passing one.

  • Union totality now matches ADR-015, which evaluates it before synthetic presence paths are added. The earlier implementation folded the synthetic enabled marker into the comparison and rejected a declaration whose values legitimately differ in which components they reference presence-only.
  • Inline ownership requires PathPresent for every non-synthetic owned path. Requiring merely "not absent" left a hole: overrides of {"driver": null} observe as PathBlocked inline, and mergeValues deletes a nil-valued key, so the hydrated observation is PathAbsent and neither check fired. Reproduced before the fix, and the added test fails when the fix is reverted.
  • Profile-value constraints are now shape-validated at catalog load, matching the fail-closed treatment overlay and mixin constraints already receive.
  • The /v2/bundle schema widening was validated with a draft-4 schema validator over real generated artifacts — the check a request-validating gateway or codegen client performs, and one a live request cannot make, since the server accepted these bodies either way.
artifact pre-fix schema this revision
apiVersion: "", kind: "" rejected — matched no oneOf branch accepted
apiVersion absent accepted accepted
aicr.run/v1alpha2 accepted accepted
aicr.run/v1alpha3 profiled accepted accepted

Each shape matches exactly one branch, so the widening admits the round-tripped legacy body without relaxing the versioned ones.

The full ./pkg/... ./cmd/... suite passes: 75 packages ok, 0 failures. golangci-lint run ./... reports 0 issues.

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

The mechanism spans recipe generation, APIs, clients, serialization, and bundle paths. It remains dormant until a recipe composition declares a profile. Compatibility tests cover unprofiled and legacy behavior, while strict v2 media-type and artifact handling intentionally reject undeclared or contradictory inputs.

Rollout notes: No recipe family adopts profiles in this PR. Follow-up PRs will adopt the mechanism for AKS first and GKE next.

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) — GPG signing info

@yuanchen8911 yuanchen8911 changed the title WIP: Add ADR-015 configuration profile core WIP: Implement the profile core in ADR-015 Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Recipe evidence check

No leaf overlays affected by this PR.

This gate is warning-only and never blocks merge.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds configuration profiles with strict validation, profile-aware resolution, selected-profile metadata, ownership locking, and catalog projection. Introduces strict v2 recipe, query, and bundle endpoints while preserving legacy v1 behavior. Propagates profile selection through CLI, configuration, client APIs, bundling, Helm deployment, mirror discovery, serialization, evidence projection, and TestGrid publication. Updates API schemas and documentation accordingly.

Estimated code review effort: 5 (Critical) | ~120 minutes

Suggested labels: area/recipes, area/tests

Suggested reviewers: mchmarny, lockwobr

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately captures the PR’s main change: implementing the ADR-015 profile core in recipe.
Description check ✅ Passed The description is clearly related to the changeset and summarizes the profile core, strict v2 routes, and compatibility goals.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 18

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pkg/server/serve_test.go (1)

80-103: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

This test asserts against its own literal, not against Serve's route table.

routes is a copy of the map in serve.go, so len(routes) != 6 and the membership loop can never detect a route that Serve forgot to register — the two can drift freely. Extracting the map into an unexported newRoutes(h, bh) helper in serve.go and having both Serve and this test call it would make the v2 additions actually covered.

♻️ Sketch
+// serve.go
+func newRoutes(h *recipeHandler, bh *bundleHandler) map[string]http.HandlerFunc {
+	return map[string]http.HandlerFunc{
+		"/v1/recipe": h.HandleRecipes,
+		"/v1/query":  h.HandleQuery,
+		"/v1/bundle": bh.HandleBundles,
+		"/v2/recipe": h.HandleRecipesV2,
+		"/v2/query":  h.HandleQueryV2,
+		"/v2/bundle": bh.HandleBundlesV2,
+	}
+}
-	routes := map[string]http.HandlerFunc{
-		"/v1/recipe": h.HandleRecipes,
-		...
-	}
+	routes := newRoutes(h, bh)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/server/serve_test.go` around lines 80 - 103, Extract the route map
construction from Serve into an unexported newRoutes(h, bh) helper in serve.go,
returning the complete v1 and v2 route table. Update Serve to use this helper,
and update the test to obtain routes through newRoutes instead of duplicating
the literal map so membership and count assertions validate the production route
table.
docs/integrator/data-flow.md (1)

260-285: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Show metadata.selectedProfile in the structure diagram.

The new text promises selected profile and owned paths, but the diagram’s metadata section does not show them. Add the v1alpha3-only field to avoid presenting an incomplete artifact shape.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/integrator/data-flow.md` around lines 260 - 285, Add
metadata.selectedProfile to the RecipeResult structure diagram’s metadata
section, marking it as v1alpha3-only and showing the selected profile value.
Keep the existing metadata fields and diagram structure unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/aicr/v1/server.yaml`:
- Around line 2236-2263: Align the v2 request schema with the handler’s strict
decoding by documenting that nested criteria rejects unknown fields. Update the
`Criteria` schema or introduce a v2-specific criteria schema, or explicitly
state this constraint in the `RecipeV2Request` and `QueryV2Request`
descriptions; keep the existing envelope structure and strict behavior
unchanged.
- Around line 855-1275: Add a 413 Payload Too Large response to the POST
/v2/recipe and POST /v2/query OpenAPI definitions, matching the handlers’
MaxRecipePOSTBytes behavior. Document the response with the standard
X-Request-Id header and Error schema, alongside the existing 400/429/500
responses for createRecipeV2 and createQueryV2.

In `@docs/design/015-recipe-configuration-profiles.md`:
- Around line 311-316: Update the `#1761` reference in the fragment schema
section so it remains inline text or uses valid Markdown link syntax; do not
leave it at the start of a line where it is parsed as an ATX heading.

In `@docs/integrator/data-flow.md`:
- Around line 260-262: Update the Markdown fence around the RecipeResult diagram
in the data-flow documentation to use the text language label (`text`) instead
of an unlabeled fence, while preserving the diagram content unchanged.

In `@docs/integrator/recipe-development.md`:
- Around line 503-509: Revise the “Activation gate” section to remove the
requirement that the resolved overlay declare gpu-operator.driver.enabled=false
before driver auto-detection runs. Explain that profiles only prevent injection
from modifying an owned path, and document the existing static configuration
prerequisite separately while preserving the only-false behavior and EKS
warning.

In `@pkg/client/v1/aicr_internal_test.go`:
- Around line 1201-1228: Strengthen TestAdoptRecipe_BoundsProviderIO by ensuring
the deadlineRequiredProvider wrapper records ReadFile/WalkDir activity and
asserting the counter is non-zero after AdoptRecipe succeeds. Use a
profile-bearing recipe fixture with RecipeProfileAPIVersion and
Metadata.SelectedProfile if needed to force PrepareAndValidateWithContext into
ValidateProfileValuesWithContext and exercise the bounded provider I/O path.

In `@pkg/mirror/discover_test.go`:
- Around line 394-422: Extract the repeated profiled recipe setup into a
package-scoped newProfiledRecipe helper, preserving the gpu-operator component
and SelectedProfile values. Also consolidate the duplicated ComponentPath.Parse
logic into a mustParseOverride(t, raw) helper, then replace both fixture copies
and local parsing helpers with these shared functions.
- Around line 699-728: Add the complementary test
TestDiscover_RegistryFailureWithoutOverridesIsNotFatal near
TestDiscover_OverrideAliasRegistryFailureIsFatal, using the malformed registry
and component setup but no WithValueOverrides option. Assert Discover returns no
error, preserving the behavior that registry parsing is skipped when no
overrides are configured.

In `@pkg/recipe/catalog.go`:
- Around line 98-113: The per-entry logic in
MetadataStore.ListCatalogWithProfiles repeatedly scans overlays and resolves
inheritance, causing quadratic catalog listing. Memoize resolved profile
declarations using each entry’s criteria fingerprint, or pre-resolve once per
declaring overlay and reuse the results when assigning profileSummary; preserve
the existing error propagation and output behavior.

In `@pkg/recipe/loader.go`:
- Around line 90-114: Update LoadFromFileWithProvider to read the profile
artifact once and retain its raw bytes, then pass those bytes into
recipe.DecodeRecipeResult so strict profile validation and inputAPIVersion
detection use the same document. Remove the second
serializer.FromFileWithKubeconfigContext decode for RecipeProfileAPIVersion
while preserving provider binding through dp and the existing kind validation.

In `@pkg/recipe/profile_resolution.go`:
- Around line 223-225: Replace the unstable sort.Slice call ordering
mergedSpec.Constraints with a stable sort while preserving the existing
Name-based comparison. Update the sorting logic in the profile resolution flow
so constraints with identical names retain their original order and produce
reproducible artifacts.
- Around line 227-236: Update the component lookup in the profile-resolution
loop around componentIndex and mergedSpec.ComponentRefs to check whether
profileRef.Name exists before using its index. If the component is unknown, fail
closed using the surrounding function’s established error-handling behavior;
only initialize, copy, and merge Overrides after a valid index is confirmed.

In `@pkg/recipe/profile_test.go`:
- Around line 231-252: Update the table-driven tests around
ValidateProfileDeclaration to add a wantOwned map[string][]string field to each
case and compare owned against it without branching on tt.name. Add or adjust an
invalid case so Default is a valid identifier while a per-value name is invalid,
ensuring profile.go’s per-value validation path is exercised.

In `@pkg/recipe/profile.go`:
- Around line 402-410: Move the r == nil guard in PrepareAndValidateWithContext
before calling r.PrepareAndValidate(), returning nil immediately for a nil
receiver. Preserve the existing validation flow for non-nil results, including
the Metadata.SelectedProfile check and ValidateProfileValuesWithContext call.

In `@pkg/serializer/reader_test.go`:
- Around line 1470-1475: Add a table-driven test case alongside the existing
“legacy non-strict JSON remains additive” case in the reader tests, using
non-strict JSON input containing a valid JSON value followed by another
document. Assert that this trailing-document input remains accepted under legacy
non-strict behavior, while keeping the existing strict-mode rejection coverage
unchanged.

In `@pkg/server/bundle_handler.go`:
- Around line 109-125: The decode paths return bare errors and lose structured
error codes. In pkg/server/bundle_handler.go lines 109-125, update the JSON
decoder, io.ReadAll, and recipe.DecodeRecipeResult failures to use
aicrerrors.PropagateOrWrap with the appropriate error code and context; in
pkg/recipe/decode.go lines 35-60, wrap serializer.NewReader failures with
errors.PropagateOrWrap. Preserve existing successful decode behavior and
structured codes.

In `@pkg/server/recipe_handler.go`:
- Around line 128-176: Remove the unreachable second http.MaxBytesError handling
branch after body decoding; io.ReadAll in the recipe POST read path already
handles and returns for that error. Keep the existing read-error handling and
decode/validation flow unchanged for all other errors.
- Around line 629-655: The body-format resolution logic in
legacyRecipeBodyFormat and legacyQueryBodyFormat should be moved into shared
helpers under pkg/recipe, alongside the corresponding parsers. Preserve each
parser’s exact Content-Type rules, including YAML recognition and JSON defaults
for criteria versus JSON detection and YAML defaults for query bodies, then
update the v1 profile guard to call those shared helpers instead of local
implementations.

---

Outside diff comments:
In `@docs/integrator/data-flow.md`:
- Around line 260-285: Add metadata.selectedProfile to the RecipeResult
structure diagram’s metadata section, marking it as v1alpha3-only and showing
the selected profile value. Keep the existing metadata fields and diagram
structure unchanged.

In `@pkg/server/serve_test.go`:
- Around line 80-103: Extract the route map construction from Serve into an
unexported newRoutes(h, bh) helper in serve.go, returning the complete v1 and v2
route table. Update Serve to use this helper, and update the test to obtain
routes through newRoutes instead of duplicating the literal map so membership
and count assertions validate the production route table.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 49c7e94d-51a1-40a2-91a9-bc757c76a29a

📥 Commits

Reviewing files that changed from the base of the PR and between 97e3f8b and 09e5cec.

📒 Files selected for processing (65)
  • api/aicr/v1/server.yaml
  • docs/contributor/api-server.md
  • docs/contributor/recipe.md
  • docs/design/015-recipe-configuration-profiles.md
  • docs/integrator/data-flow.md
  • docs/integrator/go-library.md
  • docs/integrator/recipe-development.md
  • docs/user/api-reference.md
  • docs/user/cli-config.md
  • docs/user/cli-reference.md
  • pkg/bundler/bundler.go
  • pkg/bundler/bundler_test.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/validations/checks.go
  • pkg/bundler/validations/checks_test.go
  • pkg/cli/consts.go
  • pkg/cli/mirror.go
  • pkg/cli/query.go
  • pkg/cli/query_test.go
  • pkg/cli/recipe.go
  • pkg/cli/recipe_test.go
  • pkg/client/v1/aicr.go
  • pkg/client/v1/aicr_internal_test.go
  • pkg/client/v1/aicr_test.go
  • pkg/client/v1/bundle.go
  • pkg/client/v1/gpu_driver_state.go
  • pkg/client/v1/stability_test.go
  • pkg/client/v1/types.go
  • pkg/component/overrides.go
  • pkg/component/overrides_test.go
  • pkg/config/accessors.go
  • pkg/config/accessors_test.go
  • pkg/config/config.go
  • pkg/config/config_test.go
  • pkg/config/validate.go
  • pkg/evidence/project/synthesize.go
  • pkg/evidence/project/synthesize_test.go
  • pkg/mirror/discover.go
  • pkg/mirror/discover_test.go
  • pkg/recipe/builder.go
  • pkg/recipe/catalog.go
  • pkg/recipe/decode.go
  • pkg/recipe/loader.go
  • pkg/recipe/loader_test.go
  • pkg/recipe/metadata.go
  • pkg/recipe/metadata_store.go
  • pkg/recipe/metadata_store_test.go
  • pkg/recipe/profile.go
  • pkg/recipe/profile_resolution.go
  • pkg/recipe/profile_test.go
  • pkg/recipe/query.go
  • pkg/serializer/reader.go
  • pkg/serializer/reader_test.go
  • pkg/server/bundle_handler.go
  • pkg/server/bundle_handler_test.go
  • pkg/server/consts.go
  • pkg/server/doc.go
  • pkg/server/recipe_handler.go
  • pkg/server/recipe_handler_test.go
  • pkg/server/serve.go
  • pkg/server/serve_test.go
  • pkg/server/server.go
  • tools/testgrid-publish/bundle.go
  • tools/testgrid-publish/bundle_test.go

Comment thread api/aicr/v1/server.yaml Resolved
Comment thread api/aicr/v1/server.yaml Resolved
Comment thread docs/integrator/data-flow.md Resolved
Comment thread docs/integrator/recipe-development.md Resolved
Comment thread pkg/recipe/profile.go Resolved
Comment thread pkg/serializer/reader_test.go Resolved
Comment thread pkg/server/bundle_handler.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from 09e5cec to dd0b710 Compare July 28, 2026 05:20
@yuanchen8911

Copy link
Copy Markdown
Contributor Author

Addressed the two outside-diff observations in dd0b710:

  • The RecipeResult diagram now shows metadata.selectedProfile with its name, value, owned paths, and v1alpha3-only scope.
  • The production route table now comes from newRoutes, and TestRouteConfiguration exercises that same table instead of duplicating it.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

♻️ Duplicate comments (2)
pkg/serializer/reader_test.go (1)

1463-1521: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Still missing the legacy non-strict YAML trailing-document case.

A past review flagged this same gap: the legacy/non-strict rows only cover JSON (unknown field + trailing document); non-strict YAML is untested for trailing-document tolerance. A regression that applies YAML trailing-document rejection unconditionally would pass this table undetected.

💚 Proposed additional case
 		{
 			name:   "legacy non-strict JSON accepts trailing document",
 			format: FormatJSON,
 			input:  `{"name":"test","value":1} {"name":"other","value":2}`,
 		},
+		{
+			name:   "legacy non-strict YAML tolerates trailing document",
+			format: FormatYAML,
+			input:  "name: test\nvalue: 1\n---\nname: other\nvalue: 2\n",
+		},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/serializer/reader_test.go` around lines 1463 - 1521, Add a non-strict
YAML test case to TestReader_Strict covering multiple YAML documents separated
by a document marker, with strict set to false and no expected error. Keep the
existing legacy non-strict JSON cases unchanged and verify the test preserves
trailing-document tolerance for YAML.
pkg/recipe/catalog.go (1)

94-120: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Memoization keyed on leaf Criteria likely doesn't fix the quadratic re-resolution.

resolvedByCriteria caches per-entry Criteria, but ListCatalog returns one entry per overlay (leaves and ancestors) and each overlay's Spec.Criteria is typically distinct from its siblings to disambiguate it — so cache hits are rare in practice, and FindMatchingOverlays + resolveProfileDeclaration (itself walking resolveInheritanceChain per matched overlay) still run close to once per catalog entry. This is the same cost profile flagged in a prior review of this function; consider memoizing per declaring overlay/ancestor chain instead (e.g., resolve declarations once per distinct base+ancestor set, then project onto entries) to actually amortize the cost across aicr recipe list calls.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/recipe/catalog.go` around lines 94 - 120, Replace the per-entry
resolvedByCriteria memoization in ListCatalogWithProfiles with caching keyed by
each distinct declaring overlay or base/ancestor chain, so
resolveProfileDeclaration and resolveInheritanceChain are performed once per
shared declaration set rather than once per leaf Criteria. Reuse the cached
effective profile when projecting profileSummary onto catalog entries, while
preserving existing filtering and resolution error behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/aicr/v1/server.yaml`:
- Around line 2383-2386: Update the advertiser field description in the API
schema to state that it must be absent for now because ValidateProfileContract
rejects any non-empty value, including external; retain the enum and clarify
that support is reserved for the future GKE allocation-policy extension.
- Around line 1262-1293: Update the POST /v2/bundle response definitions to
include a 413 Payload Too Large response, matching the existing Error schema and
response-header conventions used by the route and the corresponding v2
recipe/query POST endpoints.

In `@pkg/mirror/discover.go`:
- Around line 389-399: Add a context-cancellation check at the start of the
ComponentRefs loop in GetComponentRegistryFor, before per-component override
lookup and hydration work. Return the context error immediately when canceled,
while preserving the existing effectiveOverridesForComponent behavior and error
propagation.

In `@pkg/recipe/criteria_test.go`:
- Around line 1124-1159: Extend TestParseCriteriaFromBody with a table-driven
case using malformed JSON and an unrecognized content type, then assert the
returned error matches the unsupported-content-type error contract from the
branch in ParseCriteriaFromBody. Preserve the existing cases and verify both the
error outcome and any expected result values for this new input.

In `@pkg/recipe/profile.go`:
- Around line 165-217: Update the union-totality tracking in the profile value
loop so every referenced component contributes its synthetic enabled path to
valuePaths, including components with no overrides. Use the same component/path
representation as ownedSet, sort it with the existing paths, and keep the
comparison against expected so values with different component sets are
rejected.

In `@pkg/recipe/query_request.go`:
- Around line 35-42: Update QueryRequestBodyFormat to normalize contentType case
before checking for "json", so uppercase and mixed-case JSON media types return
serializer.FormatJSON while existing YAML fallback behavior remains unchanged.
Update the corresponding test expectation to cover the case-insensitive JSON
behavior.

In `@pkg/serializer/reader.go`:
- Around line 484-519: Update ReadFileBytesWithKubeconfigContext to return the
bytes already buffered by NewFileReaderWithContext via reader.input instead of
wrapping it with io.LimitReader and io.ReadAll. Remove the redundant length
validation while preserving the existing serializer creation, close handling,
format, and error behavior.

In `@pkg/server/bundle_handler_test.go`:
- Around line 161-201: Add two HTTP-level subtests alongside the existing v2
bundle cases using the shared post helper: submit profileBundleBody(t) with
set=gpu-operator:driver.enabled=true and dynamic=gpu-operator:driver.enabled
query overrides, and assert each response returns http.StatusBadRequest. These
tests should cover the profile lock enforced by ValidateProfileLock.

In `@pkg/server/recipe_handler.go`:
- Around line 227-231: Update the documented 400 responses for v1 recipe and
query endpoints in server.yaml to include the profile-based rejection from the
v1 handler, clearly indicating that profiled recipes require /v2/recipe. Keep
the existing malformed-criteria, allowlist, and uncovered-dimension causes
unchanged.
- Around line 557-565: Update decodeStrictV2Envelope and bodyHasTopLevelProfile
so serializer construction and deserialization failures are wrapped with
pkg/errors and contextual messages, ensuring client-facing errors retain the
INVALID_REQUEST code prefix. Propagate errors that already carry the correct
pkg/errors code without double-wrapping them, including failures returned by
Deserialize.

---

Duplicate comments:
In `@pkg/recipe/catalog.go`:
- Around line 94-120: Replace the per-entry resolvedByCriteria memoization in
ListCatalogWithProfiles with caching keyed by each distinct declaring overlay or
base/ancestor chain, so resolveProfileDeclaration and resolveInheritanceChain
are performed once per shared declaration set rather than once per leaf
Criteria. Reuse the cached effective profile when projecting profileSummary onto
catalog entries, while preserving existing filtering and resolution error
behavior.

In `@pkg/serializer/reader_test.go`:
- Around line 1463-1521: Add a non-strict YAML test case to TestReader_Strict
covering multiple YAML documents separated by a document marker, with strict set
to false and no expected error. Keep the existing legacy non-strict JSON cases
unchanged and verify the test preserves trailing-document tolerance for YAML.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 22042aa9-be7e-44f0-9dc3-e8004e89ade4

📥 Commits

Reviewing files that changed from the base of the PR and between 09e5cec and dd0b710.

📒 Files selected for processing (69)
  • api/aicr/v1/server.yaml
  • docs/contributor/api-server.md
  • docs/contributor/recipe.md
  • docs/design/015-recipe-configuration-profiles.md
  • docs/integrator/data-flow.md
  • docs/integrator/go-library.md
  • docs/integrator/recipe-development.md
  • docs/user/api-reference.md
  • docs/user/cli-config.md
  • docs/user/cli-reference.md
  • pkg/bundler/bundler.go
  • pkg/bundler/bundler_test.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/validations/checks.go
  • pkg/bundler/validations/checks_test.go
  • pkg/cli/consts.go
  • pkg/cli/mirror.go
  • pkg/cli/query.go
  • pkg/cli/query_test.go
  • pkg/cli/recipe.go
  • pkg/cli/recipe_test.go
  • pkg/client/v1/aicr.go
  • pkg/client/v1/aicr_internal_test.go
  • pkg/client/v1/aicr_test.go
  • pkg/client/v1/bundle.go
  • pkg/client/v1/gpu_driver_state.go
  • pkg/client/v1/stability_test.go
  • pkg/client/v1/types.go
  • pkg/component/overrides.go
  • pkg/component/overrides_test.go
  • pkg/config/accessors.go
  • pkg/config/accessors_test.go
  • pkg/config/config.go
  • pkg/config/config_test.go
  • pkg/config/validate.go
  • pkg/evidence/project/synthesize.go
  • pkg/evidence/project/synthesize_test.go
  • pkg/mirror/discover.go
  • pkg/mirror/discover_test.go
  • pkg/recipe/builder.go
  • pkg/recipe/catalog.go
  • pkg/recipe/criteria.go
  • pkg/recipe/criteria_test.go
  • pkg/recipe/decode.go
  • pkg/recipe/loader.go
  • pkg/recipe/loader_test.go
  • pkg/recipe/metadata.go
  • pkg/recipe/metadata_store.go
  • pkg/recipe/metadata_store_test.go
  • pkg/recipe/profile.go
  • pkg/recipe/profile_resolution.go
  • pkg/recipe/profile_test.go
  • pkg/recipe/query.go
  • pkg/recipe/query_request.go
  • pkg/recipe/query_test.go
  • pkg/serializer/reader.go
  • pkg/serializer/reader_test.go
  • pkg/server/bundle_handler.go
  • pkg/server/bundle_handler_test.go
  • pkg/server/consts.go
  • pkg/server/doc.go
  • pkg/server/recipe_handler.go
  • pkg/server/recipe_handler_test.go
  • pkg/server/serve.go
  • pkg/server/serve_test.go
  • pkg/server/server.go
  • tools/testgrid-publish/bundle.go
  • tools/testgrid-publish/bundle_test.go

Comment thread api/aicr/v1/server.yaml Resolved
Comment thread api/aicr/v1/server.yaml Resolved
Comment thread pkg/mirror/discover.go Resolved
Comment thread pkg/recipe/criteria_test.go Resolved
Comment thread pkg/recipe/profile.go Resolved
Comment thread pkg/recipe/query_request.go Resolved
Comment thread pkg/serializer/reader.go Resolved
Comment thread pkg/server/bundle_handler_test.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from dd0b710 to 01d8670 Compare July 28, 2026 05:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (1)
pkg/recipe/profile.go (1)

165-217: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Union totality still excludes the synthetic enabled path, so values can reference different component sets.

valuePaths collects only override-derived paths (Line 196) while ownedSet gains enabled for every referenced component (Line 205). A value that lists a componentRef with no overrides and a sibling value that omits that component entirely both produce identical valuePaths and pass the totality check, yet OwnedPaths locks a component the sibling never declares.

🐛 Include component presence in the totality comparison
 			if ownedSet[ref.Name] == nil {
 				ownedSet[ref.Name] = make(map[string]struct{})
 			}
 			ownedSet[ref.Name][profileComponentEnabledPath] = struct{}{}
+			valuePaths = append(valuePaths, ref.Name+":"+profileComponentEnabledPath)
 		}
 		sort.Strings(valuePaths)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/recipe/profile.go` around lines 165 - 217, Update the union-totality path
collection in the loop over value.ComponentRefs so every referenced component
contributes its synthetic profileComponentEnabledPath to valuePaths, including
refs with no overrides. Keep the existing override-path and ownedSet handling,
ensure the component identifier and enabled path use the same representation as
expected, and compare values based on complete component presence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/bundler/bundler.go`:
- Around line 309-312: Guard b.Config before invoking buildDynamicValuesMap in
the surrounding bundling flow, ensuring zero-value or struct-literal
DefaultBundler instances return through the existing validation path instead of
dereferencing a nil configuration. Preserve the current dynamicValues error
propagation for configured bundlers.

In `@pkg/recipe/loader.go`:
- Around line 144-151: Move the unsupported inputAPIVersion validation
immediately after inputAPIVersion is captured, before the overlay branch and any
RecipeMetadata.BuildFromCriteria hydration. Preserve the existing acceptance of
empty, supported, and RecipeProfileAPIVersion values, while returning the same
invalid-request error for unsupported versions.

In `@pkg/serializer/reader_test.go`:
- Around line 200-239: Refactor TestReadFileBytesWithKubeconfigContext into a
table-driven test containing rows for the local file, missing file, invalid
ConfigMap URI, and ConfigMap kubeconfig error cases. Store each row’s
setup/input and expected bytes/format or errors.ErrCode, then run them through
one subtest loop while preserving the existing assertions and per-case temporary
file or kubeconfig setup.

In `@pkg/serializer/reader.go`:
- Around line 123-127: Extract the duplicated option-application loop from
NewReader and NewFileReaderWithContext into a shared applyReaderOptions helper
accepting *Reader and variadic ReaderOption values; invoke this helper from both
constructors while preserving the existing nil-option check and application
order.

---

Duplicate comments:
In `@pkg/recipe/profile.go`:
- Around line 165-217: Update the union-totality path collection in the loop
over value.ComponentRefs so every referenced component contributes its synthetic
profileComponentEnabledPath to valuePaths, including refs with no overrides.
Keep the existing override-path and ownedSet handling, ensure the component
identifier and enabled path use the same representation as expected, and compare
values based on complete component presence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 79c2e062-f83c-4b06-921e-b09defabef28

📥 Commits

Reviewing files that changed from the base of the PR and between dd0b710 and 01d8670.

📒 Files selected for processing (69)
  • api/aicr/v1/server.yaml
  • docs/contributor/api-server.md
  • docs/contributor/recipe.md
  • docs/design/015-recipe-configuration-profiles.md
  • docs/integrator/data-flow.md
  • docs/integrator/go-library.md
  • docs/integrator/recipe-development.md
  • docs/user/api-reference.md
  • docs/user/cli-config.md
  • docs/user/cli-reference.md
  • pkg/bundler/bundler.go
  • pkg/bundler/bundler_test.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/validations/checks.go
  • pkg/bundler/validations/checks_test.go
  • pkg/cli/consts.go
  • pkg/cli/mirror.go
  • pkg/cli/query.go
  • pkg/cli/query_test.go
  • pkg/cli/recipe.go
  • pkg/cli/recipe_test.go
  • pkg/client/v1/aicr.go
  • pkg/client/v1/aicr_internal_test.go
  • pkg/client/v1/aicr_test.go
  • pkg/client/v1/bundle.go
  • pkg/client/v1/gpu_driver_state.go
  • pkg/client/v1/stability_test.go
  • pkg/client/v1/types.go
  • pkg/component/overrides.go
  • pkg/component/overrides_test.go
  • pkg/config/accessors.go
  • pkg/config/accessors_test.go
  • pkg/config/config.go
  • pkg/config/config_test.go
  • pkg/config/validate.go
  • pkg/evidence/project/synthesize.go
  • pkg/evidence/project/synthesize_test.go
  • pkg/mirror/discover.go
  • pkg/mirror/discover_test.go
  • pkg/recipe/builder.go
  • pkg/recipe/catalog.go
  • pkg/recipe/criteria.go
  • pkg/recipe/criteria_test.go
  • pkg/recipe/decode.go
  • pkg/recipe/loader.go
  • pkg/recipe/loader_test.go
  • pkg/recipe/metadata.go
  • pkg/recipe/metadata_store.go
  • pkg/recipe/metadata_store_test.go
  • pkg/recipe/profile.go
  • pkg/recipe/profile_resolution.go
  • pkg/recipe/profile_test.go
  • pkg/recipe/query.go
  • pkg/recipe/query_request.go
  • pkg/recipe/query_test.go
  • pkg/serializer/reader.go
  • pkg/serializer/reader_test.go
  • pkg/server/bundle_handler.go
  • pkg/server/bundle_handler_test.go
  • pkg/server/consts.go
  • pkg/server/doc.go
  • pkg/server/recipe_handler.go
  • pkg/server/recipe_handler_test.go
  • pkg/server/serve.go
  • pkg/server/serve_test.go
  • pkg/server/server.go
  • tools/testgrid-publish/bundle.go
  • tools/testgrid-publish/bundle_test.go

Comment thread pkg/bundler/bundler.go Resolved
Comment thread pkg/recipe/loader.go Resolved
Comment thread pkg/serializer/reader_test.go Resolved
Comment thread pkg/serializer/reader.go Resolved
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from 01d8670 to 9bf3f52 Compare July 28, 2026 06:16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/recipe/metadata_store.go (1)

1029-1101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Sound profile resolution logic; consider extracting the shared finalize+validate block.

BuildRecipeResultWithProfile (lines 1084-1100) and BuildRecipeResultWithEvaluatorAndProfile (lines 1251-1268) duplicate the same "apply profile → finalize → stamp APIVersion/Metadata.SelectedProfile → ValidateProfileValuesWithContext" sequence. Since this is the contract-enforcement path (profile artifact tagging + validation), duplicating it risks the two paths drifting apart on a future fix.

♻️ Suggested consolidation
func (s *MetadataStore) finalizeWithProfile(
	ctx context.Context, criteria *Criteria, mergedSpec *RecipeMetadataSpec,
	appliedOverlays []string, effectiveProfile *ProfileDeclaration, selection string,
	evaluator ConstraintEvaluatorFunc,
) (*RecipeResult, error) {
	selected, err := applyEffectiveProfile(mergedSpec, effectiveProfile, selection, evaluator)
	if err != nil {
		return nil, err
	}
	result, err := finalizeRecipeResult(s.provider, criteria, mergedSpec, appliedOverlays) //nolint:contextcheck
	if err != nil {
		return nil, err
	}
	if selected == nil {
		return result, nil
	}
	result.APIVersion = RecipeProfileAPIVersion
	result.Metadata.SelectedProfile = selected
	if err := result.ValidateProfileValuesWithContext(ctx); err != nil {
		return nil, err
	}
	return result, nil
}

Both call sites would call this helper, with the evaluator path additionally setting result.Metadata.ExcludedOverlays/ConstraintWarnings on the returned result.

Also applies to: 1113-1270

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/recipe/metadata_store.go` around lines 1029 - 1101, Extract the shared
apply-profile, finalize, profile metadata tagging, and validation sequence from
BuildRecipeResultWithProfile and BuildRecipeResultWithEvaluatorAndProfile into a
MetadataStore helper such as finalizeWithProfile. Pass the merged spec,
overlays, effective profile, selection, and evaluator through the helper;
preserve the evaluator path’s additional ExcludedOverlays and ConstraintWarnings
assignments after the helper returns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/serializer/reader.go`:
- Around line 617-623: Update the ConfigMap retrieval error handling in the
reader flow around k8sClient.CoreV1().ConfigMaps(namespace).Get to classify
ErrCodeNotFound only when apierrors.IsNotFound(err) is true; preserve the
existing not-found message for that case and propagate other errors with their
appropriate status instead of wrapping them as not found.
- Around line 617-618: Rename the shared timeout symbol ConfigMapWriteTimeout to
the neutral ConfigMapTimeout, updating its definition and every read/write
reference consistently, including the context timeout setup in the reader flow.

In `@pkg/server/bundle_handler_test.go`:
- Around line 204-216: The “v2 rejects unknown query parameter” subtest
duplicates request setup instead of using the existing helper. Replace the
manual httptest request and recorder setup with post(t, true,
"?profie=gpuStack%3Ddriver-installed", profileBundleBody(t)), then retain the
existing status assertion against the helper’s response.

In `@pkg/server/bundle_handler.go`:
- Around line 323-342: The duplicated allowlist in
validateV2BundleQueryParameters must stay synchronized with ParseBundleConfig.
Derive validation from the parser’s key definitions where possible; otherwise
add a test that compares both allowlists and fails when they diverge, ensuring
newly supported query parameters are accepted by /v2/bundle.

---

Outside diff comments:
In `@pkg/recipe/metadata_store.go`:
- Around line 1029-1101: Extract the shared apply-profile, finalize, profile
metadata tagging, and validation sequence from BuildRecipeResultWithProfile and
BuildRecipeResultWithEvaluatorAndProfile into a MetadataStore helper such as
finalizeWithProfile. Pass the merged spec, overlays, effective profile,
selection, and evaluator through the helper; preserve the evaluator path’s
additional ExcludedOverlays and ConstraintWarnings assignments after the helper
returns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: f2eea5d4-58cd-4156-b798-7c9fd7597c01

📥 Commits

Reviewing files that changed from the base of the PR and between 01d8670 and 9bf3f52.

📒 Files selected for processing (69)
  • api/aicr/v1/server.yaml
  • docs/contributor/api-server.md
  • docs/contributor/recipe.md
  • docs/design/015-recipe-configuration-profiles.md
  • docs/integrator/data-flow.md
  • docs/integrator/go-library.md
  • docs/integrator/recipe-development.md
  • docs/user/api-reference.md
  • docs/user/cli-config.md
  • docs/user/cli-reference.md
  • pkg/bundler/bundler.go
  • pkg/bundler/bundler_test.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/validations/checks.go
  • pkg/bundler/validations/checks_test.go
  • pkg/cli/consts.go
  • pkg/cli/mirror.go
  • pkg/cli/query.go
  • pkg/cli/query_test.go
  • pkg/cli/recipe.go
  • pkg/cli/recipe_test.go
  • pkg/client/v1/aicr.go
  • pkg/client/v1/aicr_internal_test.go
  • pkg/client/v1/aicr_test.go
  • pkg/client/v1/bundle.go
  • pkg/client/v1/gpu_driver_state.go
  • pkg/client/v1/stability_test.go
  • pkg/client/v1/types.go
  • pkg/component/overrides.go
  • pkg/component/overrides_test.go
  • pkg/config/accessors.go
  • pkg/config/accessors_test.go
  • pkg/config/config.go
  • pkg/config/config_test.go
  • pkg/config/validate.go
  • pkg/evidence/project/synthesize.go
  • pkg/evidence/project/synthesize_test.go
  • pkg/mirror/discover.go
  • pkg/mirror/discover_test.go
  • pkg/recipe/builder.go
  • pkg/recipe/catalog.go
  • pkg/recipe/criteria.go
  • pkg/recipe/criteria_test.go
  • pkg/recipe/decode.go
  • pkg/recipe/loader.go
  • pkg/recipe/loader_test.go
  • pkg/recipe/metadata.go
  • pkg/recipe/metadata_store.go
  • pkg/recipe/metadata_store_test.go
  • pkg/recipe/profile.go
  • pkg/recipe/profile_resolution.go
  • pkg/recipe/profile_test.go
  • pkg/recipe/query.go
  • pkg/recipe/query_request.go
  • pkg/recipe/query_test.go
  • pkg/serializer/reader.go
  • pkg/serializer/reader_test.go
  • pkg/server/bundle_handler.go
  • pkg/server/bundle_handler_test.go
  • pkg/server/consts.go
  • pkg/server/doc.go
  • pkg/server/recipe_handler.go
  • pkg/server/recipe_handler_test.go
  • pkg/server/serve.go
  • pkg/server/serve_test.go
  • pkg/server/server.go
  • tools/testgrid-publish/bundle.go
  • tools/testgrid-publish/bundle_test.go

Comment thread pkg/serializer/reader.go Resolved
Comment thread pkg/serializer/reader.go Resolved
Comment thread pkg/server/bundle_handler_test.go Resolved
Comment thread pkg/server/bundle_handler.go Resolved
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from 9bf3f52 to 1f416f4 Compare July 28, 2026 14:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/mirror/discover_test.go`:
- Around line 466-493: Extend TestDiscover_SetEnabledFalseSkipsComponent into a
table-driven test covering both disabled and non-boolean enabled overrides.
Retain the existing false case assertions, and add an invalid value case that
verifies Discover returns ErrCodeInvalidRequest with the contextual error from
prepareMirrorCandidate, without rendering or retaining the component.

In `@pkg/recipe/metadata_store.go`:
- Around line 1084-1100: The profile-processing tail is duplicated across the
build paths and can drift over time. Extract the shared apply-profile, finalize,
metadata-stamping, and validation sequence into a helper such as
MetadataStore.finalizeWithProfile, parameterized by ctx, criteria, mergedSpec,
appliedOverlays, effectiveProfile, selection, and evaluator; preserve each
caller’s distinct trailing excluded-overlay assignment.

In `@pkg/recipe/profile_test.go`:
- Around line 909-971: Add table cases to the profile validation tests covering
both baseline-side rejection gates: a baseline owned path resolving to
PathBlocked, expecting the “recipe path … is blocked” error, and ownedPaths
naming a component absent from the recipe, expecting the “profile-owned
component %q is absent from the recipe” error. Reuse the existing fixtures and
test structure around the current cases to verify both failures remain
fail-closed.

In `@pkg/recipe/profile.go`:
- Around line 414-444: The profile validation loops over map-backed OwnedPaths
nondeterministically and performs hydration without cancellation checks. Update
ValidateProfileValuesWithContext and ValidateProfileLock to collect and sort
owned component keys before iterating, and check ctx.Done() at the start of each
iteration before hydration, returning the context error when cancelled; preserve
existing validation and error behavior otherwise.
- Around line 518-541: Update ValidateProfileLock and
ValidateProfileValuesWithContext to reuse the hydrated component-values map
produced during validation, passing it through instead of calling
GetValuesForComponentWithContext again for each profile-owned component.
Preserve existing validation and error behavior while ensuring each component’s
values are loaded only once per lock check.

In `@pkg/server/recipe_handler.go`:
- Around line 501-516: The duplicate-value validation currently used by
singleQueryValue must also cover every allowlisted query key in
validateV2QueryParameters. Update that v2 validation flow so conflicting
repeated values such as service=eks and service=gke return the existing
invalid-request error, while repeated identical values remain accepted and
unrelated keys retain their current handling.
- Around line 572-577: Update v2EnvelopeFormat to distinguish recognized JSON
and YAML media types instead of defaulting every non-JSON value to YAML; treat
an empty or unsupported Content-Type as invalid and propagate
ErrCodeInvalidRequest through the strict v2 request handling path. Preserve YAML
selection only for explicitly recognized YAML media types.
- Around line 98-101: Extract the shared v2 query-key allowlist used by both
handlers into a package-level set, preserving the existing common keys. Update
the `/v2/query` handler’s validation around validateV2QueryParameters to add
selector-specific support without mutating or duplicating the shared set, while
the other v2 handler continues using only the common allowlist.

In `@tools/testgrid-publish/bundle_test.go`:
- Around line 120-136: Update the “profile artifact rejected until publication
support lands” test case in the parseCriteria test table to assert the expected
rejection message using wantErrContains: “profile-bearing TestGrid publication
is deferred to the profile adoption rollout”, while retaining wantErr: true.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d37b7169-116b-4de5-9b71-381ce32330f4

📥 Commits

Reviewing files that changed from the base of the PR and between 9bf3f52 and 1f416f4.

📒 Files selected for processing (71)
  • api/aicr/v1/server.yaml
  • docs/contributor/api-server.md
  • docs/contributor/recipe.md
  • docs/design/015-recipe-configuration-profiles.md
  • docs/integrator/data-flow.md
  • docs/integrator/go-library.md
  • docs/integrator/recipe-development.md
  • docs/user/api-reference.md
  • docs/user/cli-config.md
  • docs/user/cli-reference.md
  • pkg/bundler/bundler.go
  • pkg/bundler/bundler_test.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm.go
  • pkg/bundler/deployer/argocdhelm/argocdhelm_test.go
  • pkg/bundler/handler.go
  • pkg/bundler/handler_test.go
  • pkg/bundler/validations/checks.go
  • pkg/bundler/validations/checks_test.go
  • pkg/cli/consts.go
  • pkg/cli/mirror.go
  • pkg/cli/query.go
  • pkg/cli/query_test.go
  • pkg/cli/recipe.go
  • pkg/cli/recipe_test.go
  • pkg/client/v1/aicr.go
  • pkg/client/v1/aicr_internal_test.go
  • pkg/client/v1/aicr_test.go
  • pkg/client/v1/bundle.go
  • pkg/client/v1/gpu_driver_state.go
  • pkg/client/v1/stability_test.go
  • pkg/client/v1/types.go
  • pkg/component/overrides.go
  • pkg/component/overrides_test.go
  • pkg/config/accessors.go
  • pkg/config/accessors_test.go
  • pkg/config/config.go
  • pkg/config/config_test.go
  • pkg/config/validate.go
  • pkg/evidence/project/synthesize.go
  • pkg/evidence/project/synthesize_test.go
  • pkg/mirror/discover.go
  • pkg/mirror/discover_test.go
  • pkg/recipe/builder.go
  • pkg/recipe/catalog.go
  • pkg/recipe/criteria.go
  • pkg/recipe/criteria_test.go
  • pkg/recipe/decode.go
  • pkg/recipe/loader.go
  • pkg/recipe/loader_test.go
  • pkg/recipe/metadata.go
  • pkg/recipe/metadata_store.go
  • pkg/recipe/metadata_store_test.go
  • pkg/recipe/profile.go
  • pkg/recipe/profile_resolution.go
  • pkg/recipe/profile_test.go
  • pkg/recipe/query.go
  • pkg/recipe/query_request.go
  • pkg/recipe/query_test.go
  • pkg/serializer/reader.go
  • pkg/serializer/reader_test.go
  • pkg/server/bundle_handler.go
  • pkg/server/bundle_handler_test.go
  • pkg/server/consts.go
  • pkg/server/doc.go
  • pkg/server/recipe_handler.go
  • pkg/server/recipe_handler_test.go
  • pkg/server/serve.go
  • pkg/server/serve_test.go
  • pkg/server/server.go
  • tools/testgrid-publish/bundle.go
  • tools/testgrid-publish/bundle_test.go

Comment thread pkg/mirror/discover_test.go Resolved
Comment thread pkg/recipe/metadata_store.go Resolved
Comment thread pkg/recipe/profile_test.go Resolved
Comment thread pkg/recipe/profile.go Resolved
Comment thread pkg/recipe/profile.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
Comment thread pkg/server/recipe_handler.go Resolved
Comment thread tools/testgrid-publish/bundle_test.go Resolved
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch 2 times, most recently from 42309c6 to 12062c6 Compare July 28, 2026 14:51
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch 6 times, most recently from 2ace4ec to 9e65073 Compare July 28, 2026 21:29
@github-actions

Copy link
Copy Markdown
Contributor

@yuanchen8911 this PR now has merge conflicts with main. Please rebase to resolve them.

@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from 9e65073 to ad2c4c5 Compare July 28, 2026 22:26
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from 26449e4 to a201987 Compare July 30, 2026 00:55
@yuanchen8911 yuanchen8911 changed the title WIP: Implement the profile core in ADR-015 Implement the profile core in ADR-015 Jul 30, 2026
@yuanchen8911
yuanchen8911 marked this pull request as ready for review July 30, 2026 00:55
@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from a201987 to c0db667 Compare July 30, 2026 03:08
@yuanchen8911
yuanchen8911 requested a review from njhensley July 30, 2026 03:12
@yuanchen8911 yuanchen8911 changed the title Implement the profile core in ADR-015 feat(recipe): implement the ADR-015 profile core Jul 30, 2026
njhensley
njhensley previously approved these changes Jul 30, 2026

@njhensley njhensley 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.

📋 Multi-Persona Re-Review — round 2 (head c0db6678)

Delta re-review of the revision pushed since my prior review at 58c53860. Method: independent persona re-review of the changed surface plus adversarial disposition of every prior finding against the resolved code. Most feedback was addressed; one residual item remains.

Tier legend: 🔴 Blocker · 🟠 Major · 🟡 Minor · 🔵 Nitpick

Prior-feedback status

Prior finding Disposition
🟡 Union-totality "over-locks" siblings via synthetic enabled ⊘ Withdrawn — my prior finding was wrong. Your ADR-015 defense is correct: the declaration-wide presence lock is the deliberate anti-smuggling mechanism and never rejects a legitimate selection (a fragment can't change the component set, and every referenced component must be enabled regardless of selection). Retracted.
🟡 /v2/bundle oneOf rejects empty-header legacy body ◐ Partially addressed. The {kind:"", apiVersion:""} case is fixed (VersionlessLegacyRecipeResponse widened; three branches verified mutually exclusive). A sibling shape still falls through — see the inline comment.
🔵 Lock template follows symlinks (no O_NOFOLLOW) ✖️ Won't-fix (acceptable). Rationale now documented in checkStaticPath — the TOCTOU requires a local writer to --output who could already tamper with the finished bundle + checksums. Reasonable for a nitpick.
🔵 v2 body parsed twice ✖️ Not addressed (acceptable). By-design; Go can't distinguish absent from explicit-null in one strict pass and the body is size-bounded.
— post-loop ctx.Err() ⊘ Confirmed still a non-issue.
🔵 PathsIntersect no direct test ✔️ Addressed. TestPathsIntersect added, covering exact/ancestor/descendant/disjoint + the false-prefix (driver vs driverRoot) case + symmetry.

New surface reviewed clean

  • validateProfileInlineOwnership: null/blocked/absent tri-state is correct and genuinely closes the {driver: nil}-ancestor gap that mergeValues' nil-key deletion would otherwise let slip past the hydrated check; explicit-null leaf accepted; never false-rejects generation output.
  • Profile constraint validation: name/value/duplicate checks at parity with validateConstraintWarningSource; cross-value reuse is ADR-sanctioned; fully fail-closed.
  • kind: Recipe legacy window: v1-only; v2 rejects Recipe in both schema and code; the server-accepts / CLI-rejects asymmetry is intentional and documented; the "apiVersion has no legacy window" hard-break gate holds on both server and CLI paths.

Summary

🔴 Blocker 🟠 Major 🟡 Minor 🔵 Nitpick
0 0 1 0

Good iteration — the fixes landed, the F1 pushback was right (I was wrong), and F3/F4 were reasonably declined. The one remaining item is the residual sibling case of the /v2/bundle schema-vs-server gap, inline below. Approving with comments.

Comment thread api/aicr/v1/server.yaml Outdated
apiVersion:
type: string
description: Absent, or empty after a legacy struct round trip
enum: [""]

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.

🟡 Minor — /v2/bundle oneOf rejects {apiVersion: aicr.run/v1alpha2, kind absent/empty} that the v2 server and /v1/bundle both accept

The F2 fix widened VersionlessLegacyRecipeResponse to apiVersion enum: [""] + kind enum: ["", RecipeResult], which correctly closes the both-empty {kind:"", apiVersion:""} case. But a sibling legacy shape still falls through the BundleRecipeV2Request oneOf (server.yaml:2909): a body with apiVersion: aicr.run/v1alpha2 and kind absent-or-"" matches zero branches — LegacyRecipeResponse requires kind: RecipeResult present (via RecipeResponse, required:[apiVersion,kind], kind enum:[RecipeResult] at server.yaml:2710-2718), VersionlessLegacyRecipeResponse requires apiVersion enum:[""] (server.yaml:2893), and ProfileRecipeResponse requires v1alpha3. Yet the v2 server accepts it: DecodeRecipeResult (pkg/recipe/decode.go:51) only rejects a non-empty kind ≠ RecipeResult, and v1alpha2 is not the profile version, so no kind is required. /v1/bundle accepts it too — TestBundleHandler_LegacyRecipeHeaders (pkg/server/bundle_handler_test.go:665,677) posts exactly {v1alpha2, kind absent} and {v1alpha2, kind empty} and asserts HTTP 200. This is the same 'schema stricter than its own server' class F2 was about, on a sibling input — and VersionlessLegacyRecipeResponse's own description states its purpose is to prevent /v2 being 'stricter than its own server'.

Blast radius: A client behind a request-validating API gateway that sends a legacy/partially-round-tripped artifact with apiVersion=v1alpha2 but a blank/absent kind gets a spurious 400 on /v2/bundle, though aicrd itself would accept the body and /v1/bundle does. Request-validation direction only; no server-side break. Not caught by any gate — TestOpenAPIV2BundleContract asserts each branch's enums in isolation, never that the union covers every server-accepted body.

Fix: Widen VersionlessLegacyRecipeResponse's apiVersion enum to ["", aicr.run/v1alpha2] (mirroring BundleRecipeRequest), OR relax the Legacy branch to admit an empty kind for a versioned artifact. Then add a union-coverage assertion to TestOpenAPIV2BundleContract that each of the four server-accepted legacy header combos (apiVersion {v1alpha2, ""} × kind {RecipeResult, absent}) matches exactly one oneOf branch.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a941f19. Confirmed the mechanism first: DecodeRecipeResult enforces kind only when non-empty (and only v1alpha3 requires one), and TestBundleHandler_LegacyRecipeHeaders pins /v1 accepting exactly these bodies — so the union was stricter than its own server on a second sibling shape, as you said.

Rather than widening the versionless branch again, the fix collapses the two legacy branches into one request-scoped LegacyBundleRecipeV2Request covering the whole legacy square: apiVersion in {absent, "", aicr.run/v1alpha2} x kind in {absent, "", RecipeResult}, selectedProfile prohibited. Patching cell by cell is what produced this gap after F2 — one branch per version family removes the class, and oneOf disjointness is now by construction (legacy excludes v1alpha3; profile requires it). The strict LegacyRecipeResponse is untouched — it still backs the GET response contracts — and the sync test now asserts the request union must not reuse a strict response schema, which was the shared root cause of F2 and this finding.

Validated with the draft-4 probe over 11 shapes plus a pre-fix control: both finding shapes flip to accepted, every previously-accepted shape is unchanged, the four must-reject shapes (including kind Recipe on v2 and a v1alpha2 body carrying selectedProfile) still reject, and a real generated v1alpha3 artifact matches exactly one branch.

The delta is spec + sync test only — no Go production code, so server behavior is byte-identical.

Also: appreciated the union-totality retraction, and more so the adversarial re-derivation that produced it.

@yuanchen8911
yuanchen8911 force-pushed the feat/adr15-profile-core branch from c0db667 to a941f19 Compare July 30, 2026 16:08
@yuanchen8911
yuanchen8911 requested a review from njhensley July 30, 2026 16:08
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>

@njhensley njhensley 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.

📋 Multi-Persona Re-Review — round 3 (head a941f19e) — ✅ Approve

Tightly-scoped follow-up since the prior review: only api/aicr/v1/server.yaml and pkg/server/openapi_sync_test.go changed, targeting the one open finding (the /v2/bundle schema-vs-server gap).

Resolved: the two legacy /v2/bundle branches were consolidated into a single LegacyBundleRecipeV2Request admitting apiVersion ∈ ["", aicr.run/v1alpha2] × kind ∈ ["", RecipeResult] — the whole legacy square, including the {apiVersion: v1alpha2, kind absent/empty} sibling case that previously matched zero branches. The oneOf is now LegacyBundleRecipeV2Request | ProfileRecipeResponse, provably disjoint on apiVersion (legacy prohibits selectedProfile; profile requires v1alpha3 + selectedProfile), so every server-accepted body matches exactly one branch. A union-coverage assertion was added to openapi_sync_test.go so the gap can't silently return, and the strict LegacyRecipeResponse response schema is explicitly kept out of the request union. Clean removal of the old branch; TestOpenAPI* passes.

Standing status across rounds: F1 withdrawn (the ADR-015 pushback was correct), F2/F6/F7 addressed, F3 (lock-template O_NOFOLLOW) and F4 (v2 double-parse) declined with sound rationale for their nitpick tier, F5 confirmed a non-issue.

🔴 Blocker 🟠 Major 🟡 Minor 🔵 Nitpick
0 0 0 0

No open findings. The profile core is defensive, fail-closed, and dormant until a recipe family adopts it. Approving.

@yuanchen8911
yuanchen8911 merged commit 9a2002e into NVIDIA:main Jul 30, 2026
168 checks passed
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>
@yuanchen8911 yuanchen8911 mentioned this pull request Jul 30, 2026
12 of 25 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Jul 30, 2026
19 of 25 tasks
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>
yuanchen8911 added a commit to yuanchen8911/aicr that referenced this pull request Jul 30, 2026
Convert recipes/overlays/aks.yaml to aicr.run/v1alpha3 with the ADR-015
gpuStack declaration: driver-only (default, AKS Driver-only preinstall)
and operator (--gpu-driver none pools). The four-path bundle-time
override tuple is replaced by generation-time selection; the paths are
profile-owned and a diverging --set is rejected.

Each value carries a distinguishing constraint over the
K8s.aks-gpu-pools.gpu-driver snapshot reading, the projection of the
AgentPool gpuProfile.driver property (DD3). The projection collector is
not yet implemented: snapshot-qualified AKS resolution fails closed
until it lands, and criteria-only generation selects explicitly.

Snapshot-path behavior changes for AKS by design: a None-mode pool
snapshot now fails the driver-only constraint at resolution instead of
recording gpuDriverState for the bundle-time gate, and a snapshot
without the pool reading fails closed.

Test fixtures that declared a gpuStack profile on AKS criteria move to
EKS (composition-wide uniqueness now collides with the embedded
declaration); new tests qualify both embedded values and leaf
inheritance.

Part of NVIDIA#1761 (rollout PR 2). Depends on NVIDIA#1933.

Signed-off-by: Yuan Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants