Documentation
¶
Index ¶
- func EmptyItem() contract.DiagnosticItem
- func ItemFromError(err error) (contract.DiagnosticItem, bool)
- func NewItem(spec ItemSpec, options ...ItemOption) contract.DiagnosticItem
- func Redact(text string) string
- func RedactAndBound(text string, maxBytes int) string
- func RedactEvidence(evidence map[string]any) map[string]any
- func RedactExact(text string) string
- func RedactExactBinary(text string) string
- func RedactExactBinaryJSON(raw json.RawMessage) (json.RawMessage, error)
- func RedactExactBytes(value []byte) []byte
- func RedactExactJSON(raw json.RawMessage) (json.RawMessage, error)
- func RedactItem(item contract.DiagnosticItem) contract.DiagnosticItem
- func RedactJSON(raw []byte) ([]byte, error)
- func RedactValue(value any) any
- func RegisterDynamicSecret(value string) func()
- func RegisterRequiredSecret(value string) func()
- type ItemOption
- type ItemSpec
- type StructuredError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmptyItem ¶
func EmptyItem() contract.DiagnosticItem
EmptyItem returns the zero DiagnosticItem from the diagnostics package so production callers do not construct DiagnosticItem literals directly.
func ItemFromError ¶
func ItemFromError(err error) (contract.DiagnosticItem, bool)
ItemFromError extracts a redacted DiagnosticItem from any diagnostic-bearing error.
func NewItem ¶
func NewItem( spec ItemSpec, options ...ItemOption, ) contract.DiagnosticItem
NewItem builds the canonical redacted DiagnosticItem.
func Redact ¶
Redact removes common credential shapes from diagnostic text before the text is persisted or exposed to operators.
func RedactAndBound ¶
RedactAndBound redacts diagnostic text and caps it to a deterministic byte budget. Callers should use this before storing crash evidence.
func RedactEvidence ¶
RedactEvidence recursively redacts evidence values without mutating the input map.
func RedactExact ¶
RedactExact removes canonical and registered secrets without additive heuristics.
func RedactExactBinary ¶
RedactExactBinary removes literal and reversibly encoded registered secrets from text.
func RedactExactBinaryJSON ¶
func RedactExactBinaryJSON(raw json.RawMessage) (json.RawMessage, error)
RedactExactBinaryJSON removes literal and reversibly encoded registered secrets from structured JSON.
func RedactExactBytes ¶
RedactExactBytes removes registered secrets from opaque bytes before they are encoded.
func RedactExactJSON ¶
func RedactExactJSON(raw json.RawMessage) (json.RawMessage, error)
RedactExactJSON removes canonical and registered secrets from structured JSON.
func RedactItem ¶
func RedactItem(item contract.DiagnosticItem) contract.DiagnosticItem
RedactItem reapplies the diagnostics redaction boundary to an existing item.
func RedactJSON ¶
RedactJSON recursively redacts secret-shaped values inside a JSON document.
func RedactValue ¶
RedactValue recursively redacts diagnostic evidence values.
func RegisterDynamicSecret ¶
func RegisterDynamicSecret(value string) func()
RegisterDynamicSecret registers one runtime-resolved secret for diagnostic redaction.
func RegisterRequiredSecret ¶
func RegisterRequiredSecret(value string) func()
RegisterRequiredSecret registers one caller-classified secret without a length heuristic.
Types ¶
type ItemOption ¶
type ItemOption func(*itemOptions)
ItemOption customizes a DiagnosticItem built by NewItem.
func WithDocURL ¶
func WithDocURL(url string) ItemOption
WithDocURL records the documentation URL for a diagnostic.
func WithEvidence ¶
func WithEvidence(evidence map[string]any) ItemOption
WithEvidence attaches structured diagnostic evidence after recursive redaction.
func WithSuggestedCommand ¶
func WithSuggestedCommand(command string) ItemOption
WithSuggestedCommand records the exact recovery command for an operator or agent.
type ItemSpec ¶
type ItemSpec struct {
ID string
Code string
Category string
Title string
Message string
Severity string
DataFreshness string
}
ItemSpec names the required fields for one canonical diagnostic item.
type StructuredError ¶
type StructuredError struct {
Item contract.DiagnosticItem
Cause error
}
StructuredError carries a DiagnosticItem while preserving the underlying cause.
func NewStructuredError ¶
func NewStructuredError(item contract.DiagnosticItem, cause error) *StructuredError
NewStructuredError creates a diagnostic-bearing error.
func (*StructuredError) DiagnosticItem ¶
func (e *StructuredError) DiagnosticItem() contract.DiagnosticItem
DiagnosticItem returns the carried diagnostic for common error renderers.
func (*StructuredError) Error ¶
func (e *StructuredError) Error() string
func (*StructuredError) Unwrap ¶
func (e *StructuredError) Unwrap() error