diagnostic

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Overview

Package diagnostic is the refusal envelope of docs/specs/diagnostic-repair-contract-v0.md (DRC-V0): a refused subject, the facts measured while refusing, and the closed set of registry-owned repairs, carried beside an existing {code, message} error.

Index

Constants

View Source
const (
	MaxValueBytes = 512
	MaxEvidence   = 16
	// EmptySubject discloses a refused operand spelled as the empty string, since an emitted
	// subject value is never empty (DRC-V0-001).
	EmptySubject = "[empty]"
)

MaxValueBytes and MaxEvidence are DRC-V0-008's per-value and per-diagnostic bounds.

Variables

View Source
var Kinds = []string{"argument", "value", "artifact", "repository-state", "host-capability", "request"}

Kinds is DRC-V0-001's closed subject vocabulary; docs/specs/FIX-REGISTRY.tsv's kind rows and the clause text must equal it.

View Source
var TerminalReasons = []string{"missing-authority", "absent-evidence", "unsupported-platform", "owner-decision-required"}

TerminalReasons is DRC-V0-005's closed set of reasons no caller-side repair exists.

Functions

func RepairStop

func RepairStop(outstanding []int) bool

RepairStop is DRC-V0-009's stop rule, published for an adapter that drives a repair loop; Corvint itself drives none (decision 0201 (h)). outstanding[0] is the count of outstanding diagnostics before any round and outstanding[i] the count after round i. The loop stops when nothing is outstanding, or when each of the last two rounds failed to reach a new minimum below every earlier count; whatever is still outstanding then is unresolved, not a partial success.

Types

type Error

type Error struct {
	Err     error
	Refusal Refusal
}

Error carries a Refusal beside the error it annotates; errors.As still reaches the wrapped error, so a consumer keyed on its code is unchanged (DRC-V0-006).

func (*Error) Error

func (err *Error) Error() string

func (*Error) Unwrap

func (err *Error) Unwrap() error

type Evidence

type Evidence struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Evidence is one fact measured while producing the refusal (DRC-V0-002).

type Refusal

type Refusal struct {
	Subject        Subject    `json:"subject"`
	Evidence       []Evidence `json:"evidence"`
	SupportedFixes []string   `json:"supported_fixes"`
	Terminal       string     `json:"terminal,omitempty"`
}

Refusal is the additive diagnostic a covered site attaches to its refusal.

func (Refusal) Bounded

func (refusal Refusal) Bounded() Refusal

Bounded is the emitted form of refusal (DRC-V0-008): every subject and evidence string is secret-screened, control characters are escaped visibly, and the result is cut to MaxValueBytes with the cut disclosed; evidence beyond MaxEvidence pairs keeps the first MaxEvidence-1 and discloses the dropped count in a final evidence-truncated pair.

func (Refusal) MarshalJSON

func (refusal Refusal) MarshalJSON() ([]byte, error)

MarshalJSON emits an absent evidence or fix list as an empty array, never null or omitted (DRC-V0-002, DRC-V0-005).

func (Refusal) Validate

func (refusal Refusal) Validate() error

Validate reports the first way refusal breaks DRC-V0-001, 002, 003 or 005.

type Subject

type Subject struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

Subject names the refused thing (DRC-V0-001).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL