Documentation
¶
Overview ¶
Package failures owns the append-only failure registry (SPEC §4.1): a JSON array of failure notes under a repository path, distilled into lessons (§11). From §19.2 it also backs the lesson-candidate list — findings the critic raised that no artifact confirmed, kept to detect a recurring class. Load and Append are the thin I/O shell; a missing file reads as empty. Writes are atomic.
Index ¶
- Constants
- func Append(path string, notes ...string) error
- func AppendRecords(path string, recs ...Record) error
- func ClassifyRootCause(grounded bool) string
- func Load(path string) ([]string, error)
- func RootCauseCounts(recs []Record, class string) map[string]int
- func ScopeFor(recs []Record, class string) (labels, paths []string)
- func StrataCount(recs []Record) map[string]int
- type Record
Constants ¶
const ( // RegistryFile is the confirmed failure registry (§4.1): a deterministic check // that a critic finding named actually failed. RegistryFile = ".adh/failures.json" // CandidatesFile is the §11 lesson-candidate list (§19.2): a critic finding no // artifact confirmed, recorded so a class can be promoted once it recurs. CandidatesFile = ".adh/lesson-candidates.json" // RecordsFile is the stamped failure-record log (§19.2): one record per disposed // finding carrying its stratum, the arc's routing scope, and its root cause — the // evidence the §11 temporal gate, scope-tagging, and root-cause triage read. RecordsFile = ".adh/failure-records.json" )
const ( RootUngrounded = "ungrounded" // failed with no routed context — fix routing RootGroundedMiss = "grounded-miss" // failed despite routed context — fix content )
Root-cause categories (§19.2 triage) — derived deterministically from the arc's grounding at failure time, so a human reading the log sees whether to fix routing or fix the routed content.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append adds notes to the registry at path, creating it and its directory if absent, and rewrites the file atomically. Appending nothing is a no-op, so it never creates an empty registry.
func AppendRecords ¶
AppendRecords adds records to the log at path, creating it and its directory if absent, and rewrites the file atomically. Appending nothing is a no-op, so it never creates an empty log.
func ClassifyRootCause ¶
ClassifyRootCause triages a failed attempt by whether it was grounded — whether any context was routed to it (§19.2). A grounded miss points at the content; an ungrounded one points at routing.
func Load ¶
Load reads the note list at path. A missing file is empty, not an error; a malformed one is EINVALID.
func RootCauseCounts ¶
RootCauseCounts tallies a class's records by root cause (§19.2 triage), so a human deciding whether to promote sees whether the class is a routing or a content problem. Pure.
func ScopeFor ¶
ScopeFor returns the distinct labels and paths a class recurred under, sorted — the routing scope a promoted lesson should carry so it routes to where it was learned, not globally (§19.2 scope-tagging). Pure.
func StrataCount ¶
StrataCount maps each class to the number of distinct time strata it recurred across (§11 temporal gate). Records with no stratum contribute nothing. Pure.
Types ¶
type Record ¶
type Record struct {
Class string `json:"class"`
Stratum string `json:"stratum,omitempty"`
Labels []string `json:"labels,omitempty"`
Paths []string `json:"paths,omitempty"`
RootCause string `json:"root_cause,omitempty"`
}
Record is one disposed critic finding, stamped so accretion can gate on it (§19.2): Class is the finding kind it grouped under, Stratum the year-month it occurred in (the §11 temporal gate), Labels/Paths the arc's routing scope (so a promoted lesson routes to where it was learned), and RootCause the deterministic triage of the attempt's grounding.
func LoadRecords ¶
LoadRecords reads the stamped failure-record log at path. A missing file is empty, not an error; a malformed one is EINVALID.