check

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package check validates the store-wide metadata and ID invariants.

Index

Constants

View Source
const Version = 2

Variables

View Source
var (
	ProposedStates = []string{"PROPOSED"}
	OpenStates     = []string{"INBOX", "TODO", "NEXT", "WAITING"}
	ClosedStates   = []string{"DONE", "CANCELLED"}
	States         = append(append(append([]string{}, ProposedStates...), OpenStates...), ClosedStates...)
	Priorities     = []string{"A", "B", "C"}
	Types          = []string{"meta", "section", "task"}
)

The vocabularies Check enforces, spelled where lib/tasks/check.rb spells them.

Functions

func UnsupportedVersion

func UnsupportedVersion(records []record.Record) (json.RawMessage, bool)

UnsupportedVersion reports the version a store DECLARES when it is one this binary cannot read. The gate is deliberately narrow in two ways Ruby is narrow: it consults the FIRST record rather than the record on line 1, and a non-Integer version is not "unsupported" — it is malformed, and checkMeta reports it as such.

func UnsupportedVersionMessage

func UnsupportedVersionMessage(declared json.RawMessage) string

UnsupportedVersionMessage is the one wording for that condition, shared by `check`, by every refusal, and by the store's read path.

Types

type Entry

type Entry struct {
	Line    int    `json:"line"`
	Message string `json:"message"`
}

Entry is one structural diagnostic, ordered by physical line.

type Options added in v1.11.0

type Options struct {
	// Modes is the delegation mode vocabulary. Nil means the built-in set.
	Modes record.ModeVocabulary
}

Options are the validation decisions a caller owns rather than the schema. Today that is one: the delegation mode vocabulary, carried as a VALUE so a configured set is a field at the call site rather than process-wide state the checker reads behind the caller's back. The zero Options means the built-in vocabulary, which is what every plain entry point uses.

type Result

type Result struct {
	Errors   []Entry `json:"errors"`
	Warnings []Entry `json:"warnings"`
}

Result is the subset of the Ruby check report this package owns so far. Future check slices append task-field and tree diagnostics to the same report at the application boundary.

func Check

func Check(path string) Result

Check reads one JSONL store. A missing store is a structural result, not an I/O error, just as it is in the Ruby oracle.

func CheckParsed

func CheckParsed(parsed record.Result) Result

CheckParsed validates bytes a caller has already parsed. It is the seam the store's API-grade read uses: validation and the canonical resources have to derive from ONE read taken under the store lock, rather than from a path checked and then reopened.

func CheckParsedVersion

func CheckParsedVersion(parsed record.Result, version int) Result

CheckParsedVersion is CheckParsed against a stated schema version rather than this build's. Only one caller needs it: the merge validates a common ancestor against the version that ancestor DECLARES, because a v1 base under two v2 sides is the ordinary shape of a merge reaching back past a schema upgrade, and a faithful v1 file must not fail the lint for being one.

func CheckParsedWith added in v1.11.0

func CheckParsedWith(parsed record.Result, options Options) Result

CheckParsedWith is CheckParsed against a caller-supplied vocabulary. This is the entry point the store uses, so the vocabulary a store was constructed with is the one its post-write validation enforces.

func CheckStore

func CheckStore(livePath, archivePath string) Result

CheckStore validates both stores and rejects an ID visible in each file.

func CheckText

func CheckText(input []byte) Result

CheckText validates a whole file's bytes. Invalid encoding short-circuits everything else: the file cannot be split into records at all, so reporting a missing meta record beside it would describe a file nobody could read.

func CheckTextWith added in v1.11.0

func CheckTextWith(input []byte, options Options) Result

CheckTextWith is CheckText against a caller-supplied vocabulary.

func CheckWith added in v1.11.0

func CheckWith(path string, options Options) Result

CheckWith is Check against a caller-supplied vocabulary.

func (Result) OK

func (r Result) OK() bool

Jump to

Keyboard shortcuts

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