touchsurprise

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: 13 Imported by: 0

Documentation

Overview

Package touchsurprise measures, for one completed task, how much of the change the task-context packet never named: the touch-set surprise. It is read-only and compares committed revisions only (AGENTS.md invariant 4).

Index

Constants

View Source
const DefaultLimit = 20

DefaultLimit is the packet and impact result bound when --limit is absent.

View Source
const MaxLimit = 50

MaxLimit is contextindex's own ceiling for both TaskContext and Impact.

Variables

This section is empty.

Functions

func Render

func Render(ctx context.Context, index *contextindex.Index, options Options, stdout io.Writer) error

Render writes one canonical JSON touch-set surprise receipt. It reads the index and Git only; nothing in the repository or the trace state is written.

Types

type Options

type Options struct {
	Root, Task, Subject string
	Base, Target        string
	Limit               int
}

Options is one parsed `surprise` invocation.

type Report

type Report struct {
	Predicted           []string `json:"predicted"`
	Actual              []string `json:"actual"`
	PredictedOnly       []string `json:"predicted_only"`
	ActualOnly          []string `json:"actual_only"`
	Intersection        []string `json:"intersection"`
	SymmetricDifference int      `json:"symmetric_difference"`
	Surprise            float64  `json:"surprise"`
	EmptyActual         bool     `json:"empty_actual"`
}

Report is the set arithmetic of one touch-set surprise (TSS-V0-004). It is pure: the same two path lists always produce the same report, in path order.

func Compute

func Compute(predicted, actual []string) Report

Compute is the pure surprise computation over one predicted and one actual path set. `surprise` is the share of actually touched paths the prediction never named; an empty actual set scores 0 and says so rather than dividing.

Jump to

Keyboard shortcuts

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