[RAPTOR 18594] Schema change: preflight validation#679
Conversation
|
👋 Thanks so much for contributing to the DataRobot community! As a quick heads-up on how our team handles reviews: if you're still iterating on Once everything is finalized and you're ready for feedback, just click "Ready for review" |
Code OwnershipWorkload Cli
Cli Maintainers
Review requested from the teams above. Labels will be removed automatically upon approval. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4217cac. Configure here.
| enabled, ok := autoscaling["enabled"] | ||
| if !ok { | ||
| return true | ||
| } |
There was a problem hiding this comment.
enabled: null bypasses autoscaling conflict detection
Low Severity
autoscalingEnabled treats "enabled": null differently from an absent "enabled" key. When the key is absent, it correctly defaults to true. When the key is null, the nil interface falls through to the bool type assertion and returns false instead, so the conflict with replicaCount goes undetected. The sibling function replicaCountSet explicitly handles null via v != nil, but that same pattern wasn't applied here. The server likely treats null and absent equivalently (both default to true), so the user gets a server 422 instead of the intended clear CLI error.
Triggered by project rule: Bugbot Rules for DataRobot CLI
Reviewed by Cursor Bugbot for commit 4217cac. Configure here.
| | `404` | The workload does not exist. | | ||
| | `409` | The workload must finish its current transition first (for example a `start` while it is still `stopping`). | | ||
| | `422` | The spec failed server validation; the response names the offending JSON path. | | ||
| | `422` | The spec failed server validation; the response names the offending JSON path (for example `replicaCount` set alongside `autoscaling.enabled: true`, or `maxReplicaCount` below 1). | |
There was a problem hiding this comment.
(not blocking) the 422 row still lists replicaCount + autoscaling.enabled: true as an example, but this PR now catches that combo client-side before the POST, so users hit the CLI preflight error, not a 422. drop that one and keep maxReplicaCount below 1 (still server-side)?


RATIONALE
Adds client-side preflight validation for
dr workload createso users get a clear CLI error when a spec sets bothreplicaCountandautoscaling.enabled: trueon the same container group — instead of waiting for a WAPI422.Follows workload-api#984 mutual-exclusivity rule. Builds on RAPTOR-18591 (docs/examples for the new autoscaling shape). Specs are still forwarded verbatim to WAPI after validation passes.
Ticket: RAPTOR-18594
CHANGES
internal/workload/workload.govalidateRuntimeReplicaAutoscalingwalksruntime.containerGroups[]; errors whenreplicaCountis set andautoscaling.enabledis true (defaulttruewhen omitted)internal/workload/workload_test.goreplicaCount: null, autoscaling disabled + replicaCount, conflict cases with group indexValidation rule (per container group):
replicaCountautoscaling.enabledtrue(or omitted onautoscalingblock)falsenulltrueautoscalingblockExplicitly deferred: bounds validation (
maxReplicaCount >= 1), per-policy legacy field rejection — still handled by WAPI422.TESTING
GOPROXY=https://proxy.golang.org,direct go test ./internal/workload/ -run TestValidateWorkloadCreateRequest -vManual (should fail before API call):
RELATED
docs/examples/workload-autoscaling.yaml_reconcile_replica_countinruntime.pyPR Automation
Comment-Commands: Trigger CI by commenting on the PR:
/trigger-smoke-testor/trigger-test-smoke- Run smoke tests/trigger-install-testor/trigger-test-install- Run installation testsLabels: Apply labels to trigger workflows:
run-smoke-testsorgo- Run smoke tests on demand (only works for non-forked PRs)Important
For Forked PRs: The
run-smoke-testslabel won't work. A required Smoke Tests check will block merge until a maintainer acts:/approve-smoke-teststo run smoke tests (results will set the check)/skip-smoke-teststo bypass the check without running testsPlease comment requesting a maintainer review if you need smoke tests to run.
Branch:
RAPTOR-18594-schema-change-preflight-validation→main(non-forked; merge after RAPTOR-18591 or rebase onto it)Diff size: 2 files (
workload.go,workload_test.go)Note
Low Risk
Local spec validation and documentation only; no change to successful create behavior or server contracts beyond catching invalid specs earlier.
Overview
Adds client-side preflight on
dr workload createso specs that set bothreplicaCountandautoscaling.enabled: trueon the same container group fail immediately with a clear path-indexed error, aligned with workload-api mutual-exclusivity instead of a late422.ValidateWorkloadCreateRequestnow walksruntime.containerGroups[]and treats anautoscalingblock with omittedenabledas enabled. Valid combinations (fixed replicas only, autoscaling only,replicaCount: null, orautoscaling.enabled: falsewith replicas) still pass; the payload is still sent verbatim when validation succeeds.Docs and help are updated for a third create flow (autoscaling with bounds on
autoscaling), a copy-pastedocs/examples/workload-autoscaling.yaml, and expanded422examples. Unit tests cover the new rules and group index in errors.Reviewed by Cursor Bugbot for commit 4217cac. Configure here.