entity

package
v0.3.0-20261120180237-... Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 4 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

Index

Constants

View Source
const (
	// DegreeGreen is a fully healthy scope: nothing broken.
	DegreeGreen = 0.0
	// DegreePartial is a broken scope with individual project results available.
	DegreePartial = 0.5
	// DegreeBroken is a fully broken scope.
	DegreeBroken = 1.0
)

Degree bounds. A degree answers "how broken was this scope?" on a closed interval, so both endpoints are named rather than spelled as bare literals.

Variables

This section is empty.

Functions

func CompareRequestID

func CompareRequestID(a, b string) (int, error)

CompareRequestID compares ingest order of two request IDs in the same queue. Callers must ensure the IDs belong to the same queue. Returns -1 if a is older than b, 0 if equal, 1 if a is newer than b. IDs must be canonical positive decimal strings whose scope is carried separately.

func QueueLogID

func QueueLogID(version int64) string

QueueLogID returns the stable occurrence identity for a state version.

Types

type Build

type Build struct {
	// ID is the build's own key: the runner-assigned id returned by
	// Trigger (e.g. a Buildkite build number). Opaque; never parsed or
	// derived by stovepipe.
	ID string `json:"id"`
	// RequestID is the Request this build validates (Build->Request
	// navigation; no reverse index from Request to its builds is needed).
	RequestID string `json:"request_id"`
	// Status is the build's lifecycle state.
	Status BuildStatus `json:"status"`
	// Version is used for optimistic locking. Versioning starts at 1 and
	// is incremented for each change to the object.
	Version int32 `json:"version"`
}

Build represents a single build triggered for a Request's commit. All fields except Status and Version are immutable after creation — build is the sole creator (via BuildStore.Create), and buildsignal is the sole writer of Status/Version afterward.

type BuildID

type BuildID struct {
	// ID is the runner-assigned identifier for the build.
	ID string `json:"id"`
}

BuildID wraps the runner-assigned build identifier for BuildRunner Status/Cancel/Trigger parameters.

type BuildIssue

type BuildIssue struct {
	// TaskID identifies the logical validation task, stable across builds and retries; it must be nonempty.
	TaskID string `json:"task_id"`
	// UnitID identifies the failed unit within the task; empty for a task-wide issue.
	// Repeated observations of the same condition use the same TaskID and UnitID.
	UnitID string `json:"unit_id"`
	// FixID is the opaque executor-provided repair identifier; empty means none is recorded.
	FixID string `json:"fix_id"`
	// Version is the optimistic-lock version, initially zero.
	Version int32 `json:"version"`
}

BuildIssue is a validation failure observed within a build, identified by task and optional unit.

type BuildMetadata

type BuildMetadata map[string]string

BuildMetadata carries caller-supplied, provider-echoed free-form metadata about a build. The runner must not depend on its contents. Empty today; expected to carry real data eventually (e.g. conflict-graph info, or other upstream decisions relevant to the build) once a concrete need lands in either domain — the shape is deferred until then, not decided here.

type BuildStatus

type BuildStatus string

BuildStatus defines the possible states of a build. Shaped the same as SubmitQueue's own BuildStatus (submitqueue/entity/build.go), but defined locally rather than shared — see build.md's "Alternatives considered for sharing the contract".

const (
	// BuildStatusUnknown is the unreachable zero value, set by default when
	// the structure is initialized. It should never be seen in the system.
	BuildStatusUnknown BuildStatus = ""

	// BuildStatusAccepted indicates the build has been accepted for
	// execution by the runner via Trigger, but has not yet started.
	BuildStatusAccepted BuildStatus = "accepted"

	// BuildStatusRunning indicates the build is currently executing.
	BuildStatusRunning BuildStatus = "running"

	// BuildStatusSucceeded indicates the build completed successfully.
	// This is a terminal state.
	BuildStatusSucceeded BuildStatus = "succeeded"

	// BuildStatusFailed indicates the build did not complete successfully.
	// This is a terminal state.
	BuildStatusFailed BuildStatus = "failed"

	// BuildStatusCancelled indicates the build was cancelled.
	// This is a terminal state.
	BuildStatusCancelled BuildStatus = "cancelled"
)

func (BuildStatus) IsTerminal

func (s BuildStatus) IsTerminal() bool

