package protocol // Finding is one item of a run's findings ledger. The runner owns the ledger: // stages report new findings and status changes in an output.md "# findings" // section, and the runner assigns the stable ID (F1, F2, ...), keeps the latest // status and records every change as an event. type Finding struct { ID string `json:"id"` Severity string `json:"severity"` Origin string `json:"origin"` Location string `json:"location,omitempty"` Summary string `json:"summary"` Status string `json:"status"` // Reason is the latest status change's reason. Reason string `json:"reason,omitempty"` RaisedBy string `json:"raised_by"` RaisedSequence int `json:"raised_sequence"` UpdatedBy string `json:"updated_by,omitempty"` UpdatedSequence int `json:"updated_sequence,omitempty"` Events []FindingEvent `json:"events,omitempty"` } // FindingEvent is one status change of a finding, in the visit that made it. type FindingEvent struct { Sequence int `json:"sequence"` Stage string `json:"stage"` Status string `json:"status"` Reason string `json:"reason,omitempty"` } // Finding severities (most severe first), statuses and origins. const ( SeverityCritical = "critical" SeverityImportant = "important" SeverityMinor = "minor" SeverityNit = "nit" FindingOpen = "open" FindingFixed = "fixed" FindingDismissed = "dismissed" FindingSettled = "settled" OriginIntroduced = "introduced" OriginPreExisting = "pre-existing" ) // ExhaustedKey marks a waiting (then decided) step the runner created when a // loop exhausted its visits on a stage with on_exhausted=decide. The value is a // map with stage, visit, max_visits and targets (option -> target). Such a step // is a decision, never a stage visit. const ExhaustedKey = "exhausted" // Exhaustion decision options. const ( ExhaustedAccept = "accept" ExhaustedContinue = "continue" ExhaustedAbort = "abort" ) // ExhaustedInfo reads the exhaustion marker from a step output, or nil. func ExhaustedInfo(output map[string]any) map[string]any { info, _ := output[ExhaustedKey].(map[string]any) return info }