@@ -208,11 +208,6 @@ def compiled_payload_single_target(
208208 "a compiled payload whose serialised size exceeds MAX_PAYLOAD_SIZE by at least a factor of 2"
209209)
210210def compiled_large_payload (context ):
211- # Each target serialises to ~450 bytes with the canonical signature_target
212- # shape (`agent`/`asset`/`asset_group`) and the 140-char hostname below.
213- # Budget chosen so a single target fits but two don't, producing 6 chunks
214- # of one target each. Total payload (~2.7 KiB) exceeds max_payload_size
215- # (700 B) by ~4x, satisfying the feature's "at least factor of 2" wording.
216211 context ["signature_manager" ] = SignatureManager (
217212 context ["mock_client" ],
218213 logger = context ["logger" ],
@@ -321,8 +316,6 @@ def compiled_payload_grouped_by_expectation(
321316 expectation_a ,
322317 expectation_b ,
323318):
324- # Feed FLAT form (mixed expectation_types in a single signature_values list).
325- # SignatureManager must regroup it into the canonical wire schema.
326319 context ["signatures" ] = {
327320 "targets" : [
328321 {
@@ -395,7 +388,7 @@ def assert_post_request_sent_to_callback(context, inject_id):
395388@then ("the POST request body contains signatures.targets as a list" )
396389def assert_targets_is_list (context ):
397390 body = context ["captured_calls" ][- 1 ]["post_data" ]
398- assert isinstance (body ["signatures " ]["targets" ], list )
391+ assert isinstance (body ["expectation_signature " ]["targets" ], list )
399392
400393
401394@then (
@@ -405,7 +398,7 @@ def assert_targets_is_list(context):
405398)
406399def assert_expectation_type (context , expected_value ):
407400 body = context ["captured_calls" ][- 1 ]["post_data" ]
408- assert body ["signatures " ]["targets" ][0 ]["signature_values" ][0 ][
401+ assert body ["expectation_signature " ]["targets" ][0 ]["signature_values" ][0 ][
409402 "expectation_type"
410403 ] == (expected_value )
411404
@@ -418,7 +411,7 @@ def assert_expectation_type(context, expected_value):
418411def assert_signature_type (context , expected_value ):
419412 body = context ["captured_calls" ][- 1 ]["post_data" ]
420413 assert (
421- body ["signatures " ]["targets" ][0 ]["signature_values" ][0 ]["values" ][0 ][
414+ body ["expectation_signature " ]["targets" ][0 ]["signature_values" ][0 ]["values" ][0 ][
422415 "signature_type"
423416 ]
424417 == expected_value
@@ -433,7 +426,7 @@ def assert_signature_type(context, expected_value):
433426def assert_signature_value (context , expected_value ):
434427 body = context ["captured_calls" ][- 1 ]["post_data" ]
435428 assert (
436- body ["signatures " ]["targets" ][0 ]["signature_values" ][0 ]["values" ][0 ][
429+ body ["expectation_signature " ]["targets" ][0 ]["signature_values" ][0 ]["values" ][0 ][
437430 "signature_value"
438431 ]
439432 == expected_value
@@ -443,7 +436,7 @@ def assert_signature_value(context, expected_value):
443436@then ("signatures.targets[0] contains a signature_target key" )
444437def assert_signature_target_key (context ):
445438 body = context ["captured_calls" ][- 1 ]["post_data" ]
446- assert "signature_target" in body ["signatures " ]["targets" ][0 ]
439+ assert "signature_target" in body ["expectation_signature " ]["targets" ][0 ]
447440
448441
449442@then (
@@ -484,7 +477,7 @@ def assert_total_chunks_present(context):
484477 'each POST request body contains only "signatures", "chunk_index" and "total_chunks" at the top level'
485478)
486479def assert_chunked_envelope_is_strict (context ):
487- expected_keys = {"signatures " , "chunk_index" , "total_chunks" , "phase" }
480+ expected_keys = {"expectation_signature " , "chunk_index" , "total_chunks" , "phase" }
488481 for call_item in context ["captured_calls" ]:
489482 post_data = call_item ["post_data" ]
490483 assert set (post_data .keys ()) == expected_keys , (
@@ -499,13 +492,12 @@ def assert_targets_union_matches_original(context):
499492 sent_targets = [
500493 target
501494 for call_item in context ["captured_calls" ]
502- for target in call_item ["post_data" ]["signatures " ]["targets" ]
495+ for target in call_item ["post_data" ]["expectation_signature " ]["targets" ]
503496 ]
504497 assert len (sent_targets ) == len (original_targets ), (
505498 f"Expected { len (original_targets )} targets across all chunks, "
506499 f"got { len (sent_targets )} "
507500 )
508- # signature_target identifiers must match one-to-one (order-preserved).
509501 for original , sent in zip (original_targets , sent_targets ):
510502 assert sent ["signature_target" ] == original ["signature_target" ]
511503
@@ -622,7 +614,7 @@ def assert_no_exception_from_resolve_container_ip(context):
622614)
623615def assert_signature_values_nested_by_expectation_type (context ):
624616 body = context ["captured_calls" ][- 1 ]["post_data" ]
625- entries = body ["signatures " ]["targets" ][0 ]["signature_values" ]
617+ entries = body ["expectation_signature " ]["targets" ][0 ]["signature_values" ]
626618 expectation_types = {entry ["expectation_type" ] for entry in entries }
627619 assert expectation_types == {"DETECTION" , "PREVENTION" }
628620
@@ -632,14 +624,12 @@ def assert_signature_values_nested_by_expectation_type(context):
632624)
633625def assert_detection_values_grouped_correctly (context ):
634626 body = context ["captured_calls" ][- 1 ]["post_data" ]
635- entries = body ["signatures " ]["targets" ][0 ]["signature_values" ]
627+ entries = body ["expectation_signature " ]["targets" ][0 ]["signature_values" ]
636628 detection_entry = next (
637629 entry for entry in entries if entry ["expectation_type" ] == "DETECTION"
638630 )
639- # Two DETECTION items were fed in flat form; both must be grouped here.
640631 detection_values = {value ["signature_value" ] for value in detection_entry ["values" ]}
641632 assert detection_values == {"203.0.113.5" , "host-a.internal" }
642- # No PREVENTION value should have leaked into the DETECTION group.
643633 assert "198.51.100.10" not in detection_values
644634
645635
@@ -648,14 +638,13 @@ def assert_detection_values_grouped_correctly(context):
648638)
649639def assert_prevention_values_grouped_correctly (context ):
650640 body = context ["captured_calls" ][- 1 ]["post_data" ]
651- entries = body ["signatures " ]["targets" ][0 ]["signature_values" ]
641+ entries = body ["expectation_signature " ]["targets" ][0 ]["signature_values" ]
652642 prevention_entry = next (
653643 entry for entry in entries if entry ["expectation_type" ] == "PREVENTION"
654644 )
655645 prevention_values = {
656646 value ["signature_value" ] for value in prevention_entry ["values" ]
657647 }
658648 assert prevention_values == {"198.51.100.10" }
659- # No DETECTION value should have leaked into the PREVENTION group.
660649 assert "203.0.113.5" not in prevention_values
661650 assert "host-a.internal" not in prevention_values
0 commit comments