@@ -570,6 +570,13 @@ def setUp(self) -> None:
570570 "tests/fixtures/codec_archive/preexisting.json" ,
571571 _codec_fixture ("preexisting" ),
572572 )
573+ candidate_failure = _codec_fixture ("candidate-failure" )
574+ candidate_failure ["value" ] = {"type" : "long" , "value" : 2 }
575+ candidate_failure ["framing" ]["wire_base64" ] = "BA=="
576+ self ._write_json (
577+ "tests/fixtures/codec_archive/candidate-failure.json" ,
578+ candidate_failure ,
579+ )
573580 self ._write_text (
574581 "src/durable_workflow/serializer.py" ,
575582 "def encode(value):\n return value\n " ,
@@ -590,7 +597,7 @@ def setUp(self) -> None:
590597source = (args.source_root / "src/durable_workflow/serializer.py").read_text()
591598if identity == "candidate-failure":
592599 raise SystemExit(1)
593- if identity == " unrelated":
600+ if identity in {"preexisting", " unrelated"} :
594601 raise SystemExit(0)
595602raise SystemExit(0 if "return str(value)" in source else 1)
596603""" ,
@@ -800,6 +807,50 @@ def test_selector_expansion_does_not_turn_existing_file_into_growth(self) -> Non
800807 ):
801808 self ._validate ()
802809
810+ def test_policy_only_selector_expansion_runs_candidate_binding (self ) -> None :
811+ self .policy ["categories" ]["codec" ]["fixtures" ].append (
812+ {
813+ "glob" : "tests/fixtures/codec_archive/preexisting.json" ,
814+ "format" : "codec-regression-v1" ,
815+ }
816+ )
817+ self ._write_json ("regression-corpus-policy.json" , self .policy )
818+
819+ result = self ._validate ()
820+
821+ self .assertEqual (result ["counts" ]["codec" ]["added" ], 0 )
822+ self .assertFalse (result ["counts" ]["codec" ]["related_change" ])
823+ self .assertEqual (result ["counts" ]["codec" ]["revision_verified" ], 1 )
824+
825+ def test_policy_only_selector_expansion_rejects_candidate_failure (self ) -> None :
826+ self .policy ["categories" ]["codec" ]["fixtures" ].append (
827+ {
828+ "glob" : "tests/fixtures/codec_archive/candidate-failure.json" ,
829+ "format" : "codec-regression-v1" ,
830+ }
831+ )
832+ self ._write_json ("regression-corpus-policy.json" , self .policy )
833+
834+ with self .assertRaisesRegex (
835+ VALIDATOR .CorpusError ,
836+ "does not pass on the candidate through the official Python binding" ,
837+ ):
838+ self ._validate ()
839+
840+ def test_rename_into_selected_path_rejects_candidate_failure (self ) -> None :
841+ source = "tests/fixtures/codec_archive/candidate-failure.json"
842+ destination = "tests/fixtures/codec_regressions/candidate-failure.json"
843+ self ._git ("mv" , source , destination )
844+
845+ changed , added = VALIDATOR ._changed_paths (self .root , "HEAD" )
846+ self .assertEqual (changed , {source , destination })
847+ self .assertEqual (added , set ())
848+ with self .assertRaisesRegex (
849+ VALIDATOR .CorpusError ,
850+ "does not pass on the candidate through the official Python binding" ,
851+ ):
852+ self ._validate ()
853+
803854 def test_guarded_change_accepts_counterfactual_evidence (self ) -> None :
804855 self ._write_text (
805856 "src/durable_workflow/serializer.py" ,
0 commit comments