Help us shape the future of Go! Take the 2026 Go Developer Survey

command

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package command defines the TriggerCommand payload and its Kafka sender for the github-dark-factory watcher's request topic.

Index

Constants

View Source
const TriggerCommandOperation base.CommandOperation = "trigger"

TriggerCommandOperation is the Kafka command operation for force-triggering a single draft PR into the dark-factory-implement pipeline. Wire string: "trigger".

Variables

This section is empty.

Functions

func NewTriggerCommandExecutor

func NewTriggerCommandExecutor(
	ghClient pkg.GitHubClient,
	createSender task.CreateCommandSender,
	taskCfg pkg.TaskConfig,
	metrics pkg.Metrics,
	currentDateTime libtime.CurrentDateTimeGetter,
) cdb.CommandObjectExecutorTx

NewTriggerCommandExecutor creates a cdb.CommandObjectExecutorTx that consumes TriggerCommand messages and drives the single-PR dark-factory-implement pipeline: GitHub fetch → candidate gate (darkfactory.Evaluate) → downstream publish.

Exit-path mapping:

  • malformed / invalid payload → cdb.ErrCommandObjectSkipped
  • unparseable URL → cdb.ErrCommandObjectSkipped
  • non-candidate PR (result.Keep == false) → cdb.ErrCommandObjectSkipped
  • GitHub 5xx / network error → wrapped error (transient, retried)
  • Evaluate infrastructure error → wrapped error (transient, retried)
  • downstream CreateTaskCommand send error → wrapped error (transient, retried)
  • success → nil, nil, nil

SendResultEnabled is false (fire-and-forget, no result topic). Outcomes are counted on pkg.Metrics: IncPublished("create"/"error") on the publish path and IncFilterSkipped(reason) on the non-candidate skip path (same labels the poll-loop watcher uses).

Types

type TriggerCommand

type TriggerCommand struct {
	URL   string `json:"url"`
	Force bool   `json:"force,omitempty"`
}

TriggerCommand is the payload for TriggerCommandOperation. It is published to the github-dark-factory watcher's request topic by the /trigger HTTP handler and consumed by the in-pod command consumer.

URL is the GitHub draft-PR URL the operator wants pushed into the pipeline. Force, when true, causes the executor to derive a salted TaskIdentifier via pkg.DeriveTaskIDForce (microsecond-resolution time nonce) so the agent controller's vault-file dedup skip does NOT fire and a fresh implement task is created for the same head SHA.

func (TriggerCommand) Validate

func (cmd TriggerCommand) Validate(ctx context.Context) error

Validate enforces the command's schema rules. URL must be non-empty and must parse to a GitHub-platform PR URL. It runs both at publish time (the gateway wraps this payload) and again in the consumer's executor as defense-in-depth, so a buggy producer cannot enqueue garbage the executor would then act on.

Jump to

Keyboard shortcuts

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