IsTerminal returns true if the status represents a final state (Succeeded, Failed, or Cancelled). A terminal status is write-once: once buildsignal persists one, a later poll reporting a different terminal value must never overwrite it (see buildsignal.md's Algorithm, step 6).

type BuildStrategy

type BuildStrategy string

BuildStrategy defines how build validates the request's commit.

const (
	// BuildStrategyUnknown leaves validation scope unspecified until admission.
	BuildStrategyUnknown BuildStrategy = ""
	// BuildStrategyIncrementalSinceGreen validates only the delta since the pinned baseline URI.
	BuildStrategyIncrementalSinceGreen BuildStrategy = "incremental_since_green"
	// BuildStrategyFull validates the whole repo from scratch.
	BuildStrategyFull BuildStrategy = "full"
)

type GetIssuesByRequestIDRequest

type GetIssuesByRequestIDRequest struct {
	// Queue is the required configured queue containing the request.
	Queue string
	// RequestID is the canonical positive decimal request ID within the queue.
	RequestID string
	// PageSize bounds returned issues, from 1 to 200; zero selects 50.
	PageSize int32
	// PageToken is an opaque continuation bound to this queue and request.
	PageToken string
}

GetIssuesByRequestIDRequest selects accepted issue results for one request.

type GetIssuesByRequestIDResult

type GetIssuesByRequestIDResult struct {
	// Issues contains accepted results in ascending bytewise task/unit order.
	Issues []RequestIssueSummary
	// Status is complete only after reconciliation and every result write finished.
	// Unavailable means recording has not started or predates retained coverage.
	Status RequestIssuesStatus
	// NextPageToken continues after the last returned result; empty ends this scan.
	// In-progress results can gain entries behind the cursor; restart after completion.
	NextPageToken string
}

GetIssuesByRequestIDResult is a page of request results, not all issues left open.

type GetProjectStatusRequest

type GetProjectStatusRequest struct {
	// Queue identifies the queue containing the validation request.
	Queue string
	// RequestID is the queue-scoped decimal identifier, empty when selecting by URI.
	RequestID string
	// ChangeURI identifies the exact commit under validation, empty when selecting by request ID.
	ChangeURI string
	// Projects limits results to the supplied consumer-defined project IDs; empty selects all recorded projects.
	Projects []string
	// PageSize is the maximum number of project results per page.
	PageSize int32
	// PageToken is an opaque continuation token for full project-result pagination.
	PageToken string
}

GetProjectStatusRequest selects a validation request by queue and exactly one of request ID or commit URI.

type GetProjectStatusResult

type GetProjectStatusResult struct {
	// RequestSummary is the authoritative validation projection selected by the lookup.
	RequestSummary RequestSummary
	// RepositoryValidationFact is the repository result when HasRepositoryValidationFact is true.
	RepositoryValidationFact ValidationFact
	// HasRepositoryValidationFact distinguishes a missing fact from a recorded green result.
	HasRepositoryValidationFact bool
	// ProjectResultsComplete reports whether the implementation has finished its project-result set.
	ProjectResultsComplete bool
	// ProjectValidationFacts contains recorded results in request order, or descending degree then ascending project ID when Projects is empty.
	ProjectValidationFacts []ValidationFact
	// NextPageToken continues requested-project result pagination when another page exists.
	NextPageToken string
	// UpdatedAtMs is the newest durable lifecycle or result timestamp represented by the response.
	UpdatedAtMs int64
}

GetProjectStatusResult is the current validation projection for one request.

type GetQueueStatusRequest

type GetQueueStatusRequest struct {
	// Queue is the stable repo-and-ref namespace.
	Queue string
	// ChangeURI is an immutable commit URI; empty selects current enablement.
	ChangeURI string
}

type GetQueueStatusResult

type GetQueueStatusResult struct {
	// Queue is the selected repo-and-ref namespace.
	Queue string
	// Enablement is current enablement or enablement covering the requested commit.
	Enablement QueueState
}

type GetRequestHistoryByIDRequest

type GetRequestHistoryByIDRequest struct {
	// ID is the queue-scoped identifier of the request.
	ID string
	// Queue is the logical queue containing the request and scopes the lookup.
	Queue string
}

GetRequestHistoryByIDRequest identifies one retained request history by request ID.

type GetRequestHistoryByURIRequest

type GetRequestHistoryByURIRequest struct {
	// URI is the exact VCS-agnostic commit URI associated with the request.
	URI string
	// Queue is the logical queue containing the request and scopes the lookup.
	Queue string
}

GetRequestHistoryByURIRequest identifies retained histories by an exact commit URI.

type IngestRequest

type IngestRequest struct {
	// Queue is the name of the queue whose head commit should be ingested.
	Queue string
	// ForceFull requires full validation of the resolved head and rejects requests past accepted.
	ForceFull bool
	// HasEnablement distinguishes an explicit decision from ordinary ingestion.
	HasEnablement bool
	// Enablement is the optional explicit enabled or disabled setting.
	Enablement QueueEnablement
}

IngestRequest represents the validated inputs of an ingest RPC call. The controller resolves the queue's head commit and mints a request ID internally.

type IngestResult

type IngestResult struct {
	// ID is the canonical decimal request identifier assigned within the selected queue.
	ID string
	// Enablement is the applied decision or the observed durable enablement.
	Enablement QueueState
}

IngestResult is the outcome of a successful ingest operation.

type IssueEvent

type IssueEvent string

IssueEvent identifies an issue occurrence; reporting does not change status.

const (
	IssueEventOpened   IssueEvent = "open"
	IssueEventReported IssueEvent = "reported"
	IssueEventClosed   IssueEvent = "closed"
)

type IssueLog

type IssueLog struct {
	// TaskID identifies the logical validation task.
	TaskID string `json:"task_id"`
	// UnitID identifies the validation unit; empty for a task-wide issue.
	UnitID string `json:"unit_id"`
	// Event identifies an opening, repeat report, or closure.
	Event IssueEvent `json:"event"`
	// BuildID identifies the build that produced this occurrence.
	BuildID string `json:"build_id"`
	// TimestampMs is when this occurrence was first recorded, in Unix milliseconds.
	TimestampMs int64 `json:"timestamp_ms"`
	// FirstSeenBuildID identifies this opening; empty only on legacy lifecycle records.
	FirstSeenBuildID string `json:"first_seen_build_id"`
}

IssueLog is an immutable occurrence identified by task, unit, build, and event within a queue.

func (IssueLog) Validate

func (l IssueLog) Validate() error

Validate checks the event identity, timestamp, and opening reference.

type IssueRepair

type IssueRepair struct {
	// Issue identifies the issue opening within a queue.
	Issue OpenIssue
	// ExecutorID is the stable queue-local executor identity.
	ExecutorID string
	// FixID is the backend request or run ID for accepted work, empty while pending or skipped.
	FixID string
	// SkipReason is the terminal skip reason, empty while pending or accepted.
	SkipReason string
	// Metadata contains executor-owned string values; nil and empty maps are equivalent.
	Metadata map[string]string
	// Version is the positive optimistic-lock version.
	Version int32
}

IssueRepair is one executor's repair submission state for an issue opening. Empty FixID and SkipReason identify pending submission, not backend acceptance.

type IssueState

type IssueState struct {
	// TaskID identifies the logical validation task and must be nonempty.
	TaskID string `json:"task_id"`
	// UnitID identifies the validation unit; empty for a task-wide issue.
	UnitID string `json:"unit_id"`
	// Status distinguishes open and closed issues.
	Status IssueStatus `json:"status"`
	// FirstSeenBuildID identifies the current or most recent opening.
	FirstSeenBuildID string `json:"first_seen_build_id"`
	// LastProcessedBuildID identifies the most recent build applied to this issue.
	LastProcessedBuildID string `json:"last_processed_build_id"`
	// LastChangedBuildID identifies the build responsible for the current open or closed status.
	LastChangedBuildID string `json:"last_changed_build_id"`
	// ChangedAtMs is the latest status transition's timestamp in Unix milliseconds.
	ChangedAtMs int64 `json:"changed_at_ms"`
	// Metadata contains namespaced extension state, retained across closing and reopening.
	Metadata map[string]json.RawMessage `json:"metadata,omitempty"`
	// Version is the positive optimistic-lock version; it never resets on reopening.
	Version int32 `json:"version"`
}

IssueState is the latest state of a validation condition within a queue. Closed records retain their identity and version across later openings.

func (IssueState) Validate

func (s IssueState) Validate() error

Validate checks the identity, status, and version of an issue state.

type IssueStatus

type IssueStatus string

IssueStatus describes whether a validation issue is open or closed.

const (
	// IssueStatusUnknown is the unset status.
	IssueStatusUnknown IssueStatus = ""
	// IssueStatusOpen identifies an open validation issue.
	IssueStatusOpen IssueStatus = "open"
	// IssueStatusClosed identifies an issue that is no longer open.
	IssueStatusClosed IssueStatus = "closed"
)

type IssueSummary

type IssueSummary struct {
	// TaskID identifies the logical validation task and must be nonempty.
	TaskID string
	// UnitID identifies the validation unit; empty means a task-wide issue.
	UnitID string
	// Status identifies whether the issue is open or closed.
	Status IssueStatus
	// FirstSeenBuildID identifies the current or most recent opening.
	FirstSeenBuildID string
	// RequestID is the canonical decimal source request ID of the latest transition.
	RequestID string
	// BuildID identifies the source build of the latest transition.
	BuildID string
	// ChangedAtMs is when the latest transition was first recorded, in Unix milliseconds.
	ChangedAtMs int64
	// Version is the positive optimistic-lock version of this summary.
	Version int32
}

IssueSummary is the latest read model of an issue within a queue. Closed summaries retain the source of their latest transition.

func (IssueSummary) Validate

func (s IssueSummary) Validate() error

Validate checks the identity, status, timestamp, and version of a summary.

type IssueTrackingPhase

type IssueTrackingPhase string

IssueTrackingPhase describes whether one source build's issue updates are underway or complete.

const (
	// IssueTrackingPhaseUnknown is the unset phase.
	IssueTrackingPhaseUnknown IssueTrackingPhase = ""
	// IssueTrackingPhaseRefreshing means reported build issues are being opened or kept open.
	IssueTrackingPhaseRefreshing IssueTrackingPhase = "refreshing"
	// IssueTrackingPhaseRefreshed means a refresh pass completed; later refresh passes remain eligible.
	IssueTrackingPhaseRefreshed IssueTrackingPhase = "refreshed"
	// IssueTrackingPhaseFinalizing means existing issues are being reconciled after all reported issues were applied.
	IssueTrackingPhaseFinalizing IssueTrackingPhase = "finalizing"
	// IssueTrackingPhaseFinalized means final reconciliation completed; later refresh notifications are ignored.
	IssueTrackingPhaseFinalized IssueTrackingPhase = "finalized"
	// IssueTrackingPhaseAbandoning means an incomplete pass is being stopped without processing its remaining range.
	IssueTrackingPhaseAbandoning IssueTrackingPhase = "abandoning"
	// IssueTrackingPhaseAbandoned means a pass stopped before completing its range.
	IssueTrackingPhaseAbandoned IssueTrackingPhase = "abandoned"
)

type IssueTrackingState

type IssueTrackingState struct {
	// RequestID identifies the current or most recently completed validation.
	RequestID string `json:"request_id"`
	// BuildID identifies the source build; it can be empty when abandoning before association.
	BuildID string `json:"build_id"`
	// NotificationID identifies the tracking job owning this pass.
	NotificationID string `json:"notification_id"`
	// CursorTaskID identifies the current issue's task; active passes revisit it on continuation.
	// Empty with an empty CursorUnitID starts the phase's range.
	CursorTaskID string `json:"cursor_task_id"`
	// CursorUnitID identifies the unit at the cursor; empty is task-wide.
	CursorUnitID string `json:"cursor_unit_id"`
	// Finalize identifies a terminal pass or a whole-validation abandonment.
	Finalize bool `json:"finalize"`
	// HasTaskWideIssues records whether this pass has encountered a task-wide issue.
	HasTaskWideIssues bool `json:"has_task_wide_issues"`
	// Phase distinguishes active, completed, and abandoned work.
	Phase IssueTrackingPhase `json:"phase"`
	// Version is the positive optimistic-lock version of this state.
	Version int32 `json:"version"`
}

IssueTrackingState is the queue-scoped source-order boundary and resumable reconciliation state.

func (IssueTrackingState) Validate

func (s IssueTrackingState) Validate() error

Validate verifies the identity, phase, and version of a persisted state.

type ListOpenIssuesRequest

type ListOpenIssuesRequest struct {
	// Queue is the required configured queue containing the issues.
	Queue string
	// PageSize bounds returned issues, from 1 to 200; zero selects 50.
	PageSize int32
	// PageToken is an opaque continuation bound to the queue and task/unit order.
	PageToken string
}

ListOpenIssuesRequest selects current open issues within one queue.

type ListOpenIssuesResult

type ListOpenIssuesResult struct {
	// Issues contains matching open summaries in ascending bytewise task/unit order.
	Issues []IssueSummary
	// NextPageToken continues after the last examined open-issue row, including skipped entries.
	// Empty means no further open-issue row was observed, not that the queue is healthy.
	NextPageToken string
}

ListOpenIssuesResult is a bounded page of current open issue summaries.

type ListRequest

type ListRequest struct {
	// Queue is the required configured queue containing the requests.
	Queue string
	// AcceptedAtOrAfterMs is the inclusive Unix millisecond bound when HasAcceptedAtOrAfterMs is true.
	AcceptedAtOrAfterMs int64
	// HasAcceptedAtOrAfterMs distinguishes an explicit lower bound from an omitted one.
	HasAcceptedAtOrAfterMs bool
	// AcceptedBeforeMs is the exclusive Unix millisecond bound when HasAcceptedBeforeMs is true.
	AcceptedBeforeMs int64
	// HasAcceptedBeforeMs distinguishes an explicit upper bound from an omitted one.
	HasAcceptedBeforeMs bool
	// PageSize is the maximum number of summaries, from 1 to 200; zero selects 50.
	PageSize int32
	// PageToken is an opaque continuation bound to the queue and resolved time window.
	PageToken string
}

ListRequest selects current request summaries from one queue by acceptance time.

type ListRequestIssuesByProjectRequest

type ListRequestIssuesByProjectRequest struct {
	// Queue identifies the configured validation queue.
	Queue string
	// RequestID is the queue-scoped canonical decimal request ID.
	RequestID string
	// Project identifies the affected project.
	Project string
	// PageSize bounds returned associations; zero selects 50, otherwise 1 through 200.
	PageSize int32
	// PageToken continues the same request and project lookup.
	PageToken string
}

type ListRequestProjectIssuesResult

type ListRequestProjectIssuesResult struct {
	// Attributions contains immutable pairs, ordered by project for an issue lookup
	// or by task/unit for a project lookup. Empty until attribution is complete.
	Attributions []ProjectIssueAttribution
	// AttributionComplete is true only after all request associations were recorded.
	// False does not establish that the issue or project has no associations.
	AttributionComplete bool
	// NextPageToken continues after the last returned pair; empty ends the range.
	NextPageToken string
}

type ListRequestProjectsByIssueRequest

type ListRequestProjectsByIssueRequest struct {
	// Queue identifies the configured validation queue.
	Queue string
	// RequestID is the queue-scoped canonical decimal request ID.
	RequestID string
	// TaskID identifies the validation task.
	TaskID string
	// UnitID identifies the failed unit and must be nonempty.
	UnitID string
	// PageSize bounds returned associations; zero selects 50, otherwise 1 through 200.
	PageSize int32
	// PageToken continues the same request and issue lookup.
	PageToken string
}

type ListResult

type ListResult struct {
	// Requests contains summaries ordered by descending acceptance time, then descending bytewise request ID.
	Requests []RequestSummary
	// NextPageToken continues after the last returned key; empty means no further mapping was observed.
	NextPageToken string
}

ListResult is one page of current summaries, not a snapshot across pages.

type OpenIssue

type OpenIssue struct {
	// TaskID identifies the logical validation task and must be nonempty.
	TaskID string `json:"task_id"`
	// UnitID identifies the validation unit; empty for a task-wide issue.
	UnitID string `json:"unit_id"`
	// FirstSeenBuildID identifies the build where this opening of the issue was first observed.
	FirstSeenBuildID string `json:"first_seen_build_id"`
}

OpenIssue is a currently open validation issue within a queue. Its task and unit identify the condition; the first-seen build identifies this opening.

type ProjectFactByDegree

type ProjectFactByDegree struct {
	// URI is the commit containing the project result.
	URI string
	// Degree is the breakage degree in [0, 1], ordered highest first.
	Degree float64
	// Project identifies the fact and breaks equal-degree ties in ascending bytewise order.
	Project string
}

ProjectFactByDegree maps an ordered key to an immutable project fact within a queue.

func NewProjectFactByDegree

func NewProjectFactByDegree(fact ValidationFact) (ProjectFactByDegree, error)

NewProjectFactByDegree derives a degree lookup entry from a named project's fact. Invalid degrees, empty URIs and whole-repository facts return an error.

type ProjectIssueAttribution

type ProjectIssueAttribution struct {
	// TaskID identifies the validation task and must be nonempty.
	TaskID string
	// UnitID identifies the failed unit within the task and must be nonempty.
	UnitID string
	// Project is an affected project name and must be nonempty.
	Project string
}

ProjectIssueAttribution is one immutable issue/project pair within an attribution result.

func (ProjectIssueAttribution) Validate

func (a ProjectIssueAttribution) Validate() error

Validate verifies the identity of a unit-level attribution.

type Queue

type Queue struct {

	// Name is the stable logical id for the queue. It should be unique within the system.
	Name string `json:"name"`

	// LastGreenURI is the queue's last-known-good commit: the most recent head at which
	// whole-repo validation recorded green (health degree 0). Empty until the first such outcome.
	LastGreenURI string `json:"last_green_uri"`

	// LastGreenRequestID is the request that established LastGreenURI. The bookmark only
	// moves forward: a green outcome adopts the pair only when this id is empty or older
	// than the candidate's, compared by ingest order via CompareRequestID.
	LastGreenRequestID string `json:"last_green_request_id"`

	// InFlightCount is the number of trunk validations admitted by process but not yet terminal.
	InFlightCount int32 `json:"in_flight_count"`

	// LatestRequestID is the request id of the newest head ingest accepted for this queue.
	// Empty until the first request is created. Coalescing compares IDs via CompareRequestID.
	LatestRequestID string `json:"latest_request_id"`

	// Enablement is the applied enabled/disabled state; empty means unregistered.
	Enablement QueueEnablement `json:"enablement"`

	// EnablementVersion is the queue-scoped enablement sequence; zero means unregistered.
	// Operational changes do not advance this sequence.
	EnablementVersion int64 `json:"enablement_version"`

	// EffectiveFromCommitURI is the inclusive immutable enablement boundary; empty for initial registration.
	EffectiveFromCommitURI string `json:"effective_from_commit_uri"`

	// EnablementChangedAtMs is the enablement application timestamp in Unix milliseconds.
	EnablementChangedAtMs int64 `json:"enablement_changed_at_ms"`

	// Version is the version of the object. It is used for optimistic locking.
	// Versioning starts at 1 and is incremented for each change to the object.
	Version int32 `json:"version"`
}

Queue holds per-queue pipeline coordination state for a named repo+ref (e.g. "monorepo/main").

func (Queue) EnablementState

func (q Queue) EnablementState() QueueState

type QueueConfig

type QueueConfig struct {
	// Name uniquely identifies this queue within the system.
	// Referenced by Request.Queue.
	Name string `json:"name" yaml:"name"`
	// MaxConcurrent is the cap on concurrent in-flight validations for the queue.
	MaxConcurrent int32 `json:"max_concurrent" yaml:"max_concurrent"`
	// GateWaitDelayMs is the redelivery delay while the latest head waits for a slot.
	GateWaitDelayMs int64 `json:"gate_wait_delay_ms" yaml:"gate_wait_delay_ms"`
}

QueueConfig holds deployment configuration for a Stovepipe validation queue. Mutable runtime state (latest head, in-flight count) lives on the Queue row; knobs such as max_concurrent are resolved here at gate-check time. Immutable after load.

type QueueEnablement

type QueueEnablement string

QueueEnablement is applied enablement, independent of execution controls and verdicts.

const (
	// QueueEnablementUnknown is unset and never an explicit disablement.
	QueueEnablementUnknown  QueueEnablement = ""
	QueueEnablementEnabled  QueueEnablement = "enabled"
	QueueEnablementDisabled QueueEnablement = "disabled"
)

type QueueLog

type QueueLog struct {
	// ID is the stable queue-scoped occurrence identity derived from QueueStateVersion.
	ID string
	// Queue is the stable repo-and-ref namespace.
	Queue string
	// TimestampMs is the application's timestamp in Unix milliseconds.
	TimestampMs int64
	// State is the committed enabled or disabled value.
	State QueueEnablement
	// QueueStateVersion is the positive version identifying the applied state.
	QueueStateVersion int64
	// EffectiveFromCommitURI is the inclusive immutable boundary; empty only at version 1.
	EffectiveFromCommitURI string
}

QueueLog is one immutable occurrence of a committed enablement state.

func (QueueLog) Snapshot

func (l QueueLog) Snapshot() QueueState

func (QueueLog) Validate

func (l QueueLog) Validate() error

type QueueState

type QueueState struct {
	// Queue is the stable repo-and-ref namespace, at most 255 bytes.
	Queue string
	// State is enabled or disabled.
	State QueueEnablement
	// EffectiveFromCommitURI is the inclusive immutable boundary, at most 255 bytes; empty only at version 1.
	EffectiveFromCommitURI string
	// ChangedAtMs is the application timestamp in Unix milliseconds.
	ChangedAtMs int64
	// Version is the positive queue-scoped enablement sequence.
	Version int64
}

QueueState describes applied enablement, independent of storage row versions.

func (QueueState) Validate

func (s QueueState) Validate() error

type QueueSummary

type QueueSummary struct {
	// Queue is the stable repo-and-ref namespace, at most 255 bytes.
	Queue string
	// State is the latest materialized enabled/disabled value.
	State QueueEnablement
	// QueueStateVersion identifies the applied enablement occurrence represented here.
	QueueStateVersion int64
	// EffectiveFromCommitURI is the inclusive immutable boundary; empty at state version 1.
	EffectiveFromCommitURI string
	// StateTimestampMs is the occurrence timestamp in Unix milliseconds.
	StateTimestampMs int64
	// Version is the positive optimistic-lock version of this projection.
	Version int64
}

QueueSummary is the current read model derived from retained queue history.

func (QueueSummary) Snapshot

func (s QueueSummary) Snapshot() QueueState

func (QueueSummary) Validate

func (s QueueSummary) Validate() error

type Request

type Request struct {

	// ID is the canonical decimal request identifier, unique within Queue.
	ID string `json:"id"`
	// Queue is the name of the queue (a named repo+ref) being validated. Together with ID it
	// identifies the request and is the stable handle the ingest caller supplies.
	Queue string `json:"queue"`
	// URI is the opaque, VCS-agnostic locator of the commit under validation, as produced by the
	// SourceControl extension.
	URI string `json:"uri"`

	// BuildStrategy is the validation scope. Full on an accepted request is an explicit override.
	BuildStrategy BuildStrategy `json:"build_strategy"`
	// BaseURI is the base URI to be used for this request when the strategy is incremental.
	// Empty for full builds and cold start.
	BaseURI string `json:"base_uri"`

	// State is the current state of the request in the pipeline.
	State RequestState `json:"state"`
	// BuildID identifies the associated CI build and is empty before it is triggered.
	BuildID string `json:"build_id"`
	// TerminalBuildID is the build that established this request's terminal
	// state. It is empty when no build established the terminal state.
	TerminalBuildID string `json:"terminal_build_id"`
	// Version is the version of the object. It is used for optimistic locking.
	// Versioning starts at 1 and is incremented for each change to the object.
	Version int32 `json:"version"`
	// Metadata contains namespaced extension state retained across lifecycle transitions.
	Metadata map[string]json.RawMessage `json:"metadata,omitempty"`
}

Request represents a single validation of a queue at a particular commit. The queue reports a newly observed commit, Stovepipe mints a Request (identity scoped by the queue), and the request flows through the pipeline accumulating state.

type RequestAcceptance

type RequestAcceptance struct {
	// Queue is the queue containing the request.
	Queue string
	// AcceptedAtMs is the original retained acceptance timestamp in Unix milliseconds and is positive.
	AcceptedAtMs int64
	// RequestID identifies the request within Queue and breaks timestamp ties bytewise.
	RequestID string
}

RequestAcceptance is an immutable mapping from (queue, acceptance time, request ID) to a request.

type RequestEvent

type RequestEvent string

RequestEvent identifies a retained occurrence that does not change request state.

const (
	// RequestEventUnknown is the unset event value.
	RequestEventUnknown RequestEvent = ""
	// RequestEventBuildTriggered records that a build was durably accepted.
	RequestEventBuildTriggered RequestEvent = "build_triggered"
	// RequestEventBuildFinished records that a build first reached a terminal status.
	RequestEventBuildFinished RequestEvent = "build_finished"
	// RequestEventValidationFactRecorded records that an immutable validation verdict was established.
	RequestEventValidationFactRecorded RequestEvent = "validation_fact_recorded"
	// RequestEventProjectFactsRecorded records that all project validation facts for a request were established.
	RequestEventProjectFactsRecorded RequestEvent = "project_facts_recorded"
	// RequestEventProjectIssuesRecorded records completed project-issue attribution for a request.
	RequestEventProjectIssuesRecorded RequestEvent = "project_issues_recorded"
	// RequestEventProjectAnalysisCompleted records that project status and issue attribution are complete.
	RequestEventProjectAnalysisCompleted RequestEvent = "project_analysis_completed"
	// RequestEventProjectAnalysisAbandoned records unfinished project analysis after primary processing stopped.
	RequestEventProjectAnalysisAbandoned RequestEvent = "project_analysis_abandoned"
	// RequestEventRecordAbandoned records that record-stage work stopped after exhausting retries.
	RequestEventRecordAbandoned RequestEvent = "record_abandoned"
	// RequestEventBuildAnalysisAbandoned records incomplete build analysis, not a validation outcome.
	RequestEventBuildAnalysisAbandoned RequestEvent = "build_analysis_abandoned"
	// RequestEventBuildAnalysisCompleted records completed issue analysis for the winning terminal build.
	RequestEventBuildAnalysisCompleted RequestEvent = "build_analysis_completed"
	// RequestEventIssueTrackingStarted records the start of per-request issue result recording.
	RequestEventIssueTrackingStarted RequestEvent = "issue_tracking_started"
	// RequestEventIssuesReconciled records completed final issue reconciliation for a build.
	RequestEventIssuesReconciled RequestEvent = "issues_reconciled"
	// RequestEventIssueTrackingAbandoned records unfinished issue reconciliation after primary processing stopped.
	RequestEventIssueTrackingAbandoned RequestEvent = "issue_tracking_abandoned"
	// RequestEventFixSubmitted records an identified repair attempt associated with a build issue.
	RequestEventFixSubmitted RequestEvent = "fix_submitted"
	// RequestEventFixSubmissionSkipped records a repair decision with no eligible open issue.
	RequestEventFixSubmissionSkipped RequestEvent = "fix_submission_skipped"
	// RequestEventFixSubmissionAbandoned records stopped repair submission with an unknown acceptance outcome.
	RequestEventFixSubmissionAbandoned RequestEvent = "fix_submission_abandoned"
)

type RequestHistory

type RequestHistory struct {
	// RequestID is the queue-scoped identifier of the request.
	RequestID string
	// Events are retained request-log events ordered by occurrence time and stable identity.
	Events []RequestLog
	// RequestSummary is the current lifecycle projection for this request.
	RequestSummary RequestSummary
}

RequestHistory groups retained events and the current materialized summary for one request.

type RequestIssueKind

type RequestIssueKind string

RequestIssueKind classifies an accepted issue update within one request.

const (
	RequestIssueKindNew      RequestIssueKind = "new"
	RequestIssueKindExisting RequestIssueKind = "existing"
	RequestIssueKindClosed   RequestIssueKind = "closed"
)

type RequestIssueSummary

type RequestIssueSummary struct {
	// RequestID identifies the request that processed the issue.
	RequestID string `json:"request_id"`
	// TaskID identifies the logical validation task.
	TaskID string `json:"task_id"`
	// UnitID identifies the validation unit; empty for a task-wide failure.
	UnitID string `json:"unit_id"`
	// Kind distinguishes newly opened, already open, and closed issues.
	Kind RequestIssueKind `json:"kind"`
	// BuildID identifies the build whose accepted update produced this result.
	BuildID string `json:"build_id"`
	// FirstSeenBuildID identifies the opening, including for an existing or closed issue.
	FirstSeenBuildID string `json:"first_seen_build_id"`
	// Version is the optimistic-lock version, initially zero.
	Version int32 `json:"version"`
}

RequestIssueSummary is a materialized result of one request's issue reconciliation. Its identity is request, task, and unit within a queue.

func (RequestIssueSummary) Validate

func (i RequestIssueSummary) Validate() error

Validate checks the identity and classification of a request issue.

type RequestIssuesStatus

type RequestIssuesStatus string

RequestIssuesStatus describes coverage of a request's retained issue results.

const (
	RequestIssuesStatusUnavailable RequestIssuesStatus = "unavailable"
	RequestIssuesStatusInProgress  RequestIssuesStatus = "in_progress"
	RequestIssuesStatusComplete    RequestIssuesStatus = "complete"
	RequestIssuesStatusIncomplete  RequestIssuesStatus = "incomplete"
)

type RequestLog

type RequestLog struct {
	// ID is the stable identity of the occurrence within the request.
	ID string `json:"id"`
	// Queue is the logical queue containing the request and scopes RequestID.
	Queue string `json:"queue"`
	// RequestID identifies the request whose log contains this record.
	RequestID string `json:"request_id"`
	// TimestampMs is when the occurrence was first retained, in Unix milliseconds.
	TimestampMs int64 `json:"timestamp_ms"`
	// State is the durable request state recorded by a state record and is unset on an event record.
	State RequestState `json:"state"`
	// Event identifies the occurrence recorded by an event record and is unset on a state record.
	Event RequestEvent `json:"event"`
	// RequestVersion is the durable request version recorded by a state record and is zero on an event record.
	RequestVersion int32 `json:"request_version"`
	// OutcomeReason is the durable domain reason for a terminal request state and is otherwise unset.
	OutcomeReason RequestOutcomeReason `json:"outcome_reason"`
	// Metadata contains optional occurrence context; nil and empty maps are equivalent.
	Metadata map[string]string `json:"metadata"`
}

RequestLog is one immutable request state or explanatory lifecycle occurrence.

func (RequestLog) Validate

func (e RequestLog) Validate() error

Validate verifies the invariants required for a newly persisted request log.

type RequestOutcomeReason

type RequestOutcomeReason string

RequestOutcomeReason identifies the durable domain reason for a terminal request state.

const (
	// RequestOutcomeReasonUnknown is the unset outcome reason.
	RequestOutcomeReasonUnknown RequestOutcomeReason = ""
	// RequestOutcomeReasonBuildSucceeded indicates that the request's build succeeded.
	RequestOutcomeReasonBuildSucceeded RequestOutcomeReason = "build_succeeded"
	// RequestOutcomeReasonBuildFailed indicates that the request's build failed.
	RequestOutcomeReasonBuildFailed RequestOutcomeReason = "build_failed"
	// RequestOutcomeReasonBuildCancelled indicates that the request's build was cancelled.
	RequestOutcomeReasonBuildCancelled RequestOutcomeReason = "build_cancelled"
	// RequestOutcomeReasonProcessingFailed indicates that validation could not be prepared.
	RequestOutcomeReasonProcessingFailed RequestOutcomeReason = "processing_failed"
	// RequestOutcomeReasonBuildPollingExhausted indicates that build status could not be resolved.
	RequestOutcomeReasonBuildPollingExhausted RequestOutcomeReason = "build_polling_exhausted"
	// RequestOutcomeReasonValidationTimeout indicates that validation exceeded its allowed duration.
	RequestOutcomeReasonValidationTimeout RequestOutcomeReason = "validation_timeout"
	// RequestOutcomeReasonSupersededByNewerHead indicates that a newer request replaced this one.
	RequestOutcomeReasonSupersededByNewerHead RequestOutcomeReason = "superseded_by_newer_head"
)

type RequestState

type RequestState string

RequestState defines the internal state of a Stovepipe validation request as it moves through the pipeline. States are internal and used to implement a state machine; a customer-facing status type may be layered on top later, as in SubmitQueue.

const (
	// RequestStateUnknown is the unreachable zero value. It is set by default when the
	// structure is initialized and should never be seen in the system.
	RequestStateUnknown RequestState = ""
	// RequestStateAccepted is the initial state of a request: a new commit has been observed
	// for the queue. Its strategy is either unspecified or explicitly full.
	RequestStateAccepted RequestState = "accepted"
	// RequestStateProcessing means process admitted the request, recorded build strategy and
	// baseline, and published to build.
	RequestStateProcessing RequestState = "processing"
	// RequestStateSuperseded means process skipped the request because a newer head exists.
	RequestStateSuperseded RequestState = "superseded"
	// RequestStateSucceeded means the build validating this request's commit reached a
	// successful terminal status.
	RequestStateSucceeded RequestState = "succeeded"
	// RequestStateFailed means the build validating this request's commit reached an
	// unsuccessful terminal status, or the request could never complete and was forced to a
	// conservative unsuccessful outcome (see workflow.md's fail-closed posture).
	RequestStateFailed RequestState = "failed"
	// RequestStateCancelled means the build validating this request's commit was cancelled
	// before reaching a verdict. Distinct from failed: what a cancellation implies for
	// greenness is decided where greenness is recorded, not here.
	RequestStateCancelled RequestState = "cancelled"
)

func (RequestState) HasBuildOutcome

func (s RequestState) HasBuildOutcome() bool

HasBuildOutcome returns true if the state records the terminal status of this request's build: succeeded, failed, or cancelled. Superseded requests never ran a build, so they are terminal without an outcome.

func (RequestState) IsTerminal

func (s RequestState) IsTerminal() bool

IsTerminal returns true if the state is one the pipeline never advances past: superseded (a newer head preempted this request before it was validated) or one of the three build outcomes. Greenness derived from an outcome is a separate fact recorded against the URI, so it is not part of this lifecycle.

type RequestSummary

type RequestSummary struct {
	// RequestID is the canonical decimal request identifier, unique within Queue.
	RequestID string
	// Queue is the queue containing the request.
	Queue string
	// URI is the commit validated by the request.
	URI string
	// BaseURI is the incremental-validation baseline and is empty before selection or for a full build.
	BaseURI string
	// State is the current durable request lifecycle state.
	State RequestState
	// RequestVersion is the version of the request state represented by this summary.
	RequestVersion int32
	// StateTimestampMs is when the represented state was first retained, in Unix milliseconds.
	StateTimestampMs int64
	// AcceptedAtMs is the original acceptance timestamp in Unix milliseconds; zero means unknown and a positive value is immutable.
	AcceptedAtMs int64
	// ProjectResultsCompletedAtMs is when project analysis finished or was abandoned, in Unix milliseconds.
	// Zero means unknown and a positive value is immutable.
	ProjectResultsCompletedAtMs int64
	// ProjectCount is the number of recorded project results; zero means none recorded.
	ProjectCount int32
	// BrokenProjectCount counts recorded project results with degree above DegreeGreen.
	BrokenProjectCount int32
	// OutcomeReason is the reason for the represented state; empty means unavailable or inapplicable.
	OutcomeReason RequestOutcomeReason
	// Version is the optimistic-lock version of this materialized view.
	Version int32
}

RequestSummary is the materialized current view of a validation request.

type ValidationFact

type ValidationFact struct {
	// URI is the commit the fact describes, in the queue's VCS-agnostic locator
	// form. Unique per (queue, URI, project).
	URI string `json:"uri"`
	// Project is the scope the degree applies to. Empty means the whole
	// repository; named projects narrow the fact to part of it.
	Project string `json:"project"`
	// ProjectType is a provider-defined classification recorded with the fact; empty means unknown.
	ProjectType string `json:"project_type"`
	// Degree is how broken the scope was, on the closed interval
	// [DegreeGreen, DegreeBroken]. A failed repository with project results has
	// DegreePartial; without project results it has DegreeBroken.
	Degree float64 `json:"degree"`
	// RequestID is the request that established the fact.
	RequestID string `json:"request_id"`
	// CreatedAt is the millisecond timestamp at which the fact was recorded.
	CreatedAt int64 `json:"created_at"`
}

ValidationFact is the durable record of how broken one scope was at one commit.

It is immutable and create-only: the first fact written for an identity is the permanent answer, and a later contradicting outcome for the same identity is dropped rather than overwriting it. Identity is (queue, URI, project) — the queue is the binding of the store the fact lives in and so is not carried on the fact itself.

Absence is distinct from DegreeGreen: a URI with no fact has not been validated, which is not the same as having been validated and found healthy.

func (ValidationFact) IsGreen

func (f ValidationFact) IsGreen() bool

IsGreen reports whether the fact records a fully healthy scope. Any degree above DegreeGreen is some amount of broken.

Jump to

Keyboard shortcuts

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