Documentation
¶
Overview ¶
Package labels encodes patchy's state machine: the security-* GitHub issue labels that carry every finding's state, and the legal transitions between states. GitHub issues are the pipeline's only state store, so this package is the single source of truth for label names, value formats, and the transition table — every component parses and renders labels through it.
GitHub caps label names at 50 characters, so labels carry only values that fit (the session label is truncated to a prefix); the full metadata always lives in the report comment's YAML frontmatter, which is the source of truth for anything a label abbreviates.
Index ¶
Constants ¶
const ( KeySource = "security-source" KeyAdvisory = "security-advisory" KeyAlert = "security-alert" KeyFinding = "security-finding" KeyAccumulation = "security-accumulation" KeySeverity = "security-severity" KeyPriority = "security-priority" KeyRecommendation = "security-recommendation" KeyConfidence = "security-recommendation-confidence" KeyTokenBudget = "security-token-budget" KeyMaxTurns = "security-max-turns" KeyAttempts = "security-attempts" KeyClassifier = "security-classifier" KeyRemediator = "security-remediator" )
Label keys. Every patchy label is "<key>: <value>"; multi-valued keys (advisory, alert) emit one label per value.
const MaxLen = 50
MaxLen is GitHub's label-name length cap; Render never emits a longer name.
Variables ¶
This section is empty.
Functions ¶
func CanTransition ¶
CanTransition reports whether moving the security-finding state from `from` to `to` is legal. The empty state means the label is absent (a new issue). Self-transitions are always legal no-ops.
func Diff ¶
Diff returns the label names to add to and remove from an issue to move it from prev to next. Labels outside the security- namespace are never touched.
Types ¶
type Accumulation ¶
type Accumulation string
Accumulation is the security-accumulation value gating the 1-hour window.
const ( AccumulationOpen Accumulation = "open" AccumulationComplete Accumulation = "complete" )
AccumulationOpen collects further alerts into the issue; AccumulationComplete releases it to the remediation controller.
type Recommendation ¶
type Recommendation string
Recommendation is the classifier's verdict. The agent frontmatter value "intervention" is canonicalised to RecommendationManual.
const ( RecommendationRemediate Recommendation = "remediate" RecommendationIgnore Recommendation = "ignore" RecommendationManual Recommendation = "manual" )
The classifier verdicts.
type Set ¶
type Set struct {
Source string
Advisories []string
Alerts []int
Finding State
Accumulation Accumulation
Severity Level
Priority Level
Recommendation Recommendation
Confidence *float64
TokenBudget int
MaxTurns int
Attempts int
Classifier string
Remediator string
Classification *Usage
Remediation *Usage
}
Set is the typed view of one issue's patchy labels. Zero fields render no label; pointer fields distinguish absent from zero.
type State ¶
type State string
State is the security-finding lifecycle value.
const ( StateOpened State = "opened" StateContextEnhanced State = "context-enhanced" StateClassifying State = "classifying" StateClassified State = "classified" StateInReview State = "in-review" StateRemediated State = "remediated" StateAttempted State = "attempted" )
The security-finding states, in pipeline order. Remediated and Attempted are terminal; Attempted marks a finding handed back to humans after remediation failed or was exhausted.