Documentation
¶
Overview ¶
Package risk computes a deterministic, tier-floored risk profile and a thin threat-model summary for an initiative's changes (§31). It contains no LLM logic: the tier floor, the marker scan, and the summary are all deterministic functions of the diff text so the same inputs always produce the same outputs.
Index ¶
Constants ¶
const ( SignalAuth = "auth" SignalSecret = "secret" SignalNetwork = "network" SignalCredential = "credential" SignalPayment = "payment" SignalPII = "pii" )
Signal names produced by the deterministic marker scan. These names are the canonical categories consumed by ComputeRiskProfile's tier floor.
Variables ¶
This section is empty.
Functions ¶
func ComputeRiskProfile ¶
func ComputeRiskProfile(initiativeID string, signals []domain.RiskSignal) domain.RiskProfile
ComputeRiskProfile builds a RiskProfile whose tier is the deterministic floor implied by the detected signals: any detected auth, secret, network, or credential signal floors the profile at high; any detected payment or pii signal floors it at medium; otherwise the floor is low. The returned tier is a minimum, never a ceiling: callers may raise it (see Raise) but the floor computed here can never be lowered by downstream logic.
func Raise ¶
Raise returns the higher of two tiers. It is the caller-facing escalation hook: a profile's deterministic floor can be raised (e.g. to domain.RiskCritical) but never lowered, so callers apply it as
p.Tier = risk.Raise(p.Tier, domain.RiskCritical)
func RiskSignals ¶
func RiskSignals(ctx context.Context, patchDigest, diffText string) []domain.RiskSignal
RiskSignals deterministically scans a diff/patch string for known risk markers and returns one domain.RiskSignal per detected category, each with Detected=true. Signals are emitted in markerCatalog order and are deduplicated by category; Detail records every marker that contributed to a category.
ctx and patchDigest are reserved for future policy hooks (e.g. per-initiative sensitivity or provenance linking); the scan itself keys only on diffText.
func ThreatModelSummary ¶
func ThreatModelSummary(signals []domain.RiskSignal) string
ThreatModelSummary returns a deterministic one-paragraph threat-model summary naming the detected risk categories and a generic mitigation. It performs no LLM call and no ranking beyond the signal categories themselves.
Types ¶
This section is empty.