pub struct RoutingDecision {
pub id: String,
pub run_id: String,
pub subtask_id: String,
pub candidates: Vec<RoutingCandidate>,
pub chosen: RoutingChoice,
pub reason: RoutingReason,
pub content_hash: String,
pub decided_at: DateTime<Utc>,
pub anchor: String,
}Expand description
The full routing decision recorded per coordination step. Immutable once
written; replays compare content_hash to detect drift.
Fields§
§id: Stringrtg_* ULID; unique per record.
run_id: StringRun this decision belongs to.
subtask_id: StringSubtask / DAG step the decision is binding.
candidates: Vec<RoutingCandidate>Every candidate the orchestrator considered, in the order they were evaluated. Order is preserved verbatim so a replay can attribute a later ordering change.
chosen: RoutingChoiceThe candidate that won.
reason: RoutingReasonWhy this candidate won.
content_hash: StringSHA-256 over a stable JSON projection of the decision’s structural
fields (everything except decided_at and content_hash itself).
Equal hashes mean equal decisions; unequal hashes mean a coordination
drift that the replay should surface.
decided_at: DateTime<Utc>Server-generated wall-clock UTC instant.
anchor: StringarXiv anchor of the audit methodology — defaults to
ROUTING_ANCHOR.
Implementations§
Source§impl RoutingDecision
impl RoutingDecision
Sourcepub fn new(
id: impl Into<String>,
run_id: impl Into<String>,
subtask_id: impl Into<String>,
candidates: Vec<RoutingCandidate>,
chosen: RoutingChoice,
reason: RoutingReason,
decided_at: DateTime<Utc>,
) -> Self
pub fn new( id: impl Into<String>, run_id: impl Into<String>, subtask_id: impl Into<String>, candidates: Vec<RoutingCandidate>, chosen: RoutingChoice, reason: RoutingReason, decided_at: DateTime<Utc>, ) -> Self
Build a decision from raw inputs. id and decided_at are taken
from the caller so the gateway can stamp them at dispatch time;
content_hash is computed here so the contract is single-source.
Sourcepub fn to_audit_details(&self) -> Value
pub fn to_audit_details(&self) -> Value
Serialize the decision into the JSON shape that goes into
audit_events.details. Mirrors serde_json::to_value(&self) but
kept as a named entry point so call sites read clearly.
Sourcepub fn from_audit_details(value: &Value) -> Result<Self, Error>
pub fn from_audit_details(value: &Value) -> Result<Self, Error>
Parse a decision back out of an audit_events.details blob. Used by
the gateway /v1/runs/{id}/routing read endpoint and by the
fd-evals replay helper.
Sourcepub fn verify_hash(&self) -> bool
pub fn verify_hash(&self) -> bool
Verify that the stored content_hash still matches a re-computation
from the structural fields. Used by replays to detect drift.
Trait Implementations§
Source§impl Clone for RoutingDecision
impl Clone for RoutingDecision
Source§fn clone(&self) -> RoutingDecision
fn clone(&self) -> RoutingDecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more