pub struct StepNaming { /* private fields */ }Expand description
GH #23 — the single addressing-space table for one Blueprint’s dispatched steps. See the module doc for the construction site and storage/accessor threading; this doc covers the resolution rules.
§Canonical / alias resolution
For every distinct Step.ref appearing anywhere in the flow (Seq /
Branch / Fanout / Loop / Try nesting all walked — see
Self::from_blueprint):
canonical= the dispatching agent’sAgentMeta.projection_namewhen declared, else theStep.refitself (byte-identical to pre-GH-#23 behavior for undeclared Blueprints).aliases={Step.ref}∪ everyoutPath expr’s top-level segment seen across every occurrence of thatrefin the flow ("$.plan"→"plan","$.a.b"→"a"; a non-Pathoutcontributes nothing — best-effort, mirroringblueprint::compiler’s existing static-walk convention of skipping what can’t be inspected structurally), minus any WEAK claim another step contests (below).
§Strong and weak claims
Not every name a step could claim is claimed with the same strength:
- strong claim — the
Step.ref, the declaredprojection_name, and anoutthat is exactly$.T(depth 1, so the step OWNS the wholeTsubtree). - weak claim — the top segment
Tof anoutwriting UNDER it ($.T.x…, depth ≥ 2). The step owns a lane insideT, notT.
A weak claim registers only when no other step claims that name at
all. The moment a second step claims it — strongly or weakly — every
weak claim on the name is dropped (silently, at tracing::debug!
level: a shared nesting root is ordinary Blueprint shape, not a
defect). The name then resolves to whichever step claims it strongly,
or to nothing when the contest was weak-vs-weak. That deliberate miss
replaces the pre-existing behavior of handing out one arbitrary lane’s
output under the shared root’s name.
Every strong claim (canonical + every strongly-claimed alias) is
checked for cross-step collisions. A clash where either side declared
projection_name is a hard StepNamingError (registration is
rejected outright). A clash between two undeclared steps is a soft
StepNamingWarning: the pre-GH-#23 union rule’s “data-plane wins”
precedence is preserved by letting the step whose OWN ref equals the
contested name own it in Self::resolve — an alias derived merely
from another step’s out segment never displaces it.
The resulting boundaries:
| Blueprint shape | result |
|---|---|
$.r.a / $.r.b / … written by different steps (a shared nesting root) | "r" is nobody’s alias; no warning. Each lane is addressed by its own ref / projection_name |
two steps whose out is the identical $.r | soft warning + data-plane priority (a genuine ambiguity) |
ref: "r" on one step, $.r.x on another | the weak claim yields: no warning, resolve("r") is the "r" step |
projection_name: "r" on one step, $.r.x on another | the weak claim yields: compiles (no hard error) |
$.r.a written by exactly one step | "r" stays that step’s alias (unchanged) |
Implementations§
Source§impl StepNaming
impl StepNaming
Sourcepub fn resolve(&self, name: &str) -> Option<&str>
pub fn resolve(&self, name: &str) -> Option<&str>
Resolve name (canonical or alias) to its canonical name.
Sourcepub fn canonical_of_producer(&self, ref_name: &str) -> Option<&str>
pub fn canonical_of_producer(&self, ref_name: &str) -> Option<&str>
Resolve a Step’s data-plane producer name (Step.ref /
AgentDef.name) to its canonical name.
Sourcepub fn names(&self) -> impl Iterator<Item = &str>
pub fn names(&self) -> impl Iterator<Item = &str>
Every canonical name this table declares (subtask-2/3 enumeration
consumers, e.g. McpQueryAdapter::enumerate_steps).
Sourcepub fn entries(&self) -> impl Iterator<Item = &StepNameEntry>
pub fn entries(&self) -> impl Iterator<Item = &StepNameEntry>
Every full StepNameEntry (canonical + aliases) this table
holds.
Sourcepub fn from_blueprint(
bp: &Blueprint,
) -> Result<(StepNaming, Vec<StepNamingWarning>), StepNamingError>
pub fn from_blueprint( bp: &Blueprint, ) -> Result<(StepNaming, Vec<StepNamingWarning>), StepNamingError>
Build the table from a Blueprint’s flow + agents — the sole
construction site (see the module + struct docs). Returns the
table plus any soft StepNamingWarnings (the caller decides
how to log them, typically via tracing::warn!); a hard
collision returns StepNamingError instead.
Trait Implementations§
Source§impl Clone for StepNaming
impl Clone for StepNaming
Source§fn clone(&self) -> StepNaming
fn clone(&self) -> StepNaming
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StepNaming
impl Debug for StepNaming
Source§impl Default for StepNaming
impl Default for StepNaming
Source§fn default() -> StepNaming
fn default() -> StepNaming
Auto Trait Implementations§
impl Freeze for StepNaming
impl RefUnwindSafe for StepNaming
impl Send for StepNaming
impl Sync for StepNaming
impl Unpin for StepNaming
impl UnsafeUnpin for StepNaming
impl UnwindSafe for StepNaming
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more