Documentation
¶
Overview ¶
Package command defines the TriggerBuildCheckCommand payload and its Kafka sender for the github-build watcher's request topic.
Index ¶
Constants ¶
const TriggerBuildCheckCommandOperation base.CommandOperation = "trigger-build-check"
TriggerBuildCheckCommandOperation is the Kafka command operation for triggering a github-build poll cycle. Wire string: "trigger-build-check".
Variables ¶
This section is empty.
Functions ¶
func NewTriggerBuildCheckCommandExecutor ¶
func NewTriggerBuildCheckCommandExecutor( watcher pkg.Watcher, ) cdb.CommandObjectExecutorTx
NewTriggerBuildCheckCommandExecutor creates a cdb.CommandObjectExecutorTx that consumes TriggerBuildCheckCommand messages and drives the github-build watcher: unmarshal → validate → invoke w.Poll(ctx) on the shared watcher instance.
Exit-path mapping (per spec 068 § Desired Behavior 4):
- malformed payload (MarshalInto fails) → cdb.ErrCommandObjectSkipped
- cmd.Validate(ctx) failure → cdb.ErrCommandObjectSkipped
- w.Poll(ctx) returns non-nil error → wrapped error (transient, retried)
- w.Poll(ctx) returns nil → nil, nil, nil (success)
SendResultEnabled is false (spec Non-goal: fire-and-forget, no result topic). The executor does NOT increment any metrics — the Watcher.Poll call already owns IncPollCycle / IncPublished / IncReposScanned / IncFilterSkipped. The executor reads cmd.Force and forwards it to Watcher.Poll (spec 069): when true, the red×red episode-lock arm of the state machine publishes a salted CreateTaskCommand instead of skipping. cmd.Scope is forwarded to Watcher.Poll: a webhook-triggered command carries "owner/repo" and narrows the poll to that single repo (scoped poll, mirroring github-release-watcher), so one workflow_run delivery costs ~3 API calls, not a full fleet scan.
Types ¶
type TriggerBuildCheckCommand ¶
type TriggerBuildCheckCommand struct {
Scope string `json:"scope,omitempty"`
Force bool `json:"force,omitempty"`
}
TriggerBuildCheckCommand is the payload for TriggerBuildCheckCommandOperation. It is published to the github-build watcher's request topic by the /trigger HTTP handler and consumed by the in-pod command consumer.
Scope is reserved for a future per-repo filter UX; the executor still ignores it. Force is wired (spec 069): when true, the consuming watcher's red×red episode-lock arm publishes a salted CreateTaskCommand via pkg.DeriveTaskIDForce instead of skipping — operators can force a re-publish for a still-red build even when the episode is already locked. All other state-machine arms (green→red, red→green) ignore Force.
func (TriggerBuildCheckCommand) Validate ¶
func (cmd TriggerBuildCheckCommand) Validate(_ context.Context) error
Validate enforces the command's schema rules. The empty payload {} is still accepted: Force defaults to false (engages the episode-lock skip, the canonical poll-loop behaviour), and Scope remains reserved-unread. A future spec will add per-repo or per-stage validation here.
type TriggerBuildCheckCommandSender ¶
type TriggerBuildCheckCommandSender interface {
SendCommand(ctx context.Context, cmd TriggerBuildCheckCommand) error
}
TriggerBuildCheckCommandSender sends TriggerBuildCheckCommand payloads to Kafka. Calls Validate before publishing — a validation error is returned without touching Kafka.
func NewTriggerBuildCheckCommandSender ¶
func NewTriggerBuildCheckCommandSender( commandCreator base.CommandCreator, initiator cqrsiam.Initiator, commandObjectSender cdb.CommandObjectSender, ) TriggerBuildCheckCommandSender
NewTriggerBuildCheckCommandSender creates a TriggerBuildCheckCommandSender. The commandCreator and initiator are injected at construction time per the cqrs/docs/producing-commands.md "Factory Wiring" pattern (matches trading/frontend/command's reference impl) — built once at wiring, reused across every SendCommand call. The commandObjectSender wraps the Kafka sync producer.