Expand description
SRD-85 deep workload suggestions — the shared “did you mean” set over the local file hierarchy and the bundled catalog, used by completion and the resolver not-found paths. Deep workload suggestions — the shared “did you mean” set.
When an exact workload reference misses, three callers want the same
answer: the shell-completion provider (nmbrs::completion) as its
fallback, and the resolver’s not-found paths
(nmbrs_runtime::runner::resolve_workload, crate::verify::verify_target,
nmbrs::copy_cmd) as the suggestion tail on the error. Each asks the
same question — every workload whose final name segment begins with
what the operator typed — over the local file hierarchy and the
bundled catalog.
Leaf-segment matching is the point: it is what makes a bare
phase_poll surface a buried examples/controls/phase_poll_smoke. The
catalog carries the namespace; the operator types the stem. A
slash-qualified partial (examples/controls/phase_poll) still matches
by full-reference prefix, so both habits work.
The local walk descends [MAX_DEPTH] directory levels below the start
directory (the operator’s cwd); the bundled catalog is a flat namespace
with no depth bound. SRD-85 makes the catalog the discovery surface, so
a suggestion drawn from it is always runnable by the name shown.
Constants§
- MAX_
DEPTH - Directory levels the local walk descends below the start directory. A
file at
a/b/c/<name>.yamlis the deepest reached at the default of 3. The bundled catalog is flat and not subject to this bound.
Functions§
- did_
you_ mean - Render a hit list (from
suggest_workloads/suggest_bundled) as a human “did you mean” tail, ready to append to an error message:Did you mean: a, b?for a short list, orDid you mean one of: a, b (+N more — \nmbrs describe workloads –all`)when capped at [MAX_LISTED]. Empty string whenhits` is empty, so callers can append it unconditionally. - suggest_
bundled - Catalog-only matches, for callers that run bundled names exclusively
(
nmbrs copy): suggesting a local file there would name something the command cannot act on. - suggest_
workloads - Every workload reference matching
partialby leaf segment (or by full-reference prefix), drawn from the local file hierarchy below the current directory (down toMAX_DEPTHlevels) and the bundled catalog. Sorted and deduped.