Expand description
Graph queries and their result models.
Structs§
- Ambiguous
Row - One ambiguous-table row: the referencing
file/line, theoriginandrawtext of the reference, and how many candidates it matched. - Ambiguous
Tables - The inbound and outbound ambiguous-reference tables.
- Braked
File - A hub file the walk refused to widen THROUGH, and how many distinct other
files reference it. Kept in its own vec (separate from
BrakedIface) so that type, its tests and its JSON bytes are untouched when the file brake never fires. Sorted widest-first then by path, the same total order, for the same reason. - Braked
Iface - An interface the walk refused to widen through, and how many distinct constructors inject it. Sorted widest-first then by name, a total order that depends on nothing about the walk’s own iteration.
- DefSite
- Represents
DefSite. - Graph
Index - The built query index over a
Graph.by_id/by_file/by_simple_name/by_lower_namestoregraph.defsindices rather than clonedDefs, so a def is never copied into every bucket it is reachable from. - Impact
Model - The resolved
impactresult for one seed. - Impact
Row - One row of an impact model: a file in the blast radius and its metrics.
- Impact
Walk Result - The result of an impact walk.
- Import
Row - One imports-table row:
file/line, the importedtargetnamespace, andsource. An imports edge is never a guess, so unlikeOutboundRowthis carries noheuristicfield. - Inbound
Entry - Represents
InboundEntry. - Inbound
Row - One inbound-table row:
fileandlineof the referencing site, thenheuristic(whether the edge was guessed) andsource(the trimmed referencing line). An emptysourceis omitted from--json. - Inbound
Tables - The three inbound tables, one per kind (inherits/uses-type/uses-member).
- Kind
Lines - One representative referencing line PER EDGE KIND that reached this file,
the lowest line per kind.
0means “this kind never contributed”, which keeps a row a kind never touched free of that key in--json.direct_ambis the ambiguous half of thedirectkind, kept apart only sobuild_impact_modelcan apply the resolved-over-ambiguous tie-break instead of letting an ambiguous line win by being numerically smaller. - Member
RefEntry - One enum member that carries at least one inbound reference.
- Member
Refs - How many of an ENUM’s inbound member edges land on one of its members, split by member.
- Outbound
Entry - Represents
OutboundEntry. - Outbound
Row - One outbound-table row:
file/lineof the referencing site,to_file/toof the target, thenheuristicandsource(same omit-when-empty rule asInboundRow).sourceis read at the site actually making the reference – for an outbound edge that is a line in the def’s own file, not the target’s. - Outbound
Tables - The four outbound tables: three by kind plus imports.
- Read
Model - The resolved
readresult for one symbol: everythingrefsanswers, - Read
Span - The declaration span of a resolved def: the file, its 1-based start and end lines, and the VERBATIM source text of those lines (no trim, no clip
- Refs
Model - The resolved
refsresult for one symbol. - SeqMap
- Insertion-order-preserving
String-keyed map with a mutable get-or-insert-default accessor. Same shape asgraph::OrderedMap, kept as a separate small type here because that one exposes noget_mut/entry-style API. Public for the same reason asSeqSet– appears inImpactWalkResult::visited. - SeqSet
- Insertion-order-preserving set:
insertis a no-op when the value is already present (first insertion wins the position). Public because it appears inImpactWalkResult’s public fields. - Symbol
Refs - The immediate inbound/outbound edges of one resolved symbol, holding
graph.edgesindices rather than cloned edges (the same conventionGraphIndexuses). - Table
- A capped table:
totalrows before capping, how many weredropped, and the survivingrows. - TestRow
- One row of a tests model: a test
file, the test-carryingtest_defsin it, thelinesat which it references the symbol, theref_count, and whether the reference was guessed (heuristic). - Tests
Model - The resolved
testsresult for one symbol. - Visited
Entry - One visited file’s entry in an impact walk.
Enums§
- Impact
Result - The outcome of an
impactquery: resolved, ambiguous, or not found. - Read
Result - The outcome of a
readquery – therefsoutcome set unchanged, so the ambiguity and zero-hit discipline are literally the same code path’s. - Refs
Result - The outcome of a
refsquery: resolved, ambiguous, a bare-member answer, or not found. - Resolution
- Represents
Resolution. - Seed
Kind - Represents
SeedKind. - Seed
Resolution - Represents
SeedResolution. - Tests
Result - The outcome of a
testsquery: resolved, ambiguous, or not found.
Constants§
- DEFAULT_
CAP - Default per-table row cap for the outbound and ambiguous tables. The three
inbound tables share
INBOUND_CAPinstead. - DEFAULT_
DAMPING - Default damping factor for the personalized PageRank pass.
- DEFAULT_
HOPS - Default number of hops for the impact walk.
- DEFAULT_
HUB_ MAX_ INDEGREE - Default hub brake: a file whose in-degree is at or above this stops
widening. In-degree here is the number of DISTINCT OTHER FILES that
reference a file through a
direct(inherits/uses-type/uses-member) or heuristic edge. Derived from a corpus histogram rather than guessed: 824 files carry at least one referrer, every value from 1 to 33 is populated (holding 777 of the 824, 94.3%), and the first empty slot is at 34, above which the tail is sparse and gapped. The comparison is>=, so 34 is the first value that is not an ordinary file.0disables the in-degree half of the brake; the name-pattern half (is_infra_file) is a classification, not a threshold, and stays on. - DEFAULT_
IFACE_ MAX_ FANIN - Default fan-in brake: an interface injected into more than this many
distinct constructors is treated as infrastructure for widening purposes,
whatever it is called. Chosen from the constructor-injection in-degree
histogram of a large corpus, where 151 of 155 injected contracts (97.4%)
sit at or below 8 and nothing sits between 8 and the four estate-wide ones
(9, 11, 12, 21).
0disables the brake (--iface-max-fanin 0). - DEFAULT_
ITERATIONS - Default iteration count for the personalized PageRank pass.
- INBOUND_
CAP - Default cap shared across all three inbound kinds – one cap total, not one per table.
- OUTBOUND_
CAP - Default cap for the
--outview: one cap shared across all four outbound kinds (inherits/uses-type/uses-member/imports), the mirror ofINBOUND_CAP.--alllifts this cap. - SOURCE_
MAX - Maximum length of a displayed source line, in UTF-16 code units.
Truncation counts code units (see
clip_source) so the cut is stable regardless of any astral characters on the line.
Functions§
- build_
impact_ model - Blast radius for a seed, ranked. Never filters beyond the stated
cap:rowsis the ranked, capped view;dropped/total_affectedaccount for every row the walk found, capped or not. - build_
read_ model read=refsresolution + capped-and-ranked inbound machinery, reused- build_
refs_ model - Build the
refsmodel forquery.outincludes the outbound tables;cap/inbound_cap/outbound_capbound the tables;all_out(--all) lifts the inbound and outbound caps. - build_
tests_ model - Which TEST files reference this symbol, at which lines, via which
test-carrying defs. Nothing here is a new kind of edge: it is the same
inbound set
refsreports, filtered to the filestest_defs_by_filevouches for, which is why a symbol nothing tests answers “none” rather than falling back to a name convention. - def_
files - The distinct files a def is declared in, deduped: a partial type’s
also_insite can share a file with its primary declaration. - def_
sites - Every declaring site of a def, NOT deduped (unlike
def_files) – each site is its own row. - file_
inbound_ counts - The per-file precise inbound-edge count
find’s tie-break ranks by. - find_
names - Name search: every whitespace-split token of
queryhas to appear, case-insensitively, as a substring of the declared NAME – path and purpose are the manifest search’s haystack, not this one’s. The caller owns the graph (see the module header’s two-phase note). Results come back in index build order; ranking is the caller’s job. - first_
decl_ line_ by_ file - Every FILE’s own first declaration line, keyed by path: the minimum
lineacross everygraph.namesentry that file carries, over the WHOLE index. Unlikefind_names, this is never filtered to one query’s matches, because a manifest-pool row needs a line to open regardless of the query. A file the name index carries nothing for (no declared symbol at all – a config file, a doc, an asset) has no entry here; the caller falls back to line 1. - impact_
walk - Reverse-edge k-hop walk from a set of seed def ids. Hop N’s frontier is
every def declared in a file discovered at hop N-1; a file already visited
(or a seed’s own file) is recorded at most once, at its first (minimum) hop.
Ambiguous edges whose candidates include a frontier def count toward
via-count/top-symbols too. As a byproduct it builds
fwd_adj, the file-level subgraph that seeds the PPR ranking pass. - is_
infra_ file - A file whose PATH says it is infrastructure. Always on: unlike the
in-degree threshold, this is a classification of what the file is FOR, and
0on the threshold does not turn a composition root back into an ordinary file. - load_
graph_ index - Build the query index, phase two of the two-phase build (see module
header).
graphis what the caller got back fromgraph::read_graph(root);rootis used here only for the manifest join. - looks_
like_ file_ path - Whether
arglooks like a file path rather than a symbol query: a bare simple/qualified name with no path separator or file extension is a symbol query; anything else is a file path. Equivalent to/\.[A-Za-z0-9]+$/by checking the LAST.only (if an earlier dot’s suffix were all-alnum, the last dot’s suffix – which contains that earlier dot – could not be, since.is not[A-Za-z0-9]). Note a fully-qualified symbol id likeApp.Widgets.IWidget(trailing segment alphanumeric) DOES look like a file path under this heuristic. - name_
tier - Collapses
suggest::kind_rankinto three tiers forfind’s default view: tier 1 is a code symbol (kind_rank0 – a type or top-level declaration – or 1 – a member), tier 2 is a markup or binding name (kind_rank2), tier 3 is a resource key (kind_rank3).findmatches tier 1 then 2 by default and demotes tier 3 to a one-line trailer (--resourcesincludes it). - personalized_
page_ rank - Personalized PageRank over the file-level subgraph. Plain power iteration, no dependencies. Ranking only – never removes a node.
- resolve_
impact_ seed - Resolve an impact-walk seed argument to a file’s defs or a single symbol.
- resolve_
symbol - “Never guess” resolution ladder: exact id, then unique exact name, then unique case-insensitive name; two-or-more candidates at any step is reported as ambiguous, not resolved further.
- source_
line - The literal line a declaration sits on, ASCII-trimmed by
trim_source. Returns""on an unreadable file or an out-of-range line; the caller then printsfile:linewith nothing after it rather than a row ending in a dangling separator. - symbol_
refs - Immediate (1-hop) inbound/outbound for one resolved symbol. Partial-class
defs union outbound over every declaring file. An enum query unions every
member’s inbound
uses-memberedges in, iteratingindex.graph.defsdirectly (its array order) rather than the unorderedby_idmap.
Type Aliases§
- Heuristic
Entry - The value shape of both
heuristic_inboundandheuristic_outbound_by_file(inherits/uses-type/uses-member– note noimports: an imports edge names a namespace string, never a def, so no tier can guess one). Structurally identical toInboundEntry, and deliberately the same type. - Line
Cache - Per-file cache of source lines, so a widely used type does not re-read one
consumer file once per hit. The value is
Nonefor a file that could not be read.