Pin the size gate for a second message_id length
F2: the boundary test always used message_id "m-0", so a gate that measures payload.len() + 231 -- exactly that id's fixed overhead -- passed unnoticed. message_id rides the encoded envelope and echoes the client's own value, so a longer id changes the overhead the gate must measure honestly. Parametrize synthetic/sized_exactly by message_id and add a second boundary test at a 40-byte id: 1,228,800 bytes still passes and 1,228,801 still refuses. Add mutation entry D20L6, the "+231" formula, which dies against the new test and survived the old one. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
4fb5742a7d
commit
7f60310039
2 changed files with 73 additions and 11 deletions
|
|
@ -358,6 +358,23 @@ pub fn require_grammatical_instance(declared: &Slug) -> Result<(), MindRefusal>
|
|||
CultNetMessage::OperationResponse { payload, .. } => payload.len() as u64,
|
||||
_ => bytes.len() as u64,
|
||||
},
|
||||
'@
|
||||
}
|
||||
@{
|
||||
Id = 'D20L6'
|
||||
Rule = 'What is measured holds for more than one envelope shape: a longer `message_id` changes the encoded envelope, so a formula that hard-codes one length''s overhead is wrong at another.'
|
||||
Test = 'serve::tests::the_gates_boundary_holds_for_a_second_message_id_length'
|
||||
File = 'crates/huginn-daemon/src/serve.rs'
|
||||
Old = @'
|
||||
let encoded = match encode_cultnet_message_to_vec(&reply, CultNetWireContract::CultNetSchemaV0) {
|
||||
Ok(bytes) => bytes.len() as u64,
|
||||
'@
|
||||
New = @'
|
||||
let encoded = match encode_cultnet_message_to_vec(&reply, CultNetWireContract::CultNetSchemaV0) {
|
||||
Ok(bytes) => match &reply {
|
||||
CultNetMessage::OperationResponse { payload, .. } => payload.len() as u64 + 231,
|
||||
_ => bytes.len() as u64,
|
||||
},
|
||||
'@
|
||||
}
|
||||
@{
|
||||
|
|
|
|||
Loading…
Reference in a new issue