feat(bundler): --split renders a class-partitioned bundle set #3420
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3420"
general
weight: 0.35
yuanchen8911
Summary
Adds
--splittoaicr bundle(CLI, SDK and REST): the bundle is rendered as a class-partitioned set per ADR-018, one directory per registry class (core, thenops) under a set root that holds the fullrecipe.yaml,split.yaml,checksums.txtand the attestation. Without--splitnothing changes.Motivation / Context
ADR-018 (#3341) partitions a bundle by the registry
classso two owners can deploy their parts separately. #3350 landed the class field, the catalog edge fixes and the direction guard. This is the second implementation step: the plan/validate-once/render-subsets pipeline, partition validation, the set-level layout and provenance, and create-only atomic publication, for the Helm-local deployer only.Fixes: #3158
Related: #3156
Related: #3159
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/)pkg/client/v1facade,pkg/header, OpenAPI contractImplementation Notes
Pipeline.
DefaultBundler.Makeruns every existing gate on the complete component set exactly as today: coherence, enable/disable filtering, override policy, value extraction, the ADR-015 profile lock and the component validations. Only then, whenConfig.Split()is set, does it branch intomakeSplit(newpkg/bundler/split.go) instead of the single-bundle writer. Each class is rendered by the existing helmGeneratoron a subsetRecipeResultwhoseComponentRefsare the class's enabled components and whoseDeploymentOrderis the induced subsequence, with the matching slice of the already-extracted component values. A dependency on a component in another class is absent from the subset and so is treated as satisfied externally, the same path a disabled component's edge takes.Partition validation (
planSplit), before any write: OCP recipes are rejected; every enabled component needs a registry entry, and its class must be a known one; any dependency from an earlier class to a later enabled component is rejected; the ADR-016 accounting set (slinky-slurm,mariadb-operator-crds,mariadb-operator,slurm-accounting-mariadb) must share one class; a class the recipe declares whose every component is disabled is rejected, while a class with no declared component is skipped.Config.Validaterejects--splitwith any deployer other thanhelm, with checksums disabled, or together with thebundlersfilter, and the CLI rejects it with OCI output. Before rendering,validateSplitHelmIdentitiesclaims every (namespace, release) pair the whole set will emit, including the injected-pre,-postand-readinessreleases, counting a-prerelease only when its manifests render an object, as the writer does, so a collision across classes fails instead of slipping past per-class rendering.Set layout. Class directories are ordinary Helm per-component bundles (
deploy.sh,README.md,NNN-<component>/) without their ownchecksums.txtorbundle-info.yaml; the set root is the verification unit and carriesrecipe.yaml(the same bytes an ordinary bundle writes),split.yaml,bundle-info.yamlwhose entrypoint is the first class'sdeploy.shand whose release paths are class-prefixed (soaicr upgrade-check --from <set>andaicr recipe --inherit-from <set>read a set like a bundle; the record's strict schema has no set marker yet, so the bundling guide documents that the entrypoint installs only its own class's releases and how a consumer recognizes a set from the record),UPGRADING.mdwhen transition records apply, any copied--datafiles,checksums.txtover the whole tree, and the attestation with--attest. The final inventory is re-read and verified from the root before publication, as for a single bundle.split.yamlisaicr.run/v1BundleSplit:recipeDigest(sha256:plusevidence/attestation.SubjectDigestV3of the set-rootrecipe.yaml, so it matches recipe-evidence subjects),classOrder, andcomponentsmapping every component to its class. Its header comment restates the scope note from the ADR: it identifies the recipe and its partition, not the payload, whichchecksums.txtidentifies.Per-class scripts. The helm
Generatorgains aSplitcontext. A classdeploy.shkeys its orphaned-CRD scan by the component that ships the CRDs (monitoring.coreos.comunderprometheus-operator-crds), so a later class does not report an earlier class's CRDs as orphans, and carries a header naming the class order. A classREADME.mdgains a "Bundle Set" section stating the install and teardown order and listing the namespaces and CRD groups the class shares with an earlier class, which its teardown must keep. With a nil context the templates render exactly as before: the ordinarydeploy.shkeeps its historical table keyed bykube-prometheus-stack.Publication is create-only and atomic.
--outputis required with--split(the CLI rejects the flag without it) and must name an absent path under an existing parent. The set renders into a private.aicr-split-<name>-*sibling under the destination's parent, is verified from its root, and is published with one no-replace rename:renameat2(RENAME_NOREPLACE)on Linux andrenamex_np(RENAME_EXCL)on macOS, the two platforms aicr ships for, with a check-then-rename fallback elsewhere. The destination stays absent until that syscall; anything created there meanwhile, even an empty directory, makes it fail with a conflict and is left untouched, and the stage is removed. Only an occupied destination (EEXIST,ENOTEMPTY,EISDIR) is reported as a conflict; any other rename failure is an internal error, and a filesystem without the no-replace flag (EINVAL,ENOSYS,ENOTSUP) falls back to the two-step check-then-rename. Any failure before publication likewise removes the stage and leaves the destination absent, so concurrent attempts have at most one winner. The set root is published with mode 0755 like an ordinary bundle directory, and the attestation records the published path, not the stage. Each class README carries only the upgrade notes for its own components and links the guide at the set root as../UPGRADING.md. This holds atpkg/bundlerand thepkg/client/v1facade, so the REST handler now renders a split set into a child of its private temp directory and zips that child; the ordinary path still writes the temp directory itself.Canonicalization moved to a leaf package.
split.yaml's digest must match recipe evidence, but importingpkg/evidence/attestationfrom the bundler created an import cycle throughpkg/oci, whose tests import the bundler. The canonicalization and subject digests now live inpkg/evidence/canonical(yaml andpkg/errorsonly);pkg/evidence/attestationkeeps every exported function as a wrapper, so its API and the evidence it verifies are unchanged.Surfaces.
--splitflag (category Deployment);BundleOptions.Splitandconfig.WithSplit, where a non-nilBundleOptions.ConfigsupersedesSplitandMakeBundlerejectsSplit=truewith aConfigthat lacks it;splitquery parameter onPOST /v1/bundlewith its OpenAPI entry;header.KindBundleSplit. Registry merging now warns when an external entry replaces an embedded non-corecomponent without declaringclass, since the replacement defaults tocore.Docs.
docs/user/bundling.mdgains "Split a bundle by class" (layout, ordering contract, verification unit, create-only publication, rejections) and a note in "Bundle layout";docs/user/cli-reference.mdgains the flag row, a class-directory paragraph under thedeploy.shbehavior section and a set-root note underaicr verify;docs/user/api-reference.mdgains thesplitparameter;docs/integrator/recipe-development.mdanddocs/contributor/recipe.mdreplace their "planned--split" wording;docs/integrator/supply-chain-verification.mdstates the set as the closed world;docs/integrator/go-library.mdnotesSplitas a caller-set option outside the config-derived fields and shows an SDK example; the "Deploy the bundle" walkthrough inbundling.mdhas a set-specific command block;docs/README.mddefines "Bundle set".Out of scope, per the ADR's deferred list: non-Helm deployers and OCI output (rejected explicitly), standalone class artifacts and a class selector, OCP, per-class
bundle-info.yaml, a deploy-time compatibility protocol, and class-aware--inherit-from.Testing
New tests.
pkg/bundler/split_test.go: a four-component recipe (twocore, twoops,monitoringshared across classes) renders a verified set with the expected root files, class folders,split.yamlcontents, class README anddeploy.shcontent and deployment steps; rejections for acore→opsedge, an edge to a disabled later-class component (accepted), OCP, an unregistered component and an all-disabled class each leave no destination and no stage behind; create-only publication rejects an existing destination untouched, an implicit output path and a missing parent; a failing attester after full rendering leaves no destination and no stage; the support-matrix rejections; and the ordinary path still writes one bundle withdeploy.shat the root.pkg/bundler/deployer/helm: the split context's effect ondeploy.shandREADME.mdfor anopsclass without the CRD shipper, acoreclass with it, and the unchanged ordinary bundle, plusCRDGroupsInstalledBy.pkg/bundler/config:Validatefor the split rules.pkg/bundler: thesplitquery parameter and its presence in the strict allowlist.pkg/server:POST /v1/bundle?split=truethrough the strict query gate returns a zip rooted at the set withsplit.yamland the class directories.pkg/cli: the flag and its OCI rejection. A review round added the class README upgrade-link test, the published-root mode test, the attestation path test, the publish-conflict tests where the destination appears before the final rename, once empty and once populated, and must be left exactly as found, arecipeDigestequality check againstcanonical.SubjectDigestV3of the set-rootrecipe.yaml, the set-rootbundle-info.yaml(entrypoint, class-prefixed release paths,ReadReleaseValues), the CLI rejection of--splitwithout--output, the per-class upgrade notice, and theSplit/Configprecedence rejection inpkg/client/v1.Byte identity without
--split.TestStockRenderParityGolden(every catalog leaf through the helm deployer) and the helm deployer goldens are unchanged. With a binary from this branch, an EKS / H100 / Ubuntu / training / Kubeflow recipe bundled once with--splitand once without: all 16 per-component folders are byte-identical between the class directories and the ordinary bundle (diff -r, ignoring theNNN-index), and the set-rootrecipe.yamlandUPGRADING.mdare identical to the ordinary bundle's.aicr verifypasses at the set root; a second run into the same path is rejected withCONFLICTand leaves no staging directory.Local gate (
make qualifyat82c400aed, pinned tool versions, exit 0;2588c5befis that content rebased ontomain, followed by docs-only and review-round commits up to the head57dc6ca84, each checked with the touched packages' tests, lint and the six docs gates):| Stage | Result |
|---|---|
| Unit tests with
-race| 125 packages ok, 0 failures || Coverage | 86.0% total (floor 83%) |
| golangci-lint, yamllint, license headers, agents sync, docs gates | 0 issues |
| tuning-check | pass |
| e2e | 31 passed, 0 failed, 0 skipped |
| Vulnerability scan (
--fail-on high) | pass; the two pre-existing Low/Unknown advisories in transitive modules, identical onmain|| license check | pass |
| api-diff | no incompatible SDK facade or alias changes since v1.1.0 |
| openapi-diff | no unacknowledged breaking changes (the
splitparameter is additive) |Per-package coverage against
main(go test -cover, same command both sides):pkg/bundler88.5% → 88.1%,pkg/bundler/config95.9% → 95.8%,pkg/bundler/deployer/helm92.7% → 92.8%,pkg/header100% → 100%,pkg/evidence/attestation80.2% → 79.5% (its canonicalization code and tests moved to the newpkg/evidence/canonical, at 89.4%). Every new exported function is covered.CLI surface and architecture gates.
pkg/cli/testdata/cli-surface.goldenis regenerated for the new flag, andtests/architecture/facade-policy.yamlrecordsconfig.WithSplitandConfig.Splitas behavioral, the same classification as the sibling options.KWOK deployment (
kind+ KWOK, the repo'skwok/scripts/validate-scheduling.shflags and conditional--setvalues, recipegb300-eks-training, branch binary). Baseline with one ordinarydeploy.sh: 14 releases, 41 pods, all scheduled. Then on the same clean cluster, the split set:core/deploy.shalone installs the 10corereleases (aws-ebs-csi-driver, aws-efa, cert-manager, gpu-operator and gpu-operator-pre, nfd, nodewright-operator, nvidia-dra-driver-gpu, nvsentinel, prometheus-operator-crds) with 32 pods running and none unscheduled;ops/deploy.shthen installs the remaining 4, for 14 releases and 41 pods, none unscheduled. The release set after core then ops is identical to the ordinary bundle's. The ops preflight ran with core'smonitoring.coreos.comCRDs present and did not report them as orphans. Deployingops/alone on a clean cluster fails loudly at its first component, kube-prometheus-stack, with "no matches for kind ServiceMonitor", exit 1 and no release left behind, which is the ordering contract the class README states.GB300 EKS deployment (
aws-us-east-2-nhensley-gb300, 2 × p6e-gb300r.36xlarge, recipegb300-eks-ubuntu-inference-dynamo, branch binary, the scheduling flags of the previous install). Aftertools/cleanupand a reboot of both GPU nodes,core/deploy.shinstalled its 12 releases; with onlycorepresent a plain GPU pod scheduled on a GB300 node and rannvidia-smi(driver 580.173.02), and the deployment-phaseaicr validateagainst the set-rootrecipe.yamlpassed operator-health, gpu-operator-version and check-nvidia-smi, failing expected-resources only on the first absentopscomponent.ops/deploy.shthen installed its 10 releases; the cluster ended with the same 22 releases an ordinary bundle built with the same flags would install, alldeployed, every pod Running or Completed, andaicr validatepassed every phase on the split deployment: deployment 4 of 4, conformance 11 of 11, performance 1 of 1 (the Dynamo inference-perf run: Qwen3-8B on 4 GPUs, 84,487 tokens/s against a 60,000 floor, TTFT p99 178 ms against a 2,000 ms ceiling). The interventions needed were teardown debris, not the split: an empty namespace stuck behind a dead CRD conversion webhook Grove CRDs stuck behind orphaned instance finalizers, and the Dynamo CRD being swept away by that pending deletion after dynamo-platform had installed, which a reinstall of that one release restored; all from removing the previous operators while a user workload held their objects (#3422).Not run in the lanes: the chainsaw and UAT lanes exercise ordinary bundles; wiring a split lane is #3159.
Risk Assessment
Rollout notes: Opt-in. Without
--splitthe bundler, templates, CLI, SDK and REST behave as before; the golden tests pin the ordinary output. The newsplitquery parameter is additive in the OpenAPI contract. The registry merge warning is log-only.Checklist
make testwith-race)make lint)git commit -s -S) — GPG signing info