From f0fee0b0acfa8456c33606af0d0af1f53110dc44 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 16 Sep 2026 23:14:45 +0200 Subject: [PATCH] Give the CultNet surface a mutant per rule, and two per rule where one exists `eureka-cut10-mutations.psd1` carries thirty-one entries over sixteen rules: each rule has a revert that removes it and, where the rule can be weakened rather than removed, a loosening that leaves it standing but wrong. The connection id and the startup order say plainly why they have only the one mutation each. `D1` and `D1D` are one edit run against both suites, because the instance check has one owner and two callers. Three tests grew to hold their mutants. The instance test now admits a batch whose documents name no instance, so nothing between the wire and A1 can quietly rewrite the declaration into the mind's own. The malformed-envelope test now sends a refused read through the whole answer path, so a refusal must stay on the response schema. The startup test now holds the mind and the port at once, so a startup that binds first reports the port rather than the mind it never asked. Co-Authored-By: Claude Opus 5 --- crates/huginn-daemon/src/daemon.rs | 11 + crates/huginn-daemon/src/serve.rs | 45 ++- tools/eureka-cut10-mutations.psd1 | 462 +++++++++++++++++++++++++++++ 3 files changed, 507 insertions(+), 11 deletions(-) create mode 100644 tools/eureka-cut10-mutations.psd1 diff --git a/crates/huginn-daemon/src/daemon.rs b/crates/huginn-daemon/src/daemon.rs index c2a2722..02d4776 100644 --- a/crates/huginn-daemon/src/daemon.rs +++ b/crates/huginn-daemon/src/daemon.rs @@ -299,6 +299,17 @@ pub(crate) mod tests { HuginnMindResponse::Admit(PipelineAdmissionOutcome::Refused(foreign.clone())) ); + // The declared instance travels to the mind as the client sent it. A + // batch whose documents name no instance at all is still refused on + // the declaration alone, so nothing between the wire and A1 may + // rewrite it into the mind's own. + let (question, _) = question_and_ruling(); + let admit = HuginnMindRequest::Admit(batch(OTHER, vec![question])); + assert_eq!( + daemon.handle(admit, now()), + HuginnMindResponse::Admit(PipelineAdmissionOutcome::Refused(foreign.clone())) + ); + let view = HuginnMindRequest::View { instance: slug(OTHER), id: writes[0].clone() }; assert_eq!(daemon.handle(view, now()), HuginnMindResponse::Refused(foreign.clone())); diff --git a/crates/huginn-daemon/src/serve.rs b/crates/huginn-daemon/src/serve.rs index dd3bd42..4d561a6 100644 --- a/crates/huginn-daemon/src/serve.rs +++ b/crates/huginn-daemon/src/serve.rs @@ -217,13 +217,13 @@ pub fn run>( #[cfg(test)] mod tests { use super::*; - use crate::daemon::tests::{INSTANCE, batch, identity, now, slug}; + use crate::daemon::tests::{INSTANCE, OTHER, batch, identity, now, slug}; use crate::envelope::{FAILURE_SCHEMA, decode_response, encode_request}; use base64::Engine; use base64::engine::general_purpose::STANDARD; use cultnet_rs::{CultMesh, CultMeshRudpSocketOptions}; use huginn_mind::wire::{HuginnMindRequest, HuginnMindResponse, MindStatus}; - use huginn_mind::{PipelineAdmissionOutcome, PipelineQuery}; + use huginn_mind::{MindRefusal, PipelineAdmissionOutcome, PipelineQuery}; use std::sync::Arc; use std::sync::atomic::AtomicBool; @@ -307,6 +307,21 @@ mod tests { assert_eq!(documents(&mut daemon), 0, "no malformed envelope reached the mind"); + // A mind's refusal is an answer on the response schema, not a failure + // of the envelope: the client decodes it as the typed refusal it is. + let read = HuginnMindRequest::Query { instance: slug(OTHER), query: PipelineQuery::default() }; + let reply = answer(&mut daemon, ®istry, encode_request("m-r", &read, None).unwrap(), now()); + let CultNetMessage::OperationResponse { status, payload_schema, .. } = &reply else { + panic!("expected an operation response, got {reply:?}"); + }; + assert_eq!((status.as_str(), payload_schema.as_str()), ("rejected", MIND_RESPONSE_SCHEMA)); + let (correlation, answered) = decode_response(&reply).unwrap(); + assert_eq!(correlation, "m-r"); + assert_eq!( + answered.unwrap(), + HuginnMindResponse::Refused(MindRefusal::ForeignInstance { declared: OTHER.into(), mind: INSTANCE.into() }) + ); + let catalog = CultNetMessage::SchemaCatalogRequest { message_id: "m-6".into(), include_schema_json: Some(true), @@ -417,22 +432,30 @@ mod tests { assert_eq!(documents(&mut daemon), 1, "the admission that crossed the wire landed"); } - /// Ruling 15 as an order in the one place both happen: a mind that will not - /// open leaves the port free, so the socket cannot precede the refusal. + /// Ruling 15 as an order in the one place both happen. Both gates are shut + /// at once: the mind is held and the port is held. A startup that opens + /// first says why the mind refused; one that binds first can only say the + /// port was taken, and never reaches the refusal that matters. #[test] fn startup_opens_the_mind_before_it_binds_anything() { let root = tempfile::tempdir().unwrap(); let held = Daemon::open(root.path(), &slug(INSTANCE)).unwrap(); - let probe = UdpSocket::bind("127.0.0.1:0").unwrap(); - let port = probe.local_addr().unwrap(); - drop(probe); + let occupied = UdpSocket::bind("127.0.0.1:0").unwrap(); + let port = occupied.local_addr().unwrap(); let options = Options { state_root: root.path().to_path_buf(), instance: slug(INSTANCE), bind: port }; - let error = startup(&options).err().expect("a held mind refuses"); - assert!(format!("{error:#}").contains("MindAlreadyOwned"), "{error:#}"); + let error = format!("{:#}", startup(&options).err().expect("a held mind refuses")); + assert!(error.contains("MindAlreadyOwned"), "the refusal is the mind's, not the socket's: {error}"); + assert!(!error.contains("binding"), "the socket was never reached: {error}"); + + // With the mind free and the port still held, the socket is the only + // gate left, and startup reports it. drop(held); - // Nothing bound the port, so the test can. - UdpSocket::bind(port).expect("startup bound nothing before the mind refused"); + let error = format!("{:#}", startup(&options).err().expect("a held port refuses")); + assert!(error.contains("binding"), "{error}"); + drop(occupied); + let (_daemon, hub, _registry) = startup(&options).expect("both gates open"); + assert_eq!(hub.local_addr().unwrap(), port); } #[test] diff --git a/tools/eureka-cut10-mutations.psd1 b/tools/eureka-cut10-mutations.psd1 new file mode 100644 index 0000000..8d22bfa --- /dev/null +++ b/tools/eureka-cut10-mutations.psd1 @@ -0,0 +1,462 @@ +# Cut 10 mutations, D1-D16: the CultNet surface's rules. Each rule has a +# revert, `Dn`, which removes the rule, and a loosening, `DnL`, which weakens +# it rather than removing it, because a plain revert is the easy target. Every +# entry names the test that must fail while it is applied. Run through +# Epiphany's harness from this repo: +# +# $env:CARGO_TARGET_DIR = 'C:\Users\Meta\.cargo-target-codex' +# powershell -File F:\Projects\Epiphany\tools\eureka-mutations.ps1 -Repo F:\Projects\Huginn ` +# -Entries tools/eureka-cut10-mutations.psd1 ` +# -Target crates/huginn-mind/src/mind.rs,crates/huginn-mind/src/wire.rs,crates/huginn-daemon/src/daemon.rs,crates/huginn-daemon/src/envelope.rs,crates/huginn-daemon/src/serve.rs,schemas/cultnet/huginn.mind_request.v1.schema.json,schemas/cultnet/huginn.mind_response.v1.schema.json ` +# -Test 'cargo test -p huginn-daemon --lib' +# +# Entries whose test lives in `huginn-mind` carry their own `Command`. `D1` and +# `D1D` are one mutant run against two suites, which is the point of the rule: +# `Mind::require_instance` is the one instance check, and admission and the +# daemon's reads are its two callers. The same edit is `H1` in +# `eureka-cut8-mutations.psd1`. +# +# `M0` is the harness's own no-op control and is not listed here. +# +# Two rules have no loosening and say so rather than carrying a weak entry: +# +# - `D9`, the connection id the hub serves. It is one `u32` handed to +# `CultNetRudpServerHubOptions::new`; a hub serves that id or another one, +# and there is no shape of "serves more ids" to weaken it into. +# - `D12`'s order, weakened as far as it goes by `D12L`: a hub bound before the +# mind is opened and then dropped when the mind refuses. Any weaker form is +# the correct order again. +@{ + Mutations = @( + @{ + Id = 'D1' + Rule = 'Ruling 14: the mind owns the instance check, and it is a comparison.' + Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share' + Command = 'cargo test -p huginn-mind --lib' + File = 'crates/huginn-mind/src/mind.rs' + Old = @' + if declared != self.instance() { + return Err(MindRefusal::ForeignInstance { + declared: declared.0.clone(), + mind: self.instance().0.clone(), + }); + } + Ok(()) +'@ + New = @' + let _ = declared; + Ok(()) +'@ + } + @{ + Id = 'D1L' + Rule = 'The refusal names which mind refused, so an agent can act on the field rather than guess.' + Test = 'mind::tests::require_instance_is_the_one_check_admission_and_the_daemon_share' + Command = 'cargo test -p huginn-mind --lib' + File = 'crates/huginn-mind/src/mind.rs' + Old = ' mind: self.instance().0.clone(),' + New = ' mind: declared.0.clone(),' + } + @{ + Id = 'D1D' + Rule = 'One check, two callers: the daemon''s reads are refused by the same function admission asks.' + Test = 'daemon::tests::a_read_or_a_write_naming_another_instance_is_refused_by_the_mind_and_writes_nothing' + File = 'crates/huginn-mind/src/mind.rs' + Old = @' + if declared != self.instance() { + return Err(MindRefusal::ForeignInstance { + declared: declared.0.clone(), + mind: self.instance().0.clone(), + }); + } + Ok(()) +'@ + New = @' + let _ = declared; + Ok(()) +'@ + } + @{ + Id = 'D2' + Rule = 'Rulings 14 and 18 on the wire: the daemon passes the declared instance to the mind as the client sent it.' + Test = 'daemon::tests::a_read_or_a_write_naming_another_instance_is_refused_by_the_mind_and_writes_nothing' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = @' + HuginnMindRequest::Admit(batch) => { + let outcome = self.mind.admit(batch, now); +'@ + New = @' + HuginnMindRequest::Admit(mut batch) => { + batch.instance = self.mind.instance().clone(); + let outcome = self.mind.admit(batch, now); +'@ + } + @{ + Id = 'D2L' + Rule = 'Every read that names an instance is checked, not only the one that returns a page.' + Test = 'daemon::tests::a_read_or_a_write_naming_another_instance_is_refused_by_the_mind_and_writes_nothing' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = ' && !matches!(request, HuginnMindRequest::Admit(_))' + New = ' && matches!(request, HuginnMindRequest::Query { .. })' + } + @{ + Id = 'D3' + Rule = 'A refusal is data in the response, never a transport failure the client must parse out of a failure envelope.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + let response = daemon.handle(request, now); + match encode_response(&message_id, operation, &response, &runtime_id) { +'@ + New = @' + let response = daemon.handle(request, now); + if let huginn_mind::wire::HuginnMindResponse::Refused(refusal) = &response { + return encode_failure( + &message_id, + operation, + &crate::envelope::OperationFailure { + code: "refused".into(), + message: format!("{refusal}"), + }, + &runtime_id, + ); + } + match encode_response(&message_id, operation, &response, &runtime_id) { +'@ + } + @{ + Id = 'D3L' + Rule = 'The envelope''s status is derived from the response, so a refusal cannot go out as an acceptance.' + Test = 'wire::tests::the_wire_vocabulary_is_the_minds_methods_and_status_is_derived_from_the_response' + Command = 'cargo test -p huginn-mind --lib' + File = 'crates/huginn-mind/src/wire.rs' + Old = ' Self::Refused(_) | Self::Admit(PipelineAdmissionOutcome::Refused(_)) => "rejected",' + New = ' Self::Admit(PipelineAdmissionOutcome::Refused(_)) => "rejected",' + } + @{ + Id = 'D4' + Rule = 'An envelope the daemon cannot decode touches no mind; it is answered with its own failure code.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/envelope.rs' + Old = @' + let request: HuginnMindRequest = rmp_serde::from_slice(&bytes) + .map_err(|error| OperationFailure::new("payload-not-a-request", error.to_string()))?; +'@ + New = @' + let request: HuginnMindRequest = rmp_serde::from_slice(&bytes).unwrap_or(HuginnMindRequest::Whoami); +'@ + } + @{ + Id = 'D4L' + Rule = 'The envelope is addressed to this service, and a request for another one is refused rather than served.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/envelope.rs' + Old = @' + if service_id != MIND_SERVICE_ID { + return Err(OperationFailure::new("wrong-service", format!("{service_id} is not {MIND_SERVICE_ID}"))); + } +'@ + New = @' + let _ = service_id; +'@ + } + @{ + Id = 'D5' + Rule = 'The envelope''s operation string is checked against the decoded payload, never trusted.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/envelope.rs' + Old = @' + if operation != request.operation() { + return Err(OperationFailure::new( + "operation-mismatch", + format!("the envelope says {operation} and the payload is {}", request.operation()), + )); + } +'@ + New = @' + let _ = operation; +'@ + } + @{ + Id = 'D5L' + Rule = 'The operation is checked as the name it is, not as a shape that happens to match.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/envelope.rs' + Old = ' if operation != request.operation() {' + New = ' if operation.len() != request.operation().len() {' + } + @{ + Id = 'D6' + Rule = 'The index never decides an outcome: a sink that fails does not refuse a batch the mind admitted.' + Test = 'daemon::tests::the_index_is_handed_every_landed_write_after_commit_and_never_decides_the_outcome' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = @' + let refs = writes.iter().map(|write| write.id.0.clone()).collect::>().join(", "); + eprintln!("huginn: the index refused the landed writes [{refs}]: {error:#}"); +'@ + New = @' + return HuginnMindResponse::Admit(PipelineAdmissionOutcome::Refused( + huginn_mind::MindRefusal::Unavailable { detail: format!("{error:#}") }, + )); +'@ + } + @{ + Id = 'D6L' + Rule = 'The index does not change the answer either: the outcome is the mind''s, whatever the sink did with it.' + Test = 'daemon::tests::the_index_is_handed_every_landed_write_after_commit_and_never_decides_the_outcome' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = @' + let refs = writes.iter().map(|write| write.id.0.clone()).collect::>().join(", "); + eprintln!("huginn: the index refused the landed writes [{refs}]: {error:#}"); +'@ + New = @' + return HuginnMindResponse::Admit(PipelineAdmissionOutcome::AlreadyAdmitted { + receipt_id: format!("index-unavailable: {error:#}"), + }); +'@ + } + @{ + Id = 'D7' + Rule = 'The index is handed every landed write.' + Test = 'daemon::tests::the_index_is_handed_every_landed_write_after_commit_and_never_decides_the_outcome' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = ' && let Err(error) = self.index.committed(&self.mind, writes)' + New = ' && let Err(error) = self.index.committed(&self.mind, &[])' + } + @{ + Id = 'D7L' + Rule = 'Derived writes are landed writes: a ruling that answers a question hands the index two documents, not one.' + Test = 'daemon::tests::the_index_is_handed_every_landed_write_after_commit_and_never_decides_the_outcome' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = ' && let Err(error) = self.index.committed(&self.mind, writes)' + New = ' && let Err(error) = self.index.committed(&self.mind, &writes[..1])' + } + @{ + Id = 'D8' + Rule = 'Each reply goes to the session its request arrived on.' + Test = 'serve::tests::two_clients_get_their_own_replies_over_loopback' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + let reply = answer(daemon, registry, message, Utc::now()); + if let Err(error) = hub.send_schema_message(&session, &reply) { +'@ + New = @' + let reply = answer(daemon, registry, message, Utc::now()); + let session = hub.sessions().into_iter().next().unwrap_or(session); + if let Err(error) = hub.send_schema_message(&session, &reply) { +'@ + } + @{ + Id = 'D8L' + Rule = 'A reply goes to one session, not to everyone connected: another peer''s answer is not this peer''s to read.' + Test = 'serve::tests::two_clients_get_their_own_replies_over_loopback' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + if let Err(error) = hub.send_schema_message(&session, &reply) { + eprintln!("huginn: {} did not receive its reply: {error:#}", session.remote_addr); + } +'@ + New = @' + for session in hub.sessions() { + if let Err(error) = hub.send_schema_message(&session, &reply) { + eprintln!("huginn: {} did not receive its reply: {error:#}", session.remote_addr); + } + } +'@ + } + @{ + Id = 'D9' + Rule = 'The hub serves CultNet''s operation connection id and no other, so a peer speaking another protocol on the port never becomes a session.' + Test = 'serve::tests::two_clients_get_their_own_replies_over_loopback' + File = 'crates/huginn-daemon/src/serve.rs' + Old = ' let mut options = CultNetRudpServerHubOptions::new(runtime_id, socket, CULTNET_OPERATION_CONNECTION_ID);' + New = ' let mut options = CultNetRudpServerHubOptions::new(runtime_id, socket, 0x4355_4c55);' + } + @{ + Id = 'D10' + Rule = '`whoami` is derived from the mind: `documents` counts pipeline documents, not every row the store holds.' + Test = 'daemon::tests::a_batch_round_trips_typed_through_handle_without_a_socket' + File = 'crates/huginn-mind/src/wire.rs' + Old = @' + } else if PipelineKind::ALL.iter().any(|kind| kind.type_id() == envelope.r#type) { + documents += 1; + } +'@ + New = @' + } else { + documents += 1; + } +'@ + } + @{ + Id = 'D10L' + Rule = 'A mind says how many receipts it holds, so a reader can tell a mind that has admitted from one that has not.' + Test = 'daemon::tests::a_batch_round_trips_typed_through_handle_without_a_socket' + File = 'crates/huginn-mind/src/wire.rs' + Old = @' + if envelope.r#type == HuginnCommitReceipt::TYPE { + receipts += 1; +'@ + New = @' + if envelope.r#type == HuginnCommitReceipt::TYPE { + receipts += 0; +'@ + } + @{ + Id = 'D11' + Rule = 'Ruling 15: a mind that will not open is refused, and no other mind is opened in its place.' + Test = 'daemon::tests::the_daemon_refuses_loudly_when_it_cannot_open_the_mind_and_binds_nothing' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = ' Ok(Self { mind: Mind::open(state_root, instance)?, index: NoIndex })' + New = @' + let mind = match Mind::open(state_root, instance) { + Ok(mind) => mind, + Err(_) => Mind::open(&state_root.join("fallback"), instance)?, + }; + Ok(Self { mind, index: NoIndex }) +'@ + } + @{ + Id = 'D11L' + Rule = 'Every refusal of the opener is a refusal to serve, not only the held lock: a store naming another instance is not this daemon''s to open.' + Test = 'daemon::tests::the_daemon_refuses_loudly_when_it_cannot_open_the_mind_and_binds_nothing' + File = 'crates/huginn-daemon/src/daemon.rs' + Old = ' Ok(Self { mind: Mind::open(state_root, instance)?, index: NoIndex })' + New = @' + let mind = match Mind::open(state_root, instance) { + Ok(mind) => mind, + Err(held @ MindRefusal::MindAlreadyOwned { .. }) => return Err(held), + Err(_) => Mind::open(&state_root.join("fallback"), instance)?, + }; + Ok(Self { mind, index: NoIndex }) +'@ + } + @{ + Id = 'D12' + Rule = 'Ruling 15 as an order: the mind opens before anything binds, so a refused mind is reported as a refused mind and no socket is ever taken.' + Test = 'serve::tests::startup_opens_the_mind_before_it_binds_anything' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + let daemon = Daemon::open(&options.state_root, &options.instance)?; + let hub = bind(options.bind, &daemon.runtime_id())?; +'@ + New = @' + let hub = bind(options.bind, "huginn")?; + let daemon = Daemon::open(&options.state_root, &options.instance)?; +'@ + } + @{ + Id = 'D12L' + Rule = 'Tidying up afterwards is not the order: a socket taken before the mind opened was still taken, and the refusal still comes back as the port''s rather than the mind''s.' + Test = 'serve::tests::startup_opens_the_mind_before_it_binds_anything' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + let daemon = Daemon::open(&options.state_root, &options.instance)?; + let hub = bind(options.bind, &daemon.runtime_id())?; +'@ + New = @' + let hub = bind(options.bind, "huginn")?; + let daemon = match Daemon::open(&options.state_root, &options.instance) { + Ok(daemon) => daemon, + Err(refusal) => { + drop(hub); + return Err(refusal.into()); + } + }; + let hub = bind(options.bind, &daemon.runtime_id())?; +'@ + } + @{ + Id = 'D13' + Rule = 'The wire vocabulary is the mind''s methods: one operation name per method, and it is that method''s name.' + Test = 'wire::tests::the_wire_vocabulary_is_the_minds_methods_and_status_is_derived_from_the_response' + Command = 'cargo test -p huginn-mind --lib' + File = 'crates/huginn-mind/src/wire.rs' + Old = ' Self::History { .. } => "history",' + New = ' Self::History { .. } => "query",' + } + @{ + Id = 'D13L' + Rule = 'The operation name is the method''s spelling, so a client reading `Mind`''s surface can address it without a translation table.' + Test = 'wire::tests::the_wire_vocabulary_is_the_minds_methods_and_status_is_derived_from_the_response' + Command = 'cargo test -p huginn-mind --lib' + File = 'crates/huginn-mind/src/wire.rs' + Old = ' Self::OpenItems { .. } => "open_items",' + New = ' Self::OpenItems { .. } => "openItems",' + } + @{ + Id = 'D14' + Rule = 'The published request schema equals its derivation, byte for byte.' + Test = 'wire::tests::published_wire_schemas_match_derivation' + Command = 'cargo test -p huginn-mind --lib' + File = 'schemas/cultnet/huginn.mind_request.v1.schema.json' + Old = ' "title": "HuginnMindRequest",' + New = ' "title": "HuginnMindRequest",' + } + @{ + Id = 'D14L' + Rule = 'Both files are pinned, not one: the response schema is derived too, and a hand edit to it is the same drift.' + Test = 'wire::tests::published_wire_schemas_match_derivation' + Command = 'cargo test -p huginn-mind --lib' + File = 'schemas/cultnet/huginn.mind_response.v1.schema.json' + Old = ' "title": "HuginnMindResponse",' + New = ' "title": "HuginnMindResponse v1",' + } + @{ + Id = 'D15' + Rule = 'A replay is an answer, not a rejection: `AlreadyAdmitted` tells a client its batch is in the mind already.' + Test = 'envelope::tests::a_refusal_is_a_typed_response_not_a_transport_failure' + File = 'crates/huginn-mind/src/wire.rs' + Old = ' Self::Refused(_) | Self::Admit(PipelineAdmissionOutcome::Refused(_)) => "rejected",' + New = @' + Self::Refused(_) + | Self::Admit(PipelineAdmissionOutcome::Refused(_)) + | Self::Admit(PipelineAdmissionOutcome::AlreadyAdmitted { .. }) => "rejected", +'@ + } + @{ + Id = 'D15L' + Rule = 'A conflict is an answer too: it names the identities that collided, which a rejection would throw away.' + Test = 'envelope::tests::a_refusal_is_a_typed_response_not_a_transport_failure' + File = 'crates/huginn-mind/src/wire.rs' + Old = ' Self::Refused(_) | Self::Admit(PipelineAdmissionOutcome::Refused(_)) => "rejected",' + New = @' + Self::Refused(_) + | Self::Admit(PipelineAdmissionOutcome::Refused(_)) + | Self::Admit(PipelineAdmissionOutcome::Conflict { .. }) => "rejected", +'@ + } + @{ + Id = 'D16' + Rule = 'A message of another family is answered, not dropped: CultNet refuses an empty error string, so a silent arm hangs the client.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + _ => CultNetMessage::Error { + error: format!( + "{MIND_SERVICE_ID} answers cultnet.operation_request.v0 and cultnet.schema_catalog_request.v0" + ), + }, +'@ + New = @' + _ => CultNetMessage::Error { error: String::new() }, +'@ + } + @{ + Id = 'D16L' + Rule = 'The answer names both messages the service accepts, so a client that guessed wrong learns what to send.' + Test = 'serve::tests::a_malformed_envelope_is_answered_with_a_failure_and_touches_no_mind' + File = 'crates/huginn-daemon/src/serve.rs' + Old = @' + _ => CultNetMessage::Error { + error: format!( + "{MIND_SERVICE_ID} answers cultnet.operation_request.v0 and cultnet.schema_catalog_request.v0" + ), + }, +'@ + New = @' + _ => CultNetMessage::Error { error: format!("{MIND_SERVICE_ID} answers cultnet.operation_request.v0") }, +'@ + } + ) +}