Skip to content

feat(templates): extend TemplatePayload bound to CONFIG type parameter#853

Merged
dieppa merged 1 commit intomasterfrom
feat/template_config_validation
Feb 27, 2026
Merged

feat(templates): extend TemplatePayload bound to CONFIG type parameter#853
dieppa merged 1 commit intomasterfrom
feat/template_config_validation

Conversation

@dieppa
Copy link
Member

@dieppa dieppa commented Feb 27, 2026

The APPLY and ROLLBACK type parameters already enforced extends TemplatePayload,
but CONFIG remained unbounded — preventing load-time validation of configuration
payloads. This change completes the contract across all three template generics.

Public API:

  • ChangeTemplate and AbstractChangeTemplate now require
    CONFIG extends TemplatePayload
  • TemplateVoid sentinel replaces Void for templates with no configuration,
    implementing TemplatePayload with a no-op validate()

Load-time CONFIG conversion:

  • TemplateLoadedTaskBuilder now converts CONFIG from raw YAML data to typed
    TemplatePayload at load time, consistent with APPLY/ROLLBACK conversion
  • Dead Void.class guard checks removed from convertPayloads() and convertSteps()

Validation:

  • SimpleTemplateLoadedChange and MultiStepTemplateLoadedChange implement
    validateConfigurationPayload(), calling config.validate() at pipeline load time

Executable task simplification:

  • AbstractTemplateExecutableTask.setConfigurationData() no longer re-converts
    the already-typed config; uses TemplateVoid.class sentinel instead of Void.class

The APPLY and ROLLBACK type parameters already enforced `extends TemplatePayload`,
but CONFIG remained unbounded — preventing load-time validation of configuration
payloads. This change completes the contract across all three template generics.

Public API:
- **ChangeTemplate** and **AbstractChangeTemplate** now require
  `CONFIG extends TemplatePayload`
- **TemplateVoid** sentinel replaces `Void` for templates with no configuration,
  implementing TemplatePayload with a no-op validate()

Load-time CONFIG conversion:
- **TemplateLoadedTaskBuilder** now converts CONFIG from raw YAML data to typed
  TemplatePayload at load time, consistent with APPLY/ROLLBACK conversion
- Dead `Void.class` guard checks removed from convertPayloads() and convertSteps()

Validation:
- **SimpleTemplateLoadedChange** and **MultiStepTemplateLoadedChange** implement
  validateConfigurationPayload(), calling config.validate() at pipeline load time

Executable task simplification:
- **AbstractTemplateExecutableTask.setConfigurationData()** no longer re-converts
  the already-typed config; uses TemplateVoid.class sentinel instead of Void.class

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dieppa dieppa merged commit 064e3fa into master Feb 27, 2026
4 checks passed
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.

1 participant