Expand description
validate — the validation engine.
The canonical issue-code vocabulary is SPEC.md § Validation (that table
is the single source of truth). This module implements exactly those codes
— no more, no fewer. If a code is added here it must be added to the SPEC
table in the same change. The codes are exposed as the codes constants
so call sites never spell a code as a bare string literal.
Two scopes. validate_working_set is the loop default: content files
changed since since, plus any file whose wiki-links target a changed path.
The changed set and the per-file checks are O(changed); the incoming linkers
are found by a single embedded-ripgrep pass over the store for the whole
changed set at once (Store::find_links_to_any, one scan — not a full read
per changed object, and not the parse-the-tree walk --all does). It never
calls Store::walk and never builds the global cross-file state.
validate_all is the full SWEEP: it adds the checks that need that global
state — entity-dedup DUP_*, every-index sync, and log.md ordering.
§Why this module is self-contained
Validation does its own frontmatter split, YAML parse, wiki-link scan,
log-header parse, and file walk here, reading only the two public,
caller-populated fields of a Store: Store::root and
Store::config — rather than routing through the sibling modules
(crate::parser, crate::store, crate::log, crate::index).
Keeping the checks local lets the validator report precise, per-issue
diagnostics (exact codes, file, and context) without coupling its output to
incidental behavior of the shared readers; the public surface and the
emitted issue vocabulary are the contract.
Modules§
- codes
- The canonical validation issue codes — one constant per row of the SPEC.md § Validation table. Call sites reference these instead of bare strings so the code and the SPEC table can never silently drift.
Structs§
- Derived
From Ignored - The result of the
derived_from_ignored_typepolicy check: thederived_fromtarget that resolves to an ignored-type record, plus that record’s type. Carries exactly what both the validate finding and the write-time warning need to render their message. - Issue
- A single structured validation finding. Agent-primary and machine-parseable
via
--json;suggestionis a deterministic remediation hint the agent applies without guessing.
Enums§
- Severity
- Severity of a validation
Issue. AnySeverity::Errorfails validation (non-zero exit); warnings and info do not.
Functions§
- derived_
from_ ignored_ type - The single authoritative
### Ignored typesderivation check. Decides whether awiki-pagederives from an ignored-type record: the type must bewiki-page,### Ignored typesmust be non-empty, and somederived_fromtarget must resolve to a record whosetypeis inignored_types. Returns the first such target (and its type), orNone. - validate_
all - Full SWEEP (O(store)). Validate every file, every link, and every index,
adding the cross-file checks that need global state: entity-dedup
DUP_*, every-index sync (md + jsonl), andlog.mdordering. CI / recovery, not the loop. - validate_
working_ set - Loop default. Validate the working set: content files changed since
since(default: the lastvalidateentry inlog.md), plus any file whose wiki-links target a changed/renamed/removed path. Per-file checks only — never aStore::walk/ [Store::walk_content_files]-style parse-the-tree, and none of the cross-file global passes (entity-dedup, every-index sync,log.mdordering) that--alladds.