Skip to content

refactor(task): invoke Validate() in executor before submit#197

Merged
bdchatham merged 2 commits intomainfrom
refactor/executor-validate
May 6, 2026
Merged

refactor(task): invoke Validate() in executor before submit#197
bdchatham merged 2 commits intomainfrom
refactor/executor-validate

Conversation

@bdchatham
Copy link
Copy Markdown
Collaborator

Summary

Adds e.params.Validate() to sidecarExecution[T].Execute() before the ToTaskRequest()/SubmitTask path. Catches malformed task params at executor-time as a structured terminal failure instead of as an opaque sidecar HTTP 400.

Closes the platform-engineer's deferred opportunity flagged in the cross-review of #192 ("Validate() is now defined on every wrapper but invoked nowhere in the executor path").

What it actually catches

For most task types Validate() returns nil (empty struct or trivial validation), so this is a no-op in practice. The two strict paths are:

  • sidecar.AssembleAndUploadGenesisTask.Validate() — required-field + bech32 checks. Already invoked at planner-time at group.go:45, so this catch is defense-in-depth.
  • configApplyTask.Validate() — delegates to seictl ConfigApplyTask.Validate(), which calls seiconfig.ValidateIntent. The planner doesn't currently call this; the executor now does.

Drive-by cleanups

  • Drop a stale comment in sidecar.go about overriding Id "rather than on the wrapper's embedded TaskMeta" — TaskMeta no longer exists (removed in seictl#153, consumed in chore(deps): bump seictl to v0.0.46 #195). The comment was rot from refactor(task): drop taskParamser interface; use client.TaskBuilder directly #192.
  • Fix TestExecuteGroupPlan_CompletesSuccessfully fixture — it built an AssembleAndUploadGenesisTask with only Nodes (missing required AccountBalance and Namespace). It passed before only because Validate() wasn't invoked; now we populate the required fields, which is the correct test intent for a happy-path submission test.

Verification

  • GOWORK=off go build ./... clean
  • GOWORK=off go test ./... — all packages pass

🤖 Generated with Claude Code

bdchatham and others added 2 commits May 6, 2026 14:25
Adds e.params.Validate() to sidecarExecution[T].Execute() before the
ToTaskRequest()/SubmitTask path. Catches malformed task params at
executor-time as a structured terminal failure instead of as an opaque
sidecar HTTP 400.

For most task types Validate() returns nil (empty struct or trivial
validation), so this is a no-op in practice. The two strict paths are:

  - sidecar.AssembleAndUploadGenesisTask.Validate() — required-field
    + bech32 checks. Already invoked at planner-time at group.go:45,
    so this catch is defense-in-depth.
  - configApplyTask.Validate() — delegates to seictl
    ConfigApplyTask.Validate(), which calls seiconfig.ValidateIntent.
    The planner doesn't currently call this; the executor now does.

One test fixture fix: TestExecuteGroupPlan_CompletesSuccessfully built
an AssembleAndUploadGenesisTask with only Nodes (missing required
AccountBalance and Namespace). It passed before because Validate
wasn't invoked; now we populate the required fields, which is the
correct test intent for a happy-path submission test.

Closes the platform-engineer's deferred opportunity flagged in the
cross-review of #192.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds e.params.Validate() to sidecarExecution[T].Execute() before the
ToTaskRequest()/SubmitTask path. Catches malformed task params at
executor-time as a structured terminal failure instead of as an opaque
sidecar HTTP 400.

For most task types Validate() returns nil (empty struct or trivial
validation), so this is a no-op in practice. The two strict paths are:

  - sidecar.AssembleAndUploadGenesisTask.Validate() — required-field
    + bech32 checks. Already invoked at planner-time at group.go:45,
    so this catch is defense-in-depth.
  - configApplyTask.Validate() — delegates to seictl
    ConfigApplyTask.Validate(), which calls seiconfig.ValidateIntent.
    The planner doesn't currently call this; the executor now does.

Drive-by: drop a stale comment about overriding Id "rather than on
the wrapper's embedded TaskMeta" — TaskMeta no longer exists (removed
in seictl#153, consumed in #195). The comment was rot from #192.

Test fixture fix: TestExecuteGroupPlan_CompletesSuccessfully built
an AssembleAndUploadGenesisTask with only Nodes (missing required
AccountBalance and Namespace). It passed before only because Validate
wasn't invoked; now we populate the required fields, which is the
correct test intent for a happy-path submission test.

Closes the platform-engineer's deferred opportunity flagged in the
cross-review of #192.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bdchatham bdchatham merged commit 99d7710 into main May 6, 2026
2 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