validate

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package validate checks tickets at rest.

The gates in core/gate fire when a ticket moves, which means a ticket damaged by a hand edit, a bad merge, or an agent writing something unexpected sits there looking fine until someone tries to use it — and then fails with an error about the move rather than about the damage. This package answers the separate question "is what is on disk actually coherent?".

Index

Constants

View Source
const (
	SeverityError   = "error"
	SeverityWarning = "warning"
)

Severities. A ticket can be incomplete without being broken: capture is meant to be cheap, so an unspecified backlog ticket is normal and must not fail a validation run.

View Source
const (
	CodeBadID         = "bad_id"
	CodeNoTitle       = "no_title"
	CodeUnknownLane   = "unknown_lane"
	CodeBadTimestamp  = "bad_timestamp"
	CodeDanglingDep   = "dangling_dependency"
	CodeSelfDep       = "self_dependency"
	CodeDuplicateID   = "duplicate_id"
	CodeIncomplete    = "incomplete"
	CodeUndeclaredDep = "undeclared_dependency"
	CodeBadTag        = "bad_tag"
	CodeBadMode       = "bad_mode"
	// CodeDanglingParent, CodeSelfParent and CodeParentCycle guard the parent
	// chain. It is followed recursively wherever children are rendered, so a
	// ring in it is a hung view rather than a wrong one — which is why a
	// cycle is an error and not a warning.
	CodeDanglingParent = "dangling_parent"
	CodeSelfParent     = "self_parent"
	CodeParentCycle    = "parent_cycle"
)

Problem codes, stable so an agent can branch on them.

Variables

This section is empty.

Functions

func HasErrors

func HasErrors(ps []Problem) bool

HasErrors reports whether any problem is severe enough to fail a run.

Types

type Problem

type Problem struct {
	Code     string
	Severity string
	Handle   string
	ID       string
	Path     string
	Field    string
	Message  string
}

Problem is one finding about one ticket.

func Tickets

func Tickets(ts []*ticket.Ticket, lanes *lane.Set, known func(id string) bool) []Problem

Tickets validates a whole board. Cross-ticket checks — duplicate ids and unresolvable dependencies — need the full set, which is why this takes a slice rather than validating one ticket at a time. Tickets checks every ticket it is given.

known answers whether an id exists anywhere this repository can see it — on the board, on a ref, or filed away in the logbook or the archive. It is injected because finding that out means reading directories and this package is pure. nil means only the given tickets are known, which is the right answer for a caller that has no store and the reason a filed-away blocker used to be reported as unreachable.

Jump to

Keyboard shortcuts

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