Expand description
Unknown names (spec/surface §1.5, 4.6; port of the reference’s
oqx-js/names.ts). A query that projects, filters or orders by a name no
row of the scope’s kind can carry — select path, target from links
(links have dst_path), where preview != "" on blocks — used to run
silently: an absent column in every row, a predicate true or false of
every row. This pass judges every name the query reads (oqx’s
references, AST.md §5b) against the VOCABULARY of the row kind it is read
from, statically — before any row is read, so the verdict never depends on
the query’s own filter — and either records a hint or refuses the query.
The three tiers of a name at a scope whose kind is known:
- an engine attribute, handle or relation of the kind — known;
- an authored property at least one live object of the kind in this
repository carries (docs: a frontmatter or inline key —
stageon three processes is enough; blocks and nodes: a key of a live row’sattrs, the bare-name read of those kinds) — known, however partial; - a name no object of the kind carries — the complaint.
Severity: links has a closed row shape (no authored data reaches a link
row), so a tier-3 name there is filter_invalid; docs, blocks and nodes are
open — on a read the result carries one hint per offending name and the
rows still come back; a write selector (the AST entry,
UnknownNames::Refuse) is refused, since a name no row carries would
select every row. A repository with no live object of the kind has no
vocabulary: the check is skipped for that kind. The vocabulary is read once
per (repository, kind) and cached on the repository’s head commit
(MAX(commits.seq)), the one thing every property or attrs change moves —
the cache (VocabularyCache) lives beside the store it describes (the
Surface holds one; a bare query call judges with a cache of its own).
Structs§
- Vocabulary
- The authored vocabulary of one kind in one repository.
- Vocabulary
Cache - The vocabulary cache of one store: per repository, keyed on the head commit. Keep it beside the store it was read from.
Enums§
- Unknown
Names - What to do with a tier-3 name on an open kind: record it in
hints(every read) or refuse the query (a write selector).
Functions§
- check_
names - Judge every name the query reads. Returns the hints (one per offending name
of an open kind, first-reference order, deduplicated) under
UnknownNames::Hint; fails withfilter_invalidfor a tier-3 name on a closed kind in either mode, and for one on an open kind underUnknownNames::Refuse. - edit_
distance - Optimal string alignment distance (Damerau–Levenshtein with adjacent transpositions, each edit 1), over code points.
- handles
- The self and reach-through handles of a kind and the kind of the row each reaches (§1.2).
- kind_
of_ scope - The kind of the rows a scope holds, from its row chain (AST.md §5b);
Nonewhen the chain reaches a value no kind describes. - nearest
- The nearest match of
nameamongcandidates(§1.5): case-insensitive; a candidate qualifies when its distance is ≤ 2, or when one of the two is a substring of the other and the shorter has at least three characters. One typo (distance 1) wins first; then a substring match outranks a distance-2 match (via→via_id, notid;dst_pth→dst_path, notdst); within a class the lowest distance, then the shorter candidate, then alphabetical. A name under three characters gets no suggestion (it is within distance 2 of nearly anything, and too short for the substring rule).Nonewhen nothing qualifies. - relations
- The relations of a kind, in the §1.2 order, and the kind of the rows each yields.
- vocabulary
- The vocabulary of a kind in a repository:
(present, keys)— the authored keys inkeyorder (the SQL runs only when a name is not intrinsic).