extent

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 8 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.

Documentation

Overview

Package extent holds the statement of how far one run of a command looked (itd-2611211024360819): what it looked at, what it did not look at and why, what it could not check this time, and, where a model did the judging, how hard that judging looked. Every declared command attaches it to its result under one member, `extent`; the name is not `coverage`, which several results and the lifeboat probe already use for something else.

The package imports no other core, so every core can import it. The core returns the statement and writes nothing; Lines, in render.go, is the one renderer every surface prints.

Every identifier a recorded statement carries comes from a closed set, and encoding refuses one outside it. The reasons and causes are held by testdata/identifiers.golden: a release may add one, written there as well, and never rename or remove one (criterion 24).

Decoding is strict: an identifier outside its set is refused, and with it the whole statement. A build reading a statement written by a later release that added an identifier therefore refuses it. Whether a reader should tolerate an identifier it does not know is left open here, for the step that first stores statements where another build reads them back.

Index

Constants

View Source
const GapsFlag = "--gaps"

GapsFlag is the one flag a declared command takes to list every gap.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cause

type Cause string

Cause says why a registry kind was left out in this run.

const (
	// CauseHostRun: the host's agents run it, not this command.
	CauseHostRun Cause = "host_run"
	// CauseOtherRun: it is left to another way of running the command.
	CauseOtherRun Cause = "other_run"
	// CauseNotArmed: the configuration armed no such check.
	CauseNotArmed Cause = "not_armed"
	// CauseNothingToRead: the check was armed and the run had nothing to read
	// it against.
	CauseNothingToRead Cause = "nothing_to_read"
)

The four causes, in their order of precedence: where more than one applies, an entry carries the first (Statement.LeaveOut picks it).

func (Cause) MarshalText

func (c Cause) MarshalText() ([]byte, error)

MarshalText refuses a cause outside the closed set.

func (*Cause) UnmarshalText

func (c *Cause) UnmarshalText(b []byte) error

UnmarshalText refuses a cause outside the closed set.

type Depth

type Depth struct {
	Role   string `json:"role"`
	Lane   string `json:"lane,omitempty"`
	Issue  string `json:"issue,omitempty"`
	Class  *Told  `json:"class,omitempty"`
	Runs   Runs   `json:"runs"`
	Effort *Told  `json:"effort,omitempty"`
}

Depth is how hard one judging role looked, keyed by the lane whose change it judged or by the issue whose remedy it judged, or by its role alone. An entry whose role ran no judging run gives a count of zero and neither a class nor an effort.

type Gap

type Gap struct {
	Check  string `json:"check"`
	Kind   string `json:"kind,omitempty"`
	Reason Reason `json:"reason"`
	Text   string `json:"text"`
}

Gap is one check that could not be made in this run. Kind names the kind it bears on, where there is one: a kind in LookedAt when the run read it all the same, or a kind in neither list when the failed check stopped it being read at all.

type Looked

type Looked struct {
	ID    string `json:"id"`
	Label string `json:"label"`
	Count int    `json:"count"`
}

Looked is one registry kind the run looked at, with how many it found by what the command counts as a finding. A kind in which nothing was found is an entry with a count of zero.

type Mark

type Mark string

Mark stands in place of a depth value abcd does not have.

const (
	// MarkNotTold: the host did the judging and no receipt says.
	MarkNotTold Mark = "not_told"
	// MarkNoneAsked: abcd started the run and asked for none.
	MarkNoneAsked Mark = "none_asked"
)

func (Mark) MarshalText

func (m Mark) MarshalText() ([]byte, error)

MarshalText refuses a mark outside the closed set.

func (*Mark) UnmarshalText

func (m *Mark) UnmarshalText(b []byte) error

UnmarshalText refuses a mark outside the closed set.

type NotLooked

type NotLooked struct {
	ID     string `json:"id"`
	Label  string `json:"label"`
	Source Source `json:"source"`
	Cause  Cause  `json:"cause,omitempty"`
}

NotLooked is one kind the run did not look at. Only a SourceLeftOut entry carries a Cause.

type Origin

type Origin string

Origin says where a depth value came from.

const (
	// OriginRunState: the run's own state recorded it as it handed out the
	// judging run.
	OriginRunState Origin = "run_state"
	// OriginReceipt: a receipt on disk carries it, the host's own account,
	// relayed and not vouched for.
	OriginReceipt Origin = "receipt"
)

func (Origin) MarshalText

func (o Origin) MarshalText() ([]byte, error)

MarshalText refuses an origin outside the closed set.

func (*Origin) UnmarshalText

func (o *Origin) UnmarshalText(b []byte) error

UnmarshalText refuses an origin outside the closed set.

type Reason

type Reason string

Reason says why a check could not be made in this run.

const (
	// ReasonUnreadable: a store or file could not be read.
	ReasonUnreadable Reason = "unreadable"
	// ReasonUnreachable: a remote or forge did not answer.
	ReasonUnreachable Reason = "unreachable"
	// ReasonToolMissing: a program the check needs is absent.
	ReasonToolMissing Reason = "tool_missing"
	// ReasonTimedOut: the check ran out of time.
	ReasonTimedOut Reason = "timed_out"
	// ReasonCheckFailed: the check ran and returned an error of none of the
	// other kinds.
	ReasonCheckFailed Reason = "check_failed"
)

The five reasons, in the order the renderer counts them.

func (Reason) MarshalText

func (r Reason) MarshalText() ([]byte, error)

MarshalText refuses a reason outside the closed set.

func (*Reason) UnmarshalText

func (r *Reason) UnmarshalText(b []byte) error

UnmarshalText refuses a reason outside the closed set.

type RenderOptions

