Documentation
¶
Overview ¶
Package coverage computes territory-coverage assessments: for a set of starting-point files, which files no project-local quality of the composed rubric reaches, which rubric exclusion patterns suppress, and — on request — which territory patterns are dead and which local qualities reach each file.
review-time reporting and the full-tree audit both run this one calculation, so the two surfaces can never disagree about a file's coverage. the package owns plain domain types only: it performs no filesystem access and carries no JSON, YAML, MCP, or CLI knowledge. the report package converts Assessment to the wire shapes; CLI renderers consume report data and may group or format it but never recalculate coverage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assessment ¶
type Assessment struct {
// Assessed is true for a rubric assessment, including the empty-input and
// no-local-tier cases.
Assessed bool
// Reason explains a not-assessed result, such as an ad-hoc review. it is
// empty when assessed.
Reason string
FileCounts FileCounts
// LocalQualities are all local qualities in the composed rubric, sorted
// by ref. it is empty for a rubric with no local tier.
LocalQualities []QualityRef
// UncoveredFiles are the reportable uncovered paths, sorted: files no
// local quality reaches and no exclusion suppresses.
UncoveredFiles []string
// Exclusions are the rubric's distinct declared exclusion patterns,
// sorted, each with the input files it matches.
Exclusions []Exclusion
// FileDetails hold one entry per input file, sorted by path; set only
// when Options.WithMap is set.
FileDetails []FileDetail
// DeadPatterns are sorted by ref then pattern; set only when
// Options.WithDeadPatterns is set.
DeadPatterns []DeadPattern
}
Assessment is the result of one coverage calculation.
func Assess ¶
func Assess(ctx context.Context, project string, composed []canon.Selected, files []string, exclusions []string, opts Options) (Assessment, error)
Assess computes how the project-local qualities in composed reach the normalized input files, with exclusions suppressing uncovered-file complaints. project is the resolved project identity; a quality is local when its canon ref sits beneath projects/<project>/. a local quality with no territory reaches every input file. general and foreign-project qualities never supply local matches, but their explicit territory patterns participate in dead-pattern detection.
every quality territory and exclusion pattern is validated before the assessment is returned, even for an empty file set, and matcher errors propagate instead of being treated as absence of a match. a canceled context stops evaluation promptly.
type DeadPattern ¶
type DeadPattern struct {
Quality QualityRef
Pattern string
}
DeadPattern is a territory pattern that matches no input file. a pattern whose only matches fall in an excluded tree is not dead.
type Exclusion ¶
Exclusion pairs a declared exclusion pattern with all input files it matches, including files also reached by local qualities.
type FileCounts ¶
FileCounts classifies the input files disjointly: a file matching any exclusion counts once as excluded, else a file reached by a local quality is covered, else it is uncovered. these are file counts, not a coverage score.
type FileDetail ¶
type FileDetail struct {
File string
Qualities []QualityRef
ExclusionPatterns []string
}
FileDetail records, for one input file, the local qualities and exclusion patterns that reach it. files remain visible whether covered, uncovered, or excluded.
type Options ¶
Options requests the audit-only detail beyond the core assessment. review-time evaluation passes neither flag: a review must never call a pattern dead merely because it misses the changeset.
type QualityRef ¶
QualityRef identifies a quality by its head id and its canon-relative ref.