dependencylimit

package
v0.3.0-20260713150412-... Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

Speculation Dependency Limit

Vendor-agnostic "how much" policy that bounds how many active (in-flight, non-terminal) dependencies a batch may speculate over.

See the Speculation RFC for the end-to-end design and how limits fit into the two-layer speculation model.

Dependency Limit

Speculation splits into decision seams (what to build) and limit policies (how much to allow). The dependency limit is the first limit: it is the eligibility gate for speculation. A batch becomes eligible to enumerate only when its count of active dependencies is at or below the current limit; otherwise it waits. Nothing is dropped — as dependencies land they leave the active set, the count shrinks, and the batch is admitted. The gate applies even to the fully-stacked happy path, so a very long chain is not speculated in full at once.

The value is signal-driven, not a fixed constant. Its primary input is the build system's available capacity, so a period of CI pressure can shrink how deep the queue speculates, but a policy may also weigh historical pass rates, cost budgets, time of day, or an experiment toggle. Because the value is dynamic, a change to the limit alone — not only a landing dependency or a DAG change — can newly admit a waiting batch.

Unlike the selection and prioritization limits, the dependency limit is not injected into a decision seam. It gates eligibility before enumeration and needs active-dependency reconciliation, which is controller orchestration — so the controller holds it, consults it on every respeculate, and applies it, keeping the enumerator pure.

Factory

A per-queue factory returns the limit policy for a queue, following the repo's extension contract. It is handed only the queue identity; the signals a policy weighs — a capacity feed, historical metrics, config — are injected at construction by the integrator in the wiring layer. Computing the limit itself takes no further inputs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// QueueName identifies the queue this DependencyLimit serves.
	QueueName string
}

Config carries the per-queue identity handed to a Factory. The system knows only the queue name; everything a policy needs to compute the limit (a capacity feed, historical metrics, config) is injected at construction by the integrator.

type DependencyLimit

type DependencyLimit interface {
	// Limit returns the current maximum number of active dependencies a batch
	// may speculate over. The controller compares a batch's active-dependency
	// count against this to decide eligibility. It takes no parameters; anything
	// an implementation needs is injected at construction.
	Limit(ctx context.Context) (int, error)
}

DependencyLimit is the "how much" policy that bounds how many active (in-flight, non-terminal) dependencies a batch may speculate over.

It is the eligibility gate for speculation: a batch becomes eligible to enumerate only when its count of active dependencies is at or below the current limit; otherwise it waits, and is admitted later as predecessors land and leave the active set. The limit is a bound, not a trim — nothing is dropped from a batch's base.

The value is dynamic: it may change between calls — not only when a dependency lands — so a change alone can newly admit a waiting batch, and the controller re-consults it on every respeculate rather than caching it.

This limit is the exception among the speculation limits: it gates eligibility *before* enumeration and needs active-dependency reconciliation, which is controller orchestration — so the controller holds and applies it, rather than it being injected into a decision seam. The enumerator stays pure.

type Factory

type Factory interface {
	// For returns the DependencyLimit for the given queue.
	For(cfg Config) (DependencyLimit, error)
}

Factory builds the DependencyLimit for a queue. Implementations are provided by integrators (and tests) and inject whatever signals they need at construction.

Directories

Path Synopsis
Package fake provides a programmable dependencylimit.DependencyLimit for tests and examples.
Package fake provides a programmable dependencylimit.DependencyLimit for tests and examples.
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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