type RenderOptions struct {
	// AllGaps lists every gap in full under the count line, which then names
	// no flag: the person passed GapsFlag, or no one can pass it (the sweep
	// abcd runs on its own).
	AllGaps bool
}

RenderOptions shapes the text of a statement.

type Runs

type Runs struct {
	Count int
	From  Origin
	Mark  Mark
}

Runs is the number of judging runs: either the count with where it came from, or a Mark in its place.

func (Runs) MarshalJSON

func (r Runs) MarshalJSON() ([]byte, error)

MarshalJSON writes the count only where no Mark stands in its place, so a count of zero is recorded and a count abcd was not told is not.

func (*Runs) UnmarshalJSON

func (r *Runs) UnmarshalJSON(b []byte) error

UnmarshalJSON reads what MarshalJSON writes, strictly (decodeStrict).

type Source

type Source string

Source says where a not-looked-at entry comes from.

const (
	// SourceLeftOut: a registry kind this run did not look at, taken from the
	// code, with a Cause.
	SourceLeftOut Source = "left_out"
	// SourceExclusion: what the command's code leaves out by a rule it reads
	// itself. It stands in every run.
	SourceExclusion Source = "exclusion"
	// SourceListed: a kind on the command's hand-written list. It stands in
	// every run.
	SourceListed Source = "listed"
)

func (Source) MarshalText

func (s Source) MarshalText() ([]byte, error)

MarshalText refuses a source outside the closed set.

func (*Source) UnmarshalText

func (s *Source) UnmarshalText(b []byte) error

UnmarshalText refuses a source outside the closed set.

type Statement

type Statement struct {
	LookedAt      []Looked
	NotLookedAt   []NotLooked
	CouldNotCheck []Gap
	Depth         []Depth
	// NoClearState marks a command that has no clear state (the drive of a
	// drain): its statement carries no verdict member at all.
	NoClearState bool
}

Statement is how far one run looked. The three lists are recorded on every run, empty or not. Depth is recorded only where a model did the judging.

func (*Statement) LeaveOut

func (s *Statement) LeaveOut(id, label string, applies ...Cause)

LeaveOut records a registry kind this run did not look at. Where more than one cause applies it records the first of host_run, other_run, not_armed and nothing_to_read; given no cause, the entry is left without one and the statement fails to encode.

func (Statement) Lines

func (s Statement) Lines(o RenderOptions) []string

Lines renders the statement as the lines every command prints, in this order:

  • "Looked at:" and the labels, or "Looked at: nothing";
  • "Left out in this run:" and each left-out kind with its cause, where there is one;
  • "Known not looked at:" and the exclusions and the hand-written list, only on the verdicts clear and clear_except_gaps;
  • "Could not check:" and one count of checks for each reason, naming GapsFlag, or, with AllGaps, naming no flag and followed by every gap; no such line when there is no gap;
  • one "Judged by:" line for each depth entry;
  • a summary: clear except for the gaps on clear_except_gaps, or, where no kind was looked at, that nothing was checked and why.

Every value taken from the statement is masked for one line of a terminal.

func (Statement) MarshalJSON

func (s Statement) MarshalJSON() ([]byte, error)

MarshalJSON validates s and writes it with its derived verdict. A statement Validate refuses fails to encode.

func (*Statement) UnmarshalJSON

func (s *Statement) UnmarshalJSON(b []byte) error

UnmarshalJSON reads what MarshalJSON writes, strictly (decodeStrict), and then as Validate judges it. An absent verdict reads as no clear state, and a verdict the entries do not derive is refused.

A depth value's origin is read as recorded, and the renderer marks only a receipt's value as the host's account. A caller that decodes a statement a host or any other party could have written must set each depth value's origin itself rather than trust the recorded one, or a value a host wrote would read as one abcd's own state recorded.

func (Statement) Validate

func (s Statement) Validate() error

Validate reports the first way s cannot be recorded: an identifier outside its set, a kind both looked at and not looked at (criterion 12) or named twice, a cause on an entry not left out in this run or none on one that is, an entry missing its identifier, label, check or text, or a depth entry that gives a value and a mark at once, or neither, for any of its three values: a role that ran judging runs gives its class and its effort too, and only a role that ran none gives neither.

func (Statement) Verdict

func (s Statement) Verdict() (Verdict, bool)

Verdict derives the statement's verdict, in this order: found whenever something was found; otherwise none when no registry kind was looked at; otherwise clear_except_gaps when a check could not be made; otherwise clear. It reports false for a command with no clear state.

type Told

type Told struct {
	Values []string `json:"values,omitempty"`
	From   Origin   `json:"from,omitempty"`
	Mark   Mark     `json:"mark,omitempty"`
}

Told is a depth value that is a list (the classes the judging runs ran at, the efforts each was asked for): either the values with where they came from, or a Mark in their place.

type Verdict

type Verdict string

Verdict is the statement's own verdict. It is derived from the entries, never set, so it cannot be made to read clean.

const (
	// VerdictClear: something was looked at, nothing was found and every
	// check was made.
	VerdictClear Verdict = "clear"
	// VerdictClearExceptGaps: something was looked at and nothing was found,
	// and at least one check could not be made.
	VerdictClearExceptGaps Verdict = "clear_except_gaps"
	// VerdictFound: something was found.
	VerdictFound Verdict = "found"
	// VerdictNone: no registry kind was looked at, whatever the reason, so the
	// statement gives no verdict.
	VerdictNone Verdict = "none"
)

func (Verdict) MarshalText

func (v Verdict) MarshalText() ([]byte, error)

MarshalText refuses a verdict outside the closed set.

func (*Verdict) UnmarshalText

func (v *Verdict) UnmarshalText(b []byte) error

UnmarshalText refuses a verdict outside the closed set.

Jump to

Keyboard shortcuts

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