feat: enforce conditional field requirements during validate#288
Merged
josegonzalez merged 4 commits intoJul 7, 2026
Merged
Conversation
`docket validate` previously only caught missing required fields offline, so the conditional and semantic field requirements each task encodes only surfaced at plan or apply time after contacting a server. Tasks may now expose those input-only checks through an optional `Validate` method that `plan` and `apply` already run, and `validate` calls it offline and reports any failure as a new `invalid_task_input` problem.
Moves the input-only checks that lived directly inside each task's `Plan()` into a `Validate` method that `Plan()` calls first, so `docket validate` reports the same conditional and semantic errors offline as `invalid_task_input`. Covers the tasks whose checks were hand-written in `Plan()`, including `dokku_http_auth_allowed_ip`, `dokku_http_auth_user`, and the other app, http-auth, git, service, storage, and scheduler tasks.
Wraps each task's existing input-validation helper in a `Validate` method that `Plan()` calls first, so `docket validate` runs the same checks offline as `invalid_task_input`. Covers `dokku_acl_service`, `dokku_certs`, `dokku_docker_options`, `dokku_domains`, `dokku_maintenance_custom_page`, `dokku_registry_auth`, `dokku_scheduler_k3s_profile`, and `dokku_storage_mount`, folding in any conditional checks those tasks still applied inline.
Factors the input-only checks out of the shared `planProperty`, `planToggle`, and `planResource` helpers into reusable validators, then exposes them through a `Validate` method on every task that delegates to those helpers, so `docket validate` reports the same scoping and value errors offline. Covers the property, toggle, resource, and scheduler-k3s scoped-pairs and autoscaling-auth tasks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docket validateenforcedrequired:"true"struct-tag fields offline but not the conditional and semantic input requirements each task encodes inside itsPlan()method, so recipe-authoring mistakes such as an emptyallowed_ipsoruserslist whenstate: present, a missingpassword, or setting a property both globally and per-app only surfaced at plan or apply time after contacting a server. This teachesdocket validateto run each task's conditional and semantic input checks offline as well, reporting any failure as a newinvalid_task_inputproblem so those mistakes are caught before a server is contacted. The same checks continue to run during plan and apply, so all three report identical errors, and validation stays offline because the checks never contact the server.Closes #276.