buildanalysis

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: 16 Imported by: 0 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.

README

Build analysis

Build issues

The controller reloads the queue-scoped Build, invokes the queue's issue detector, and persists each returned build issue individually. Build issues already stored for the same build, task, and unit within a queue are not persisted again, so repeated polls and retries after partial writes are safe. Detector results accompanying an error are discarded.

Once the Request records the terminal Build as its winning outcome, successful detection and issue persistence retain build_analysis_completed to authorize final reconciliation. The event snapshots the build ID and issue count, including zero, from the first retained completion. Retries still detect and persist issues, but reuse the retained count and timestamp; a changed count is logged as a detector discrepancy and does not block completion. Concurrent deliveries and uncertain writes converge on the first stored snapshot, while other identity conflicts remain errors. Nonterminal polls and terminal passes waiting for the winning outcome add no completion entry.

Admission registers a queue-partitioned tracking job for each validation before build dispatch. After persistence, analysis retains terminal completion in request history; the tracking job reads that event independently of queue delivery. Issue tracking maintains open issues and lifecycle history; analysis never writes them directly. An empty detection result does not delete earlier build issues.

Issue-tracking handoff

The request-scoped tracking job reads persisted build issues during ordinary refreshes without closing other issues. Once analysis records completion, tracking can also close issues absent from the accumulated build issues, unless any task-wide failure was recorded or the build was canceled. Analysis does not publish tracking messages.

A successful terminal detection must return the complete cumulative issue set for the build, including issues returned by earlier calls. Persisting that result before recording completion makes finalization independent of whether an earlier worker finished saving its results. An empty terminal result is valid only if the build has no reportable issues; inability to determine the complete set must return an error instead. See the detector contract.

All analysis deliveries for a build share its build-ID partition and consumer group. Completion requires a successful pass that began with a terminal Build and the Request's recorded winning build ID. If status becomes terminal before that outcome is recorded, analysis persists the issues and holds until the outcome is available. Known losing builds stop without detection. A Request that ends without a winning build cannot authorize closing issues based on absence; the tracking job goes to its DLQ for cleanup.

Polling and completion

Every delivery reloads the Build and its Request before detection. After a successful pass, a nonterminal Build holds the delivery for two minutes; a terminal Build completes after persistence and completion history once its Request outcome is known, or the Request has ended without one. A pass that begins with a nonterminal Build always holds, even if the Build finishes during detection, so another delivery analyzes it after observing terminal status. More than one delivery may analyze the same terminal Build; build-issue persistence remains idempotent.

If the Request is terminal but the loaded Build is nonterminal, analysis reloads the Build before deciding to stop. The Build may have finished between the initial Build read and the Request read; reloading avoids skipping its final analysis. If it is still nonterminal, analysis retains abandonment and stops without detection or a hold. This can occur when the status-polling DLQ handler fails the Request without learning the actual build result, leaving the Build at its last observed status.

Status polling and updates remain the responsibility of buildsignal. Analysis never changes Request state or releases build slots.

Errors

Detection, persistence, configuration, state-loading, and message-validation errors are returned to the consumer for its normal retry or DLQ policy, whether the Build is running or terminal. Analysis errors do not use the two-minute polling hold. The consumer classifies errors and applies its configured retry limits and backoff; a final analysis can still fail and dead-letter.

DLQ recovery

The recovery controller records a build_analysis_abandoned event in the Request's history, with the build ID, to indicate that analysis could not complete and the recorded build issues may be incomplete. It does not rerun detection, delete earlier build issues, change Request or Build state, or release a build slot. Original failure details are logged rather than included in the immutable history event.

History identity is stable per build, so repeated recovery deliveries and separate analysis notices for the same build retain one event. Different builds retain different events, even for the same Request. A delivery already in flight can still finish successfully without erasing the historical occurrence. New deliveries recognize abandonment rather than rerunning detection.

State-read and history-write errors are returned for retry. Hosts must run recovery with the DLQ consumer's always-retryable processor and unlimited-retry subscription; only recovery work is retried, not analysis. Unusable payloads, invalid or unresolvable queues, missing Build or Request records, and queue mismatches are logged and acknowledged rather than retried indefinitely.

Host integration

The reference service supplies a no-op detector, registers tracking at admission, and publishes analysis notices at build start and completion. It registers both analysis and issue tracking with bounded normal retries and the existing DLQ consumer for recovery. See issue tracking for reconciliation and recovery behavior and build issue detection for the publication rules and retry configuration.

Project-analysis handoff

Completed terminal analysis queues project analysis only after its final issues and completion event are durable. Cancellation is recorded directly by buildsignal. Abandoned analysis stops without initiating project analysis or repository recording. Losing builds never initiate project analysis for the winning outcome.

Documentation

Overview

Package buildanalysis accumulates issue observations during and after builds. Build status is read from storage; status polling remains separate.

Index

Constants

View Source
const PollDelayMs int64 = 120000

PollDelayMs is the delay in milliseconds between successful polling passes. Two minutes limits provider traffic during long-running builds.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller accumulates build issues while builds run and after completion. Terminal analysis must persist all build issues and its completion event before acknowledging.

func NewController

func NewController(
	logger *zap.SugaredLogger,
	scope tally.Scope,
	stores storage.Factory,
	materializer requestlog.Materializer,
	detectorFactory buildissue.DetectorFactory,
	registry consumer.TopicRegistry,
	topicKey consumer.TopicKey,
	consumerGroup string,
) *Controller

func (*Controller) ConsumerGroup

func (c *Controller) ConsumerGroup() string

func (*Controller) Name

func (c *Controller) Name() string

func (*Controller) Process

func (c *Controller) Process(ctx context.Context, delivery consumer.Delivery) (retErr error)

Process persists detected issues and holds while further analysis is needed. Errors use normal queue retry or DLQ handling; partial writes are safe to retry.

func (*Controller) TopicKey

func (c *Controller) TopicKey() consumer.TopicKey

type DLQController

type DLQController struct {
	// contains filtered or unexported fields
}

DLQController records incomplete analysis without rerunning detection or changing the validation outcome.

func NewDLQController

func NewDLQController(
	logger *zap.SugaredLogger,
	scope tally.Scope,
	stores storage.Factory,
	materializer requestlog.Materializer,
	topicKey consumer.TopicKey,
	consumerGroup string,
) *DLQController

NewDLQController creates a controller for incomplete build analysis.

func (*DLQController) ConsumerGroup

func (c *DLQController) ConsumerGroup() string

func (*DLQController) Name

func (c *DLQController) Name() string

func (*DLQController) Process

func (c *DLQController) Process(ctx context.Context, delivery consumer.Delivery) error

Process retains incomplete-analysis history and acknowledges unusable messages. State-read and history-write failures are returned for DLQ recovery retry.

func (*DLQController) TopicKey

func (c *DLQController) TopicKey() consumer.TopicKey

Jump to

Keyboard shortcuts

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