← Back to Pull requests

fix(bundler): validate deployer config before writing output #3513

Closed
unknown closed this pull request without merging on Oct 30, 2026 15:56 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 20:05 UTC
Author

Summary

DefaultBundler.Make now runs the deployer checks that depend only on config before it creates the output directory or copies --data files, 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.CopyFS never 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

  • 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)

  • Bundler and deployers (pkg/bundler, pkg/component)

  • Collectors / snapshotter (pkg/collector, pkg/snapshotter)

  • Validator (pkg/validator)

  • Core libraries (pkg/errors, pkg/k8s)

  • Docs/examples (docs/, examples/)

  • Other: ____________
  • Implementation Notes

    The new validateDeployerConfig holds the three checks buildDeployer ran inline:

  • --readiness-hooks with flux, helmfile or fleet.

  • The resolved Argo CD options, through resolveArgoDeployerOptions: invalid values, settings on a non-Argo deployer, and typed deployer: overrides.

  • Dynamic declarations with --deployer argocd.
  • Make calls it right after Config.Validate. buildDeployer still calls it, because makeSplit builds deployers directly. argoDeployerOptions is split so only the call that builds the deployer emits the deployer:<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

    go test -race ./pkg/bundler/ ./pkg/cli/... ./pkg/server/... ./pkg/client/...
    golangci-lint run -c .golangci.yaml ./pkg/bundler/...
    

  • TestMake_RejectsDeployerConfigBeforeOutput covers 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.

  • Full local make qualify was 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, and git diff --check passes.
  • Risk Assessment

  • Low — Isolated change, well-tested, easy to revert

  • Medium — Touches multiple components or has broader impact

  • High — Breaking change, affects critical paths, or complex rollout
  • Rollout notes: N/A. The same requests are rejected with the same errors, just before any output exists.

    Checklist

  • Tests pass locally (make test with -race) (affected packages; full suite is gated by CI)

  • Linter passes (make lint) (golangci-lint on pkg/bundler)

  • 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 signed off and cryptographically signed (git commit -s -S) — GPG signing info
  • Diff: 452 lines (+339 / -113) across 5 files Reviewer: yuanchen8911 Review duration: 1191m
    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
    0.69
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.6% (HIGH) · Higher = larger blast radius
    68.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.1% · Safe to merge
    27.1%
    Repository