fix(bundler): validate deployer config before writing output #3513
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.69) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.69 · 452 lines diff across 5 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.366
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.069
Real PR Conversation Timeline
1 comments
"Review active on #3513"
general
weight: 0.35
yuanchen8911
Summary
DefaultBundler.Makenow runs the deployer checks that depend only on config before it creates the output directory or copies--datafiles, so a rejected request leaves nothing behind.Motivation / Context
The checks used to run in
buildDeployer, after the output directory was created and the external data was copied into<output>/data/.os.CopyFSnever overwrites existing files, so a corrected rerun into the same directory failed with "file exists". Raised by CodeRabbit on #3432.Fixes: #3508
Related: #3432
Type of Change
Component(s) Affected
cmd/aicr,pkg/cli)cmd/aicrd,pkg/server)pkg/recipe)pkg/bundler,pkg/component)pkg/collector,pkg/snapshotter)pkg/validator)pkg/errors,pkg/k8s)docs/,examples/)Implementation Notes
The new
validateDeployerConfigholds the three checksbuildDeployerran inline:--readiness-hookswithflux,helmfileorfleet.resolveArgoDeployerOptions: invalid values, settings on a non-Argo deployer, and typeddeployer:overrides.--deployer argocd.Makecalls it right afterConfig.Validate.buildDeployerstill calls it, becausemakeSplitbuilds deployers directly.argoDeployerOptionsis split so only the call that builds the deployer emits thedeployer:<key>deprecation warnings, keeping them once per run.One visible change: these errors can now come before recipe validation errors. A request that is invalid in both ways reports the deployer config problem first. Both are
ErrCodeInvalidRequest.Testing
TestMake_RejectsDeployerConfigBeforeOutputcovers six config-rejection cases and asserts the output directory is never created.pkg/bundler,pkg/cli,pkg/server,pkg/client/v1: pass. Lint: 0 issues.make qualifywas stopped in favor of CI for the rebased head. Merge remains gated on the required CI checks. The rebase preserves the original two-file diff, andgit diff --checkpasses.Risk Assessment
Rollout notes: N/A. The same requests are rejected with the same errors, just before any output exists.
Checklist
make testwith-race) (affected packages; full suite is gated by CI)make lint) (golangci-lint onpkg/bundler)git commit -s -S) — GPG signing info