@@ -222,8 +222,10 @@ def test_desired_rulesets_are_protect_integration_and_protect_release():
222222 assert ruleset .dismiss_stale_reviews_on_push is True
223223 assert ruleset .require_last_push_approval is True
224224 assert ruleset .required_review_thread_resolution is True
225- assert ruleset .required_status_checks == ("test" , "build" )
226225 assert ruleset .check_integration_id == 15368
226+ # Order step 3: closing-choice is required on integration only.
227+ assert rulesets ["protect-integration" ].required_status_checks == ("test" , "build" , "closing-choice" )
228+ assert rulesets ["protect-release" ].required_status_checks == ("test" , "build" )
227229 # Rollout package E: a rebase merge lands every branch commit message, and any of them
228230 # can close an issue, so integration takes squash merges only.
229231 assert rulesets ["protect-integration" ].allowed_merge_methods == ("squash" ,)
@@ -832,7 +834,7 @@ def test_update_payload_keeps_every_live_field_it_does_not_model():
832834 assert pull_request ["allowed_merge_methods" ] == ["squash" ]
833835 checks = next (r for r in payload ["rules" ] if r ["type" ] == "required_status_checks" )["parameters" ]
834836 assert checks ["required_status_checks" ] == [
835- {"context" : "test" , "integration_id" : 15368 }, { "context" : "build" , "integration_id" : 15368 },
837+ {"context" : check , "integration_id" : 15368 } for check in integration . required_status_checks
836838 ]
837839 assert [r ["type" ] for r in payload ["rules" ]] == ["deletion" , "non_fast_forward" , "pull_request" , "required_status_checks" ]
838840 for key in ("id" , "node_id" , "source" , "source_type" , "created_at" , "updated_at" , "current_user_can_bypass" ):
@@ -845,7 +847,7 @@ def test_a_ruleset_matching_live_state_with_app_ids_is_left_alone():
845847 fixed = json .loads (json .dumps (LIVE_PROTECT_INTEGRATION ))
846848 fixed ["rules" ][2 ]["parameters" ]["allowed_merge_methods" ] = ["squash" ]
847849 fixed ["rules" ][3 ]["parameters" ]["required_status_checks" ] = [
848- {"context" : "test" , "integration_id" : 15368 }, { "context" : "build" , "integration_id" : 15368 },
850+ {"context" : check , "integration_id" : 15368 } for check in integration . required_status_checks
849851 ]
850852 assert plan_ruleset_actions ([_normalized (fixed )], (integration ,)) == []
851853 fixed ["rules" ][3 ]["parameters" ]["required_status_checks" ][1 ]["integration_id" ] = 999
@@ -900,9 +902,9 @@ def no_checkout():
900902
901903def test_removed_required_checks_lists_live_checks_the_declaration_drops ():
902904 from apply_governance import Ruleset , removed_required_checks
903- live = [{"name" : "protect-integration" , "required_status_checks" : ("test" , "build" , "closing-choice " )}]
905+ live = [{"name" : "protect-integration" , "required_status_checks" : ("test" , "build" , "hand-added " )}]
904906 desired = (Ruleset (name = "protect-integration" , target_ref = "refs/heads/integration" ),)
905- assert removed_required_checks (live , desired ) == [("protect-integration" , "closing-choice " )]
907+ assert removed_required_checks (live , desired ) == [("protect-integration" , "hand-added " )]
906908 assert removed_required_checks ([{"name" : "protect-integration" , "required_status_checks" : ("test" , "build" )}], desired ) == []
907909 assert removed_required_checks ([], desired ) == []
908910
@@ -913,12 +915,12 @@ def test_main_refuses_to_drop_a_live_required_check_without_the_flag(monkeypatch
913915 tip = "a" * 40
914916 monkeypatch .setattr (apply_governance , "_checkout_state" , lambda : ("" , tip , tip ))
915917 monkeypatch .setattr (apply_governance , "fetch_live_state" , lambda : {"rulesets" : [
916- {"name" : "protect-integration" , "required_status_checks" : ("test" , "build" , "closing-choice" )},
918+ {"name" : "protect-integration" , "required_status_checks" : ("test" , "build" , "closing-choice" , "hand-added" )},
917919 ]})
918920 monkeypatch .setattr (apply_governance , "collect_actions" , lambda live , only = None : [apply_governance .Action ("rulesets" , "Update ruleset" , ("true" ,))])
919921 assert main (["--only" , "rulesets" , "--apply" ]) == 2
920922 err = capsys .readouterr ().err
921- assert "closing-choice " in err and "--allow-ruleset-reduction" in err
923+ assert "hand-added " in err and "--allow-ruleset-reduction" in err
922924
923925 ran = []
924926 monkeypatch .setattr (apply_governance , "run_action" , lambda action : ran .append (action ))
0 commit comments