Skip to content

refactor: declare the toggle task fields once - #469

Merged
josegonzalez merged 1 commit into
mainfrom
467-extract-a-shared-togglefields-type-across-the-toggle-tasks
Aug 13, 2026
Merged

refactor: declare the toggle task fields once#469
josegonzalez merged 1 commit into
mainfrom
467-extract-a-shared-togglefields-type-across-the-toggle-tasks

Conversation

@josegonzalez

Copy link
Copy Markdown
Member

The three toggle tasks and dokku_maintenance each restated the same app and state field set, so every cross-cutting change had to be applied four times by hand. They now name a defined type over the shared ToggleFields. A defined type rather than an embedded struct keeps the field set flat to reflection, so the catalog, the required-field walk behind missing_required_field, the identity walk that names an unnamed task and the sensitive-value walks read the fields exactly as before. The parameter descriptions become plugin-agnostic as a result, which is what regenerates the task pages; each page's title and synopsis already name the plugin. TestToggleTasksDeclareTheSharedFields decides which tasks are toggles by whether their Plan() reaches planToggle rather than by their name, which is what keeps dokku_maintenance bound to the shared set despite not being spelled like one. The contributor docs described a planToggle signature removed in #322 and two envelope examples used a state: value no task accepts; both are corrected here. Fixes #467.

The three toggle tasks and `dokku_maintenance` each restated the same `app` and `state` field set, so every cross-cutting change had to be applied four times by hand. They now name a defined type over the shared `ToggleFields`. A defined type rather than an embedded struct keeps the field set flat to reflection, so the catalog, the required-field walk behind `missing_required_field`, the identity walk that names an unnamed task and the sensitive-value walks read the fields exactly as before. The parameter descriptions become plugin-agnostic as a result, which is what regenerates the task pages; each page's title and synopsis already name the plugin. `TestToggleTasksDeclareTheSharedFields` decides which tasks are toggles by whether their `Plan()` reaches `planToggle` rather than by their name, which is what keeps `dokku_maintenance` bound to the shared set despite not being spelled like one. The contributor docs described a `planToggle` signature removed in #322 and two envelope examples used a `state:` value no task accepts; both are corrected here. Fixes #467.
@josegonzalez
josegonzalez merged commit 12fed10 into main Aug 13, 2026
19 checks passed
@josegonzalez
josegonzalez deleted the 467-extract-a-shared-togglefields-type-across-the-toggle-tasks branch August 13, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract a shared ToggleFields type across the toggle tasks

1 participant