Documentation
¶
Overview ¶
Package diagnostic defines application-neutral, source-mapped diagnostics for workflow authors and transports.
Diagnostic codes have the stable form HADR-<PREFIX>-<NNN>. The reserved prefixes and their domains are:
SOURCE source syntax and structural validation REF source reference and dependency validation LEGACY archived source migration OUTPUT archived output-shim migration VALUE expression, binding, and value evaluation ARTIFACT artifact storage, authorization, verification, and retention POLICY capability and policy enforcement EFFECT effect, retry, and idempotency safety WAIT wait and external-event handling PERSIST persistence and recovery HOST host integration and capability negotiation
REF, LEGACY, and OUTPUT are source-validation subdomains retained for the migration codes established by the workflow architecture.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeJSON ¶
func EncodeJSON(d Diagnostic) ([]byte, error)
EncodeJSON validates and encodes one diagnostic for a transport boundary.
Types ¶
type Code ¶
type Code string
Code is a stable, searchable diagnostic identifier.
const ( // CodeUnresolvedReference identifies a value reference that is not visible // through the graph's declared dependencies. CodeUnresolvedReference Code = "HADR-REF-001" // CodeUnsafeEffectRetry identifies an effect/retry combination without an // idempotency proof. CodeUnsafeEffectRetry Code = "HADR-EFFECT-001" // CodeArchivedOutputShim identifies legacy output capture from log text. CodeArchivedOutputShim Code = "HADR-OUTPUT-002" )
func NewCode ¶
NewCode constructs a code using a reserved prefix and a three-digit number. Numbers start at one; zero is not assigned.
type Diagnostic ¶
type Diagnostic struct {
Severity Severity `json:"severity"`
Code Code `json:"code"`
Message string `json:"message"`
Source *graph.SourceRef `json:"source,omitempty"`
Related []RelatedReference `json:"related,omitempty"`
Remediation *Remediation `json:"remediation,omitempty"`
}
Diagnostic is the stable transport representation of a workflow finding. Source and Related reuse graph.SourceRef so graph and diagnostics share one source-location contract.
func ArchivedOutputShim ¶
func ArchivedOutputShim(source graph.SourceRef, stageName string) Diagnostic
ArchivedOutputShim reports legacy output extraction from an archived stage's log stream.
func DecodeJSON ¶
func DecodeJSON(data []byte) (Diagnostic, error)
DecodeJSON decodes and validates one diagnostic from a transport boundary. Unknown fields and trailing JSON values are rejected to keep the contract explicit and malformed transport payloads detectable.
func UnresolvedReference ¶
func UnresolvedReference(source graph.SourceRef, nodeID, reference, dependency string) Diagnostic
UnresolvedReference reports a missing or dependency-invisible node output.
func UnsafeEffectRetry ¶
func UnsafeEffectRetry(source graph.SourceRef, nodeID string) Diagnostic
UnsafeEffectRetry reports a retry policy that lacks an idempotency proof for an effectful node.
func (Diagnostic) Validate ¶
func (d Diagnostic) Validate() error
Validate checks the invariants required to safely present or transport d. It intentionally does not attempt compiler, policy, or runtime validation.
type Domain ¶
type Domain string
Domain groups diagnostic prefixes by the workflow contract they describe.
type Prefix ¶
type Prefix string
Prefix is the reserved middle segment of a diagnostic code.
const ( PrefixSource Prefix = "SOURCE" PrefixReference Prefix = "REF" PrefixLegacy Prefix = "LEGACY" PrefixOutput Prefix = "OUTPUT" PrefixValue Prefix = "VALUE" PrefixArtifact Prefix = "ARTIFACT" PrefixPolicy Prefix = "POLICY" PrefixEffect Prefix = "EFFECT" PrefixWait Prefix = "WAIT" PrefixPersistence Prefix = "PERSIST" PrefixHost Prefix = "HOST" )
type RelatedReference ¶
type RelatedReference struct {
Message string `json:"message,omitempty"`
Source graph.SourceRef `json:"source"`
}
RelatedReference points to source material that helps explain a diagnostic.
type Remediation ¶
type Remediation struct {
Message string `json:"message"`
SuggestedSyntax string `json:"suggested_syntax,omitempty"`
Documentation string `json:"documentation,omitempty"`
}
Remediation describes an author action and, when useful, target syntax.
type Severity ¶
type Severity string
Severity describes how a diagnostic affects the requested operation.
const ( // SeverityInfo reports actionable context that does not affect validity. SeverityInfo Severity = "info" // SeverityWarning reports accepted input that should be changed. SeverityWarning Severity = "warning" // SeverityError reports input or state that prevents the operation. SeverityError Severity = "error" )
type ValidationError ¶
ValidationError identifies one malformed diagnostic transport field.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string