observations

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 19 Imported by: 0

Documentation

Overview

Package observations keeps bounded, local-only self-observation proposals.

Index

Constants

View Source
const CodeProhibitedContent = "observation-prohibited-content"

CodeProhibitedContent identifies a SOL-V0-002 writer-contract refusal.

View Source
const KindAdapterDegradation = "adapter-degradation"

KindAdapterDegradation is SOL-V0-010's row kind: one host adapter degradation per host, event, code set and hour window.

Variables

This section is empty.

Functions

func Append

func Append(root string, event Event) error

Append is deliberately fail-open. It only writes a bounded JSONL ledger below the repository worktree and never creates an index, trace, or agent-memory file.

func CorvintEntriesIgnored

func CorvintEntriesIgnored(root string, names ...string) bool

CorvintEntriesIgnored reports whether one ignore file, the root .gitignore or .corvint/.gitignore, ignores every named .corvint entry by its exact rule or by ignoring all of .corvint, and holds no negation. The unplanned-read ledger shares this conservative check (URE-V0-003).

func Render

func Render(root string, limit int, output io.Writer) error

func TaskHash

func TaskHash(task string) string

Types

type Digest

type Digest struct {
	Events       int
	Degradations map[string]int
	Misses       map[string]int
	Unsupported  map[string]int
	ZeroResults  int
	BudgetOmit   int
	Latencies    []int64
	// Proofs counts `proof` rows; Verdicts sums their counts by falsifier
	// then verdict.
	Proofs   int
	Verdicts map[string]map[string]int
	// Adapter counts retained `adapter-degradation` rows by host/event/code, and
	// AdapterLatest keeps each key's newest hour window (SOL-V0-010).
	Adapter       map[string]int
	AdapterLatest map[string]string
	// SkippedRows counts ledger rows over maxRowBytes: self-observation-ledger-v0.md
	// SOL-V0-005 (failure modes, "malformed ledger row") requires triage to skip
	// an oversized row and keep reading bounded rows rather than abort.
	SkippedRows int
	// Rejected counts, by closed reason, the bounded rows the writer contract
	// refuses (SOL-V0-005). None of them contributes to any other field.
	Rejected map[string]int
	// Truncated reports that the ledger exceeded maxFileBytes and only its
	// first maxFileBytes were read.
	Truncated bool
}

func Read

func Read(root string) (Digest, error)

func (Digest) Falsification

func (digest Digest) Falsification() Falsification

Falsification reports the rate over every falsifier; the digest is meaningful only when Proofs is positive.

type Error

type Error struct {
	Code  string
	Field string
}

Error is a writer-contract refusal. Error deliberately returns only a stable code: the rejected value may itself be task, source, or command text and must not be echoed into another diagnostic surface.

func (*Error) Error

func (err *Error) Error() string

type Event

type Event struct {
	Kind             string   `json:"kind"`
	Event            string   `json:"event,omitempty"`
	ReceiptID        string   `json:"receiptId,omitempty"`
	SessionID        string   `json:"sessionIdSha256,omitempty"`
	TaskSHA256       string   `json:"taskSha256,omitempty"`
	Support          string   `json:"support,omitempty"`
	Freshness        string   `json:"freshness,omitempty"`
	Degradations     []string `json:"degradations,omitempty"`
	UncertaintyCount int      `json:"uncertaintyCount,omitempty"`
	OmittedCount     int      `json:"omittedCount,omitempty"`
	CriticalMissing  int      `json:"criticalMissingCount,omitempty"`
	Authoritative    int      `json:"authoritativeResultCount,omitempty"`
	LatencyMS        int64    `json:"latencyMs,omitempty"`
	TouchedPaths     []string `json:"touchedPaths,omitempty"`
	RankedPaths      []string `json:"rankedPaths,omitempty"`
	MissState        string   `json:"missState,omitempty"`
	Code             string   `json:"code,omitempty"`
	QueryIntent      string   `json:"queryIntent,omitempty"`
	Step             string   `json:"step,omitempty"`
	Status           string   `json:"status,omitempty"`
	Reason           string   `json:"reason,omitempty"`
	// Counts is a `proof` row: the verdict counts of one `prove` document,
	// keyed by falsifier then verdict, and nothing else about the document.
	Counts map[string]map[string]int `json:"counts,omitempty"`
	// Host, AdapterCodes, Window and CorvintVersion belong to an `adapter-degradation`
	// row (SOL-V0-010) only.
	Host           string   `json:"host,omitempty"`
	AdapterCodes   []string `json:"adapterCodes,omitempty"`
	Window         string   `json:"window,omitempty"`
	CorvintVersion string   `json:"corvintVersion,omitempty"`
}

func AdapterDegradationEvent

func AdapterDegradationEvent(host, event, reason, corvintVersion string, now time.Time) Event

AdapterDegradationEvent is the SOL-V0-010 row for one adapter degradation reason. A `corvint-event-rejected:<code>` reason whose code no closed registry names keeps only its `corvint-event-rejected` prefix; any other unadmitted reason is refused by Append.

type Falsification

type Falsification struct {
	Proofs int    `json:"proofs"`
	Judged int    `json:"judged"`
	Failed int    `json:"failed"`
	Rate   string `json:"rate"`
}

Falsification is the share of judged rows (PASS or FAIL; NOT_RUN and `none` rows are not judgments) whose claim was falsified, over every `proof` row the ledger retains.

Jump to

Keyboard shortcuts

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