procgroup

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPass                  Status                = "PASS"
	StatusFail                  Status                = "FAIL"
	StatusNotRun                Status                = "NOT_RUN"
	OutcomeCompatible           Outcome               = "compatible"
	OutcomeDifferent            Outcome               = "different"
	OutcomeInstability          Outcome               = "instability"
	OutcomeWithheld             Outcome               = "withheld"
	InconclusiveNone            CaseInconclusiveState = ""
	InconclusiveTimeout         CaseInconclusiveState = "timeout"
	InconclusiveSetup           CaseInconclusiveState = "compilation/setup failure"
	InconclusiveResource        CaseInconclusiveState = "resource exhaustion"
	InconclusiveSkipped         CaseInconclusiveState = "skipped test"
	InconclusiveSandbox         CaseInconclusiveState = "missing sandbox"
	InconclusiveInconsistent    CaseInconclusiveState = "inconsistent run"
	RefusalNone                 PrelaunchRefusal      = "none"
	RefusalDescriptorInvalid    PrelaunchRefusal      = "descriptor-invalid"
	RefusalDigestMismatch       PrelaunchRefusal      = "digest-mismatch"
	RefusalFixtureNotRegistered PrelaunchRefusal      = "fixture-not-registered"
	RefusalMissingSandbox       PrelaunchRefusal      = "missing-sandbox"
	RefusalResourceBound        PrelaunchRefusal      = "resource-bound"
	RefusalBudgetExpired        PrelaunchRefusal      = "budget-expired"
	ReasonDescriptorInvalid                           = "descriptor-invalid"
	ReasonDigestMismatch                              = "digest-mismatch"
	ReasonFixtureNotRegistered                        = "fixture-not-registered"
	ReasonStartFailed                                 = "start-failed"
	ReasonMissingSandbox                              = "missing-sandbox"
	ReasonResourceBound                               = "resource-bound"
	ReasonBudgetExpired                               = "budget-expired"
	ReasonNoLaunchObserved                            = "no-launch-observed"
)
View Source
const (
	DefaultOutputLimit = 16 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjudication

type Adjudication struct {
	Status                Status                `json:"status"`
	Outcome               Outcome               `json:"outcome"`
	RecordCount           int                   `json:"record_count"`
	Launches              int                   `json:"launches"`
	UnobservedLaunches    int                   `json:"unobserved_launches"`
	CaseInconclusiveState CaseInconclusiveState `json:"-"`
	Reason                string                `json:"reason"`
	FullyObserved         bool                  `json:"-"`
}

func Adjudicate

func Adjudicate(planned int, refusal PrelaunchRefusal, observations []Observation) Adjudication

Adjudicate decides only rows 1–7. A fully observed result delegates comparison and the net scratch-effect predicate to the caller; it never invents a verdict.

type CaseInconclusiveState

type CaseInconclusiveState string

type DescendantObservation

type DescendantObservation struct {
	Scope       string            `json:"scope"`
	IntervalMS  int               `json:"interval_ms"`
	Processes   []ObservedProcess `json:"processes"`
	Absent      bool              `json:"absent"`
	Failures    []string          `json:"failures"`
	Limitations []string          `json:"limitations"`
}

type Observation

type Observation struct {
	DescendantObservation *DescendantObservation
	Stdout                []byte
	Stderr                []byte
	Usage                 *ResourceUsage

	ExitStatus                     int
	ExitObserved                   bool
	Signal                         string
	Err                            error
	Started                        bool
	TimedOut                       bool
	Cancelled                      bool
	OutputOverflow                 bool
	StdoutOverflow                 bool
	StderrOverflow                 bool
	WaitCompleted                  bool
	PipesDrained                   bool
	OwnedProcessGroupCleanup       bool
	DescendantCleanupStatus        string
	DescendantCleanupQualification string
}

func Run

func Run(ctx context.Context, spec Spec) Observation

Run executes the process with bounded output and descendant cleanup. The caller owns the process umask.

type ObservedProcess

type ObservedProcess struct {
	PID       int    `json:"pid"`
	ParentPID int    `json:"parent_pid"`
	Start     string `json:"start"`
	State     string `json:"state"`
}

type Outcome

type Outcome string

type OverflowPolicy

type OverflowPolicy uint8

OverflowPolicy controls whether a bounded capture stops its producer. The zero value preserves the existing fail-on-overflow contract.

const (
	OverflowFail OverflowPolicy = iota
	OverflowTruncate
)

type PrelaunchRefusal

type PrelaunchRefusal string

type ResourceUsage

type ResourceUsage struct {
	UserCPUNs   int64
	SystemCPUNs int64
	MaxRSSBytes int64
}

ResourceUsage is the reaped process's operating-system accounting. Nil means the host did not supply supported accounting; it must not be reported as zero.

type Spec

type Spec struct {
	Argv  []string
	Dir   string
	Env   []string
	Stdin []byte
	// Dialogue is an internal bounded stdio protocol. It must stop when its
	// streams close, never spawn unjoined work, and enforce its input bound.
	// The process lifecycle closes both streams on every stop and joins it.
	Dialogue                 func(io.Reader, io.WriteCloser) error
	Timeout                  time.Duration
	ShutdownTimeout          time.Duration
	InputLimit               int
	OutputLimit              int
	StderrLimit              int // Zero inherits the normalized OutputLimit.
	OverflowPolicy           OverflowPolicy
	RequireDescendantCleanup bool
	// ObserveDescendants additionally tracks observed PID/start identities,
	// including children that leave the owned group. This is bounded observation,
	// not full containment: a fast detach between samples can remain unobserved.
	ObserveDescendants bool
	// JoinAncestorProcessGroup makes this leader join the process group of
	// whichever process starts it, instead of creating a new one. Set this
	// only when the caller is itself a leader running inside an ancestor's
	// owned process group (a nested Run inside a Run): it lets the
	// ancestor's group-directed kill reach this leader and its own
	// descendants directly, no matter how deeply Run calls nest. This Run
	// call in turn stops only its own pid on its own timeout or cancel,
	// since it does not own the shared group. It therefore cannot prove its
	// descendants gone: the observation reports DescendantCleanupStatus
	// "ancestor-process-group", a PARTIAL qualification, and never
	// OwnedProcessGroupCleanup; the ancestor's own Run carries that proof.
	JoinAncestorProcessGroup bool
	// BeforeStop is an audited internal, synchronous cleanup hook. It must honor
	// its context and leave no asynchronous work. The allowance is at most one
	// second (half ShutdownTimeout), in addition to the normal shutdown budget;
	// arbitrary callbacks cannot be forcibly bounded safely.
	BeforeStop func(context.Context, int) error
	// AfterStart may register a leader-bound observer; output drains start as
	// soon as the pipes exist, before this hook runs, so a child that fills a
	// pipe cannot block behind it. It has the same cooperative allowance as
	// BeforeStop; any observer it starts must be joined by BeforeStop,
	// including after an initialization failure.
	AfterStart func(context.Context, int) error
}

type Status

type Status string

These vocabularies are deliberately independent (CRR-V0-006).

Jump to

Keyboard shortcuts

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