Documentation
¶
Index ¶
- Constants
- func AlreadyReported(err error) bool
- func AvailabilityText(state protocol.DiagnosticState) string
- func BoundText(text string) string
- func Classification(err error) (protocol.APIError, bool)
- func Describe(ctx context.Context, record Record) protocol.Diagnostic
- func EscapeTerminal(value string) string
- func FailureLevel(ctx context.Context, err error) (slog.Level, bool)
- func GitHubHTTPError(api protocol.APIError, response *http.Response, detail *HTTPError) error
- func GitHubRateLimited(status int, header http.Header, body string) bool
- func HTTPBody(raw []byte) string
- func HTTPOperation(method, path string) string
- func MarkReported(err error) error
- func NormalCancellation(ctx context.Context, err error) bool
- func ReportError(ctx context.Context, reporter Reporter, record Record) error
- func ReturnWarnings(ctx context.Context, warnings protocol.WarningOutcome)
- func Snapshot(err error) (protocol.Diagnostic, bool)
- func TerminalText(label string, snapshot protocol.Diagnostic) string
- func WithOperation(ctx context.Context, operation OperationMetadata) context.Context
- func WithSnapshot(err error, snapshot protocol.Diagnostic) error
- func Wrap(api protocol.APIError, cause error) error
- type CapturedText
- type HTTPError
- type History
- type HistoryOptions
- type OperationMetadata
- type Owner
- type Record
- type Reporter
- type Result
Constants ¶
const ( MaxDepth = 32 MaxNodes = 64 MaxBytes = 256 << 10 )
Capture limits apply before protocol encoding and terminal rendering.
const GitHubRateLimitSummary = "GitHub rate limit exceeded. Please try again later."
GitHubRateLimitSummary is the controlled explanation for a confirmed GitHub limit.
const MaxHTTPBodyBytes = 256 << 10
MaxHTTPBodyBytes bounds retained upstream failure bodies, before JSON encoding.
Variables ¶
This section is empty.
Functions ¶
func AlreadyReported ¶
AlreadyReported reports whether err carries a diagnostic ownership marker.
func AvailabilityText ¶ added in v0.9.5
func AvailabilityText(state protocol.DiagnosticState) string
AvailabilityText describes missing remote content without inventing a cause.
func BoundText ¶ added in v0.9.5
BoundText bounds an individual original text value using the capture budget.
func Classification ¶ added in v0.9.5
Classification finds the outer API classification with bounded graph traversal.
func Describe ¶ added in v0.9.5
func Describe(ctx context.Context, record Record) protocol.Diagnostic
Describe captures one occurrence without publishing it or consulting a logger.
func EscapeTerminal ¶ added in v0.9.5
EscapeTerminal renders control characters as text while preserving line breaks and tabs. It never changes the captured snapshot used for JSON or copying.
func FailureLevel ¶
FailureLevel classifies an operation failure for diagnostic logging.
func GitHubHTTPError ¶
GitHubHTTPError maps failures only at known GitHub resource boundaries. It preserves the established API classification and original HTTP diagnostic.
func GitHubRateLimited ¶
GitHubRateLimited recognizes limits only for callers fetching fixed GitHub resources. Retry timing headers are deliberately ignored; this function does not schedule retries.
func HTTPBody ¶ added in v0.9.4
HTTPBody bounds retained error payloads without retaining response objects.
func HTTPOperation ¶ added in v0.9.4
HTTPOperation removes user-controlled path segments and query parameters.
func MarkReported ¶
MarkReported marks err as already reported by its diagnostic owner.
func NormalCancellation ¶ added in v0.9.4
NormalCancellation reports whether active cancellation ended an operation. An elapsed request deadline remains an inspectable failure. It lets non-log failure callbacks retain their shutdown semantics.
func ReportError ¶ added in v0.9.5
ReportError synchronously obtains the occurrence published by an injected owner. A missing reporter still preserves details for CLI errors before logger setup.
func ReturnWarnings ¶ added in v0.9.5
func ReturnWarnings(ctx context.Context, warnings protocol.WarningOutcome)
ReturnWarnings returns already published occurrences to the invoking adapter. Replaying an operation returns its original warnings without publishing again.
func Snapshot ¶ added in v0.9.5
func Snapshot(err error) (protocol.Diagnostic, bool)
Snapshot returns an occurrence attached to this failure, not a joined child.
func TerminalText ¶ added in v0.9.5
func TerminalText(label string, snapshot protocol.Diagnostic) string
TerminalText renders the shared summary and original-detail sections.
func WithOperation ¶ added in v0.9.5
func WithOperation(ctx context.Context, operation OperationMetadata) context.Context
WithOperation attaches copied operation metadata to a non-nil context.
func WithSnapshot ¶ added in v0.9.5
func WithSnapshot(err error, snapshot protocol.Diagnostic) error
WithSnapshot retains cause traversal while attaching an immutable occurrence.
Types ¶
type CapturedText ¶ added in v0.9.5
CapturedText holds original text and explicit collection limits.
func Capture ¶ added in v0.9.5
func Capture(err error) CapturedText
Capture formats an error graph without redaction or additional stack capture.
type HTTPError ¶ added in v0.9.4
type HTTPError struct {
Operation string
URL string
Phase string
Status int
Body string
// BodyTruncated records an upstream collection limit independently of text.
BodyTruncated bool
Cause error
RetryDelay time.Duration
}
HTTPError retains original upstream diagnostics for shared bounded capture. Error provides the basic assertion; DiagnosticText supplies the collected cause.
func HandshakeError ¶ added in v0.9.4
HandshakeError captures the failed websocket dial response. The websocket adapter returns a closed-network-body copy capped at 1024 bytes; mark that upstream library limit rather than claiming a complete error payload.
func (*HTTPError) DiagnosticText ¶ added in v0.9.4
DiagnosticText returns original HTTP details for diagnostic capture.
func (*HTTPError) RetryAfter ¶ added in v0.9.4
RetryAfter exposes a parsed upstream retry delay to the provider read policy.
type History ¶ added in v0.9.5
type History struct {
// contains filtered or unexported fields
}
History retains immutable occurrence snapshots for one process lifetime.
func NewHistory ¶ added in v0.9.5
func NewHistory(options HistoryOptions) (*History, error)
NewHistory constructs an independent process history without touching disk.
func (*History) Add ¶ added in v0.9.5
func (h *History) Add(record protocol.Diagnostic) protocol.Diagnostic
Add assigns a new occurrence identity even when another record has the same text.
type HistoryOptions ¶ added in v0.9.5
HistoryOptions bounds process-owned diagnostic history. Zero limits use daemon defaults.
type OperationMetadata ¶ added in v0.9.5
OperationMetadata identifies a logical operation across diagnostic outlets.
func OperationFromContext ¶ added in v0.9.5
func OperationFromContext(ctx context.Context) (OperationMetadata, bool)
OperationFromContext retrieves an explicitly bound operation identity.
type Owner ¶ added in v0.9.5
type Owner struct {
// contains filtered or unexported fields
}
Owner publishes occurrences to process history and an optional file outlet. It owns neither a goroutine nor the lifetime of the borrowed file outlet.
type Record ¶
type Record struct {
Component string
Event string
Level slog.Level
Err error
Summary string
Object string
// Snapshot is populated by an owner before forwarding to a file outlet.
Snapshot *protocol.Diagnostic
// contains filtered or unexported fields
}
Record describes one internal diagnostic event. It must not be serialized.
type Result ¶ added in v0.9.5
type Result struct {
// contains filtered or unexported fields
}
Result is a call-scoped diagnostic result, separate from persisted business data. A control adapter supplies it to receive warnings from use cases that return either a value or only an error. It never owns or stores a context.
func WithResult ¶ added in v0.9.5
WithResult creates a result receiver for this call and its child operations.
func (*Result) Warnings ¶ added in v0.9.5
func (r *Result) Warnings() protocol.WarningOutcome
Warnings returns a copy of the diagnostic result without transferring ownership.