Implement OperationContext, AbortPolicy, CompositionAuthority, ScopedOperationEnv

Implements the operation context types in registry/context.rs (ADR-015,
ADR-022, ADR-024): OperationContext with all 10 fields (internal is
pub(crate) for writes, read via is_internal()), AbortPolicy enum with
AbortDependents default, CompositionAuthority with synthetic Identity
projection for ACL, ScopedOperationEnv reachability set, and
generate_request_id() (UUID v4). Adds a minimal OperationEnv trait
forward-declaration in registry/env.rs so the context env field compiles;
the operation-env task will expand it.
This commit is contained in:
2026-06-23 14:27:46 +00:00
parent dabb0d8b68
commit 3b9c480dad
2 changed files with 208 additions and 13 deletions

View File

@@ -1,8 +1,32 @@
//! Operation environment: the `OperationEnv` trait, `LocalOperationEnv`, and
//! `CompositeOperationEnv`.
//!
//! The composition dispatch trait — handlers compose child operations through
//! `OperationContext.env`. See
//! `docs/architecture/crates/call/operation-registry.md` and ADR-024.
use serde_json::Value;
// TODO: implement
use super::context::{AbortPolicy, OperationContext};
use crate::protocol::wire::ResponseEnvelope;
#[async_trait::async_trait]
pub trait OperationEnv: Send + Sync {
async fn invoke(
&self,
namespace: &str,
operation: &str,
input: Value,
parent: &OperationContext,
) -> ResponseEnvelope {
self.invoke_with_policy(namespace, operation, input, parent, parent.abort_policy)
.await
}
async fn invoke_with_policy(
&self,
namespace: &str,
operation: &str,
input: Value,
parent: &OperationContext,
policy: AbortPolicy,
) -> ResponseEnvelope;
fn contains(&self, name: &str) -> bool {
let _ = name;
true
}
}