Documentation
¶
Overview ¶
Package report defines the transport and persistence shapes for territory coverage and converts coverage domain results into them. the broker and the monitor both import this package without an import cycle: coverage carries no schema knowledge, report carries no calculation. one conversion defines the public coverage shape used by review status, results, collect, and audit. CLI renderers consume this data and may group or format it but never recalculate coverage.
report also owns the shared dd codec. dd is the single binding substrate for every project payload — on-disk records, and the MCP tool inputs, results, and errors. project-owned structs carry no json tags; the raw reviewer JSON passes through unbound as its nested value so disk and MCP agree on it. schema knowledge stays out of this package; the explicit MCP schemas live in internal/mcpserver.
Index ¶
Constants ¶
const FileScopeFull = "full"
FileScopeFull identifies the audit's scope: the full tracked tree.
Variables ¶
var Codec = &dd.Options{ Converters: map[reflect.Type]dd.Converter{ reflect.TypeOf(json.RawMessage{}): rawMessageConverter{}, }, }
Codec is the shared dd binding options for project data. it carries the raw-reviewer-JSON converter so the reviewer's raw output — a json.RawMessage field on the result DTOs — passes through unbound as its original nested value rather than being rendered as a byte array. disk persistence and the MCP adapter both bind and unbind through this so they can never diverge on raw reviewer content.
Functions ¶
func BindJSON ¶
BindJSON binds raw JSON into target using the shared codec, the inverse of UnbindJSON used to read persisted records back.
func Unbind ¶
Unbind converts v into a dd map using the shared codec, ready to cross the MCP transport as a plain map.
func UnbindJSON ¶
UnbindJSON serializes v to JSON using the shared codec, the bytes written to disk and emitted as MCP text content.
Types ¶
type AuditResponse ¶
type AuditResponse struct {
Project string
Rubric string
FileScope string
Coverage *Coverage
// DeadPatterns are ordered by ref then declared pattern string.
DeadPatterns []DeadPattern
// CoverageMap is nil when the map was not requested and a pointer to an
// initialized (possibly empty) slice when it was, so requested-empty
// survives serialization as [] while omitted stays absent through dd.
CoverageMap *[]MapGroup
}
AuditResponse is the audit_coverage result: the assessed coverage of the project rubric over its full tracked tree, the dead territory patterns, and the optional per-file coverage map.
func AuditResponseFrom ¶
func AuditResponseFrom(project, rubric string, a coverage.Assessment, includeMap bool) *AuditResponse
AuditResponseFrom converts an assessment for project and rubric into the audit wire object. includeMap selects the per-file coverage map: a requested map is always present (possibly []), an unrequested one nil.
type Coverage ¶
type Coverage struct {
Assessed bool
Reason string `dd:",+omitempty"`
FileCounts *FileCounts
LocalQualities []QualityRef
UncoveredFiles []string
Exclusions []Exclusion
}
Coverage is the wire object carried by every new review status, completed result, collect response, and audit result.
Assessed is true for a rubric assessment, including empty input and no-local-tier cases. Reason is omitted when assessed and carries ad_hoc otherwise. FileCounts is present only when assessed. array members are always arrays, never null: empty for not-assessed output, and empty for assessed output with nothing to report. a nil *Coverage on historical status and result DTOs means coverage information is unavailable; it must never be filled in from the current canon.
func CloneCoverage ¶
CloneCoverage deep-copies a wire coverage object, including the nested exclusion file lists and local-quality lists, so crossing a mutable result boundary cannot alter the source. a nil source stays nil.
func CoverageFrom ¶
func CoverageFrom(a coverage.Assessment) *Coverage
CoverageFrom converts a domain assessment to the wire coverage object. it initializes every array to an empty slice so serialization emits [] rather than null, and deep-copies nested lists so mutating the result cannot reach the assessment it came from.
type DeadPattern ¶
type DeadPattern struct {
Quality QualityRef
Pattern string
}
DeadPattern is a territory pattern that matches no file in the audited tree, attributed to the quality that declares it.
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: excluded first, then covered, then uncovered. present only on assessed output.
type MapFile ¶
type MapFile struct {
File string
Qualities []QualityRef
ExclusionPatterns []string
}
MapFile is one file's coverage map entry: the local qualities and exclusion patterns that reach it.
type MapGroup ¶
MapGroup groups coverage map entries by immediate parent directory, with "." for repo-root files. file-level differences within a directory are preserved.
type QualityRef ¶
QualityRef identifies a quality by its head id and its canon-relative ref.