Documentation
¶
Overview ¶
Package check validates the store-wide metadata and ID invariants.
Index ¶
- Constants
- Variables
- func UnsupportedVersion(records []record.Record) (json.RawMessage, bool)
- func UnsupportedVersionMessage(declared json.RawMessage) string
- type Entry
- type Options
- type Result
- func Check(path string) Result
- func CheckParsed(parsed record.Result) Result
- func CheckParsedVersion(parsed record.Result, version int) Result
- func CheckParsedWith(parsed record.Result, options Options) Result
- func CheckStore(livePath, archivePath string) Result
- func CheckText(input []byte) Result
- func CheckTextWith(input []byte, options Options) Result
- func CheckWith(path string, options Options) Result
Constants ¶
const Version = 2
Variables ¶
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 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 ¶
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 ¶
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 ¶
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 ¶
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
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 ¶
CheckStore validates both stores and rejects an ID visible in each file.
func CheckText ¶
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
CheckTextWith is CheckText against a caller-supplied vocabulary.