command

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: BSD-2-Clause Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package command defines the TriggerBuildCheckCommand payload and its Kafka sender for the github-build watcher's request topic.

Index

Constants

View Source
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. The cmd.Scope field is still reserved-unread (spec Non-goal: per-repo filter UX is a separate spec).

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL