Skip to main content

Module capability_paths

Module capability_paths 

Source
Expand description

#2469: capability paths — the answer to “why does this need Logger?”.

The requirement ledger records every capability use and whether the enclosing declaration’s given covers it. This module adds the second half of the explanation: how a declaration reaches a use that lives in another body. The only such edge in the language is an agent-handler call (Agent(key).m()): a service or agent handler’s deps are widened to cover the agent handlers it calls (#527), and a provider must list them in its given (bynk.provider.agent_call_undeclared_capability).

The checker owns the answer. CapabilityGraph::build runs in the same pass as that provider check, over the same Callee::Agent classification, and records two things per file:

  • one witness — the shortest chain — for each (given entry, capability) pair, so a hover is a lookup; and
  • the compact call/use facts the witnesses were drawn from, so the full set of chains is computed on demand (CapabilityGraph::all_paths) rather than stored for every pair.

Nothing here re-reads source text: the editor surfaces ask this module, they never re-derive a path.

Structs§

CapabilityGraph
One file’s capability call/use facts and the witnesses drawn from them.
CapabilityPath
A chain from a declaration to a use of a capability: zero or more PathStep::Calls then exactly one PathStep::Use. A direct use is the one-step chain.
CapabilityWitness
The shortest chain recorded for one given entry.

Enums§

PathStep
One hop of a capability path.

Constants§

MAX_PATHS
The most chains CapabilityGraph::all_paths returns for one entry. A densely connected project can have exponentially many simple paths; the action lists the shortest MAX_PATHS and says it stopped.

Type Aliases§

FileCapabilityPaths
Project-relative source path → that file’s capability graph.