Delete Discord operator control plane
This commit is contained in:
parent
8d45d69957
commit
39adf3a4d9
27 changed files with 89 additions and 4143 deletions
|
|
@ -23,7 +23,6 @@ use epiphany_core::EpiphanyProcessObservation as ProcessObservation;
|
|||
use epiphany_core::MemorySemanticProjectionInput;
|
||||
use epiphany_core::agent_memory_semantic_projection_input;
|
||||
use epiphany_core::authenticate_epiphany_cultmesh_semantic_projector_launch;
|
||||
use epiphany_core::authenticate_operator_command_service_health;
|
||||
use epiphany_core::authenticate_resident_provider_pair;
|
||||
use epiphany_core::epiphany_cultmesh_daemon_poke_intent_from_status;
|
||||
use epiphany_core::epiphany_cultmesh_daemon_poke_receipt_for_intent;
|
||||
|
|
@ -43,7 +42,6 @@ use epiphany_core::load_latest_epiphany_cultmesh_daemon_service_lifecycle_receip
|
|||
use epiphany_core::migrate_memory_semantic_projection_attempts_v0;
|
||||
use epiphany_core::observe_native_process as observe_process;
|
||||
use epiphany_core::query_epiphany_local_verse_context;
|
||||
use epiphany_core::read_operator_command_trust_anchor;
|
||||
use epiphany_core::retire_epiphany_cultmesh_operator_status_documents;
|
||||
use epiphany_core::retire_memory_semantic_projection_claims_v0;
|
||||
use epiphany_core::retire_orphaned_memory_semantic_projection_attempts_v0;
|
||||
|
|
@ -1000,61 +998,6 @@ fn publish_managed_service_iteration_health(
|
|||
contradictions
|
||||
.push("resident health requires both heartbeat and Self provider stores".into());
|
||||
}
|
||||
match (
|
||||
args.operator_service_readiness_store.as_deref(),
|
||||
args.operator_executor_trust_anchor.as_deref(),
|
||||
args.operator_service_bind.as_deref(),
|
||||
) {
|
||||
(Some(store), Some(anchor_path), Some(bind)) => {
|
||||
expected += 1;
|
||||
let result = read_operator_command_trust_anchor(anchor_path).and_then(|anchor| {
|
||||
authenticate_operator_command_service_health(
|
||||
store,
|
||||
&args.runtime_id,
|
||||
&release.release_id,
|
||||
authenticated_release_witness_sha256,
|
||||
&release.source_commit_sha,
|
||||
bind,
|
||||
&anchor,
|
||||
Utc::now().timestamp_millis().max(0) as u64,
|
||||
15_000,
|
||||
)
|
||||
});
|
||||
match result {
|
||||
Ok(health) => {
|
||||
let expected_executable =
|
||||
epiphany_packaged_release_binary_path(release, "operator-command")
|
||||
.and_then(|path| fs::canonicalize(path).map_err(Into::into));
|
||||
let observed = capture_process_instance(health.process_id);
|
||||
match (expected_executable, observed) {
|
||||
(Ok(expected_executable), Ok(process))
|
||||
if process.creation_token == health.process_creation_token
|
||||
&& process.executable_path == expected_executable
|
||||
&& process.executable_path.display().to_string()
|
||||
== health.process_executable_path =>
|
||||
{
|
||||
terminal_current += 1
|
||||
}
|
||||
(Ok(_), Ok(_)) => contradictions.push(
|
||||
"operator service process identity is not the signed packaged sibling"
|
||||
.into(),
|
||||
),
|
||||
(Err(error), _) | (_, Err(error)) => contradictions.push(format!(
|
||||
"operator service process cannot be authenticated: {error:#}"
|
||||
)),
|
||||
}
|
||||
}
|
||||
Err(error) => contradictions.push(format!(
|
||||
"operator service signed readiness is invalid: {error:#}"
|
||||
)),
|
||||
}
|
||||
}
|
||||
(None, None, None) => {}
|
||||
_ => {
|
||||
expected += 1;
|
||||
contradictions.push("operator service health requires readiness store, executor trust anchor, and exact bind".into());
|
||||
}
|
||||
}
|
||||
for service_id in required {
|
||||
let Some(policy) = policies
|
||||
.iter()
|
||||
|
|
@ -5297,9 +5240,6 @@ struct Args {
|
|||
resident_heartbeat_store: Option<PathBuf>,
|
||||
resident_self_store: Option<PathBuf>,
|
||||
resident_provider_stale_seconds: u64,
|
||||
operator_service_readiness_store: Option<PathBuf>,
|
||||
operator_executor_trust_anchor: Option<PathBuf>,
|
||||
operator_service_bind: Option<String>,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
|
|
@ -5359,9 +5299,6 @@ impl Args {
|
|||
let mut resident_heartbeat_store = None;
|
||||
let mut resident_self_store = None;
|
||||
let mut resident_provider_stale_seconds = 180_u64;
|
||||
let mut operator_service_readiness_store = None;
|
||||
let mut operator_executor_trust_anchor = None;
|
||||
let mut operator_service_bind = None;
|
||||
|
||||
while let Some(arg) = values.next() {
|
||||
match arg.as_str() {
|
||||
|
|
@ -5600,26 +5537,6 @@ impl Args {
|
|||
anyhow::bail!("--resident-provider-stale-seconds must be positive");
|
||||
}
|
||||
}
|
||||
"--operator-service-readiness-store" => {
|
||||
operator_service_readiness_store =
|
||||
Some(PathBuf::from(values.next().context(
|
||||
"missing --operator-service-readiness-store value",
|
||||
)?))
|
||||
}
|
||||
"--operator-executor-trust-anchor" => {
|
||||
operator_executor_trust_anchor = Some(PathBuf::from(
|
||||
values
|
||||
.next()
|
||||
.context("missing --operator-executor-trust-anchor value")?,
|
||||
))
|
||||
}
|
||||
"--operator-service-bind" => {
|
||||
operator_service_bind = Some(
|
||||
values
|
||||
.next()
|
||||
.context("missing --operator-service-bind value")?,
|
||||
)
|
||||
}
|
||||
other => anyhow::bail!("unknown argument {other:?}"),
|
||||
}
|
||||
}
|
||||
|
|
@ -5767,19 +5684,6 @@ impl Args {
|
|||
);
|
||||
}
|
||||
}
|
||||
let operator_health_fields = [
|
||||
operator_service_readiness_store.is_some(),
|
||||
operator_executor_trust_anchor.is_some(),
|
||||
operator_service_bind.is_some(),
|
||||
];
|
||||
if operator_health_fields.into_iter().any(|value| value)
|
||||
&& !operator_health_fields.into_iter().all(|value| value)
|
||||
{
|
||||
anyhow::bail!(
|
||||
"operator service health store, executor trust anchor, and bind are all-or-none"
|
||||
);
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
command,
|
||||
store,
|
||||
|
|
@ -5834,9 +5738,6 @@ impl Args {
|
|||
resident_heartbeat_store,
|
||||
resident_self_store,
|
||||
resident_provider_stale_seconds,
|
||||
operator_service_readiness_store,
|
||||
operator_executor_trust_anchor,
|
||||
operator_service_bind,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,124 +0,0 @@
|
|||
use anyhow::{Result, anyhow};
|
||||
use epiphany_core::{
|
||||
RepoFrontierExecutionAmendment, RepoFrontierPlanDecisionReceipt, RepoFrontierRoute,
|
||||
amend_repo_frontier_execution, assemble_repo_model_view, runtime_spine_cache,
|
||||
validate_frontier_plan_decision_chain,
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{collections::BTreeMap, env, path::PathBuf};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut values = BTreeMap::new();
|
||||
let mut args = env::args().skip(1);
|
||||
let command = args.next().ok_or_else(|| anyhow!(usage()))?;
|
||||
if command != "amend-frontier-execution" && command != "inspect-frontier-execution" {
|
||||
return Err(anyhow!("unknown command {command}\n{}", usage()));
|
||||
}
|
||||
while let Some(flag) = args.next() {
|
||||
let value = args
|
||||
.next()
|
||||
.ok_or_else(|| anyhow!("missing value for {flag}"))?;
|
||||
if values.insert(flag.clone(), value).is_some() {
|
||||
return Err(anyhow!("duplicate option {flag}"));
|
||||
}
|
||||
}
|
||||
let take = |name: &str| {
|
||||
values
|
||||
.get(name)
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow!("missing {name}"))
|
||||
};
|
||||
let store = PathBuf::from(take("--store")?);
|
||||
let route_id = take("--route-id")?;
|
||||
if command == "inspect-frontier-execution" {
|
||||
let mut cache = runtime_spine_cache(&store)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
let routes = cache.get_all::<RepoFrontierRoute>()?;
|
||||
let available = routes
|
||||
.iter()
|
||||
.map(|route| route.route_id.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
let route = routes
|
||||
.into_iter()
|
||||
.find(|route| route.route_id == route_id)
|
||||
.ok_or_else(|| anyhow!("route {route_id} does not exist; available: {available}"))?;
|
||||
let plan = route
|
||||
.adopted_plan
|
||||
.as_ref()
|
||||
.ok_or_else(|| anyhow!("route {route_id} has no adopted plan"))?;
|
||||
let current_model = assemble_repo_model_view(&store)?;
|
||||
let mut plan_decisions = cache
|
||||
.get_all::<RepoFrontierPlanDecisionReceipt>()?
|
||||
.into_iter()
|
||||
.filter(|decision| decision.planning_request_id == plan.planning_request_id)
|
||||
.collect::<Vec<_>>();
|
||||
if plan_decisions.len() != 1 {
|
||||
return Err(anyhow!(
|
||||
"route {route_id} requires exactly one typed plan decision; found {}",
|
||||
plan_decisions.len()
|
||||
));
|
||||
}
|
||||
let plan_decision = plan_decisions.pop().expect("one decision checked above");
|
||||
validate_frontier_plan_decision_chain(&plan_decision, &route, ¤t_model)
|
||||
.map_err(anyhow::Error::msg)?;
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string_pretty(&serde_json::json!({
|
||||
"routeId": route.route_id,
|
||||
"modelProjectionDigest": route.model_projection_digest,
|
||||
"modelSourceDocuments": route.model_source_documents,
|
||||
"frontierPlanDecisionId": plan_decision.decision_id,
|
||||
"frontierPlanDecision": plan_decision,
|
||||
"frontierItemId": route.frontier_item_id,
|
||||
"frontierItemHash": route.frontier_item_hash,
|
||||
"originalAction": plan.action,
|
||||
"originalCommand": plan.command,
|
||||
"effectiveAction": plan.effective_action(),
|
||||
"effectiveCommand": plan.effective_command(),
|
||||
"executionAmendment": plan.execution_amendment,
|
||||
}))?
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
let source_actor_id = take("--source-actor-id")?;
|
||||
let command_id = take("--command-id")?;
|
||||
let admission_id = take("--admission-id")?;
|
||||
let packet_sha256 = take("--packet-sha256")?;
|
||||
let previous_action = take("--previous-action")?;
|
||||
let previous_command = take("--previous-command")?;
|
||||
let action = take("--action")?;
|
||||
let replacement_command = take("--replacement-command")?;
|
||||
let rationale = take("--rationale")?;
|
||||
let amended_at = take("--amended-at")?;
|
||||
let semantic = format!(
|
||||
"{route_id}\0{source_actor_id}\0{command_id}\0{admission_id}\0{packet_sha256}\0{action}\0{replacement_command}\0{rationale}\0{amended_at}"
|
||||
);
|
||||
let amendment_id = format!(
|
||||
"repo-frontier-execution-amendment-{:x}",
|
||||
Sha256::digest(semantic.as_bytes())
|
||||
);
|
||||
let receipt = amend_repo_frontier_execution(
|
||||
store,
|
||||
RepoFrontierExecutionAmendment {
|
||||
amendment_id,
|
||||
replaces_route_id: route_id,
|
||||
source_actor_id,
|
||||
command_id,
|
||||
admission_id,
|
||||
packet_sha256,
|
||||
previous_action_sha256: format!("{:x}", Sha256::digest(previous_action.as_bytes())),
|
||||
previous_command_sha256: format!("{:x}", Sha256::digest(previous_command.as_bytes())),
|
||||
action,
|
||||
command: replacement_command,
|
||||
rationale,
|
||||
amended_at,
|
||||
},
|
||||
)?;
|
||||
println!("{}", serde_json::to_string_pretty(&receipt)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn usage() -> &'static str {
|
||||
"usage: epiphany-frontier-execution inspect-frontier-execution --store PATH --route-id ID\n epiphany-frontier-execution amend-frontier-execution --store PATH --route-id ID --source-actor-id ID --command-id ID --admission-id ID --packet-sha256 SHA256 --previous-action TEXT --previous-command TEXT --action TEXT --replacement-command TEXT --rationale TEXT --amended-at RFC3339"
|
||||
}
|
||||
|
|
@ -930,7 +930,6 @@ mod tests {
|
|||
stop_conditions: vec!["A check fails.".into()],
|
||||
rollback_steps: vec!["Revert the fixture change.".into()],
|
||||
commit_message: "Exercise exact Hands authority".into(),
|
||||
execution_amendment: None,
|
||||
}),
|
||||
status: RepoFrontierStatus::Active,
|
||||
..Default::default()
|
||||
|
|
|
|||
|
|
@ -1669,7 +1669,6 @@ fn record_hands_implementation_gate(
|
|||
"plannedCommand": route.adopted_plan.as_ref().map(|plan| plan.effective_command()),
|
||||
"originalPlannedAction": route.adopted_plan.as_ref().map(|plan| plan.action.as_str()),
|
||||
"originalPlannedCommand": route.adopted_plan.as_ref().map(|plan| plan.command.as_str()),
|
||||
"executionAmendmentId": route.adopted_plan.as_ref().and_then(|plan| plan.execution_amendment.as_ref()).map(|amendment| amendment.amendment_id.as_str()),
|
||||
"plannedChecks": route.adopted_plan.as_ref().map(|plan| plan.checks.as_slice()),
|
||||
"plannedStopConditions": route.adopted_plan.as_ref().map(|plan| plan.stop_conditions.as_slice()),
|
||||
"plannedRollbackSteps": route.adopted_plan.as_ref().map(|plan| plan.rollback_steps.as_slice()),
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
use anyhow::{Context, Result};
|
||||
use epiphany_core::write_operator_command_interop_fixture;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let output = std::env::args_os()
|
||||
.nth(1)
|
||||
.map(PathBuf::from)
|
||||
.context("usage: epiphany-operator-command-fixture <output-directory>")?;
|
||||
let manifest = write_operator_command_interop_fixture(&output)?;
|
||||
println!("{}", serde_json::to_string_pretty(&manifest)?);
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
use anyhow::{Context, Result, anyhow, bail};
|
||||
use epiphany_core::{
|
||||
OperatorCapability, OperatorCommandPolicy, OperatorCommandServiceConfig,
|
||||
OperatorCommandServiceReadiness, OperatorStatusProviderHealthConfig, open_host_identity_at,
|
||||
read_operator_command_trust_anchor, serve_operator_command_rudp,
|
||||
};
|
||||
use std::collections::BTreeMap;
|
||||
use std::net::{SocketAddr, UdpSocket};
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse(std::env::args().skip(1))?;
|
||||
let signer = open_host_identity_at(&args.executor_identity_store)?;
|
||||
let config = OperatorCommandServiceConfig {
|
||||
command_store: args.command_store.clone(),
|
||||
local_verse_store: args.local_verse_store.clone(),
|
||||
resident_self_store: args.resident_self_store.clone(),
|
||||
runtime_store: args.runtime_store.clone(),
|
||||
policy: OperatorCommandPolicy {
|
||||
runtime_id: args.runtime_id.clone(),
|
||||
discord_guild_id: args.guild_id.clone(),
|
||||
allowed_channel_ids: args.channel_ids.clone(),
|
||||
actor_capabilities: args.actor_capabilities.clone(),
|
||||
max_ttl_seconds: args.max_ttl_seconds,
|
||||
},
|
||||
trusted_bifrost_identity: read_operator_command_trust_anchor(&args.bifrost_trust_anchor)?,
|
||||
provider_health: OperatorStatusProviderHealthConfig {
|
||||
query_endpoint: args.idunn_provider_query,
|
||||
idunn_runtime_id: args.idunn_runtime_id.clone(),
|
||||
trust_anchor_store: args.idunn_projection_anchor.clone(),
|
||||
admission_store: args.provider_admission_store.clone(),
|
||||
max_local_age_millis: args.provider_ttl_millis,
|
||||
deployment_id: args.deployment_id.clone(),
|
||||
release_id: args.release_id.clone(),
|
||||
release_witness_sha256: args.release_witness_sha256.clone(),
|
||||
source_commit: args.source_commit.clone(),
|
||||
},
|
||||
};
|
||||
if args.status_only {
|
||||
print_readiness(&args, &signer, "configured")?;
|
||||
return Ok(());
|
||||
}
|
||||
let socket = UdpSocket::bind(args.bind).with_context(|| {
|
||||
format!(
|
||||
"binding Epiphany operator command RUDP service at {}",
|
||||
args.bind
|
||||
)
|
||||
})?;
|
||||
print_readiness(&args, &signer, "serving")?;
|
||||
let health = epiphany_core::OperatorCommandServiceHealthConfig {
|
||||
store: args.readiness_store.clone(),
|
||||
bind: args.bind.to_string(),
|
||||
release_id: args.release_id.clone(),
|
||||
release_witness_sha256: args.release_witness_sha256.clone(),
|
||||
source_commit: args.source_commit.clone(),
|
||||
};
|
||||
serve_operator_command_rudp(socket, &config, &signer, &health)
|
||||
}
|
||||
|
||||
fn print_readiness(
|
||||
args: &Args,
|
||||
signer: &epiphany_core::HostIdentitySigner,
|
||||
status: &str,
|
||||
) -> Result<()> {
|
||||
println!(
|
||||
"{}",
|
||||
serde_json::to_string(&OperatorCommandServiceReadiness {
|
||||
schema_version: "epiphany.operator_command.service_readiness.v0".into(),
|
||||
status: status.into(),
|
||||
runtime_id: args.runtime_id.clone(),
|
||||
bind: args.bind.to_string(),
|
||||
executor_identity_id: signer.entry().identity_id.clone(),
|
||||
private_state_exposed: false,
|
||||
})?
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct Args {
|
||||
bind: SocketAddr,
|
||||
runtime_id: String,
|
||||
bifrost_trust_anchor: PathBuf,
|
||||
executor_identity_store: PathBuf,
|
||||
command_store: PathBuf,
|
||||
local_verse_store: PathBuf,
|
||||
resident_self_store: PathBuf,
|
||||
runtime_store: PathBuf,
|
||||
guild_id: String,
|
||||
channel_ids: Vec<String>,
|
||||
actor_capabilities: BTreeMap<String, Vec<OperatorCapability>>,
|
||||
max_ttl_seconds: i64,
|
||||
readiness_store: PathBuf,
|
||||
release_id: String,
|
||||
release_witness_sha256: String,
|
||||
source_commit: String,
|
||||
deployment_id: String,
|
||||
idunn_provider_query: SocketAddr,
|
||||
idunn_runtime_id: String,
|
||||
idunn_projection_anchor: PathBuf,
|
||||
provider_admission_store: PathBuf,
|
||||
provider_ttl_millis: u64,
|
||||
status_only: bool,
|
||||
}
|
||||
|
||||
impl Args {
|
||||
fn parse(values: impl Iterator<Item = String>) -> Result<Self> {
|
||||
let mut values = values.peekable();
|
||||
let mut fields = BTreeMap::<String, String>::new();
|
||||
let mut channels = Vec::new();
|
||||
let mut actors = BTreeMap::new();
|
||||
let mut status_only = false;
|
||||
while let Some(flag) = values.next() {
|
||||
match flag.as_str() {
|
||||
"--status" => status_only = true,
|
||||
"--channel-id" => channels.push(values.next().context("missing --channel-id")?),
|
||||
"--actor-capabilities" => {
|
||||
let value = values.next().context("missing --actor-capabilities")?;
|
||||
let (actor, capabilities) = value.split_once('=').context(
|
||||
"--actor-capabilities must be actor=status,sleep,wake,directive",
|
||||
)?;
|
||||
if actor.trim().is_empty() || actors.contains_key(actor) {
|
||||
bail!("operator actor capability binding is empty or duplicated");
|
||||
}
|
||||
let parsed = capabilities
|
||||
.split(',')
|
||||
.map(parse_capability)
|
||||
.collect::<Result<Vec<_>>>()?;
|
||||
if parsed.is_empty() {
|
||||
bail!("operator actor requires at least one capability");
|
||||
}
|
||||
actors.insert(actor.to_string(), parsed);
|
||||
}
|
||||
"--bind"
|
||||
| "--runtime-id"
|
||||
| "--bifrost-trust-anchor"
|
||||
| "--executor-identity-store"
|
||||
| "--command-store"
|
||||
| "--local-verse-store"
|
||||
| "--resident-self-store"
|
||||
| "--runtime-store"
|
||||
| "--guild-id"
|
||||
| "--readiness-store"
|
||||
| "--release-id"
|
||||
| "--release-witness-sha256"
|
||||
| "--source-commit"
|
||||
| "--deployment-id"
|
||||
| "--idunn-provider-query"
|
||||
| "--idunn-runtime-id"
|
||||
| "--idunn-projection-anchor"
|
||||
| "--provider-admission-store"
|
||||
| "--provider-ttl-millis"
|
||||
| "--max-ttl-seconds" => {
|
||||
let value = values
|
||||
.next()
|
||||
.ok_or_else(|| anyhow!("missing value for {flag}"))?;
|
||||
if fields.insert(flag.clone(), value).is_some() {
|
||||
bail!("duplicate operator service argument {flag}");
|
||||
}
|
||||
}
|
||||
_ => bail!("unknown operator service argument {flag}"),
|
||||
}
|
||||
}
|
||||
let required = |name: &str| {
|
||||
fields
|
||||
.get(name)
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow!("missing {name}"))
|
||||
};
|
||||
if channels.is_empty() || actors.is_empty() {
|
||||
bail!("operator service requires channels and actor capabilities");
|
||||
}
|
||||
let max_ttl_seconds = fields
|
||||
.get("--max-ttl-seconds")
|
||||
.map(String::as_str)
|
||||
.unwrap_or("60")
|
||||
.parse()?;
|
||||
if !(1..=60).contains(&max_ttl_seconds) {
|
||||
bail!("operator service max TTL must be 1..=60 seconds");
|
||||
}
|
||||
let provider_ttl_millis = required("--provider-ttl-millis")?.parse()?;
|
||||
if provider_ttl_millis == 0 {
|
||||
bail!("provider health TTL must be nonzero");
|
||||
}
|
||||
Ok(Self {
|
||||
bind: required("--bind")?.parse()?,
|
||||
runtime_id: required("--runtime-id")?,
|
||||
bifrost_trust_anchor: required("--bifrost-trust-anchor")?.into(),
|
||||
executor_identity_store: required("--executor-identity-store")?.into(),
|
||||
command_store: required("--command-store")?.into(),
|
||||
local_verse_store: required("--local-verse-store")?.into(),
|
||||
resident_self_store: required("--resident-self-store")?.into(),
|
||||
runtime_store: required("--runtime-store")?.into(),
|
||||
guild_id: required("--guild-id")?,
|
||||
channel_ids: channels,
|
||||
actor_capabilities: actors,
|
||||
max_ttl_seconds,
|
||||
readiness_store: required("--readiness-store")?.into(),
|
||||
release_id: required("--release-id")?,
|
||||
release_witness_sha256: required("--release-witness-sha256")?,
|
||||
source_commit: required("--source-commit")?,
|
||||
deployment_id: required("--deployment-id")?,
|
||||
idunn_provider_query: required("--idunn-provider-query")?.parse()?,
|
||||
idunn_runtime_id: required("--idunn-runtime-id")?,
|
||||
idunn_projection_anchor: required("--idunn-projection-anchor")?.into(),
|
||||
provider_admission_store: required("--provider-admission-store")?.into(),
|
||||
provider_ttl_millis,
|
||||
status_only,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_capability(value: &str) -> Result<OperatorCapability> {
|
||||
match value {
|
||||
"status" => Ok(OperatorCapability::Status),
|
||||
"sleep" => Ok(OperatorCapability::Sleep),
|
||||
"wake" => Ok(OperatorCapability::Wake),
|
||||
"directive" => Ok(OperatorCapability::Directive),
|
||||
"reviews" => Ok(OperatorCapability::Reviews),
|
||||
"review" => Ok(OperatorCapability::Review),
|
||||
_ => bail!("unknown operator capability {value}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parser_has_no_argv_or_store_selector_escape_hatch() {
|
||||
assert!(Args::parse(["--argv".into(), "whoami".into()].into_iter()).is_err());
|
||||
assert!(
|
||||
Args::parse(["--actor-capabilities".into(), "actor=shell".into()].into_iter()).is_err()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in a new issue