Skip to content

Commit 60acee3

Browse files
authored
Require the closing-choice check on integration (#211)
## What changed Declares `closing-choice` as a required check on `protect-integration`, the last step of the roadmap rollout order. `CLOSING_CHOICE_SINCE` is set to 2026-10-05, so pull requests opened before that date pass with a notice. ## Which issue does this implement None. Scoped in `design/2026-10-04-roadmap-rollout-design.md`. ## Base branch - [x] `integration`, because this touches tests, tooling, and CI ## Type of change - [x] Tooling or CI ## I tested this - [x] `uv run pytest -q`: 899 passed, 1 skipped Signed-off-by: Rock Lambros <rock@rockcyber.com>
1 parent b033c72 commit 60acee3

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎tests/test_apply_governance.py‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

901903
def 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))

‎tools/apply_governance.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,15 @@ def desired_rulesets() -> list[Ruleset]:
523523
protect-integration allows squash merges only. A rebase merge lands every commit
524524
message of the branch, and any of them can close an issue past the closing-choice
525525
check, which reads the pull request description only.
526+
protect-integration also requires `closing-choice`, from the Order's step 3, once a
527+
project lead has set CLOSING_CHOICE_SINCE. Before that date the check passes every pull
528+
request with a notice, so requiring it blocks nothing that was open.
526529
"""
527530
return [
528531
Ruleset(
529532
name="protect-integration",
530533
target_ref="refs/heads/integration",
534+
required_status_checks=("test", "build", "closing-choice"),
531535
allowed_merge_methods=("squash",),
532536
),
533537
Ruleset(name="protect-release", target_ref="refs/heads/release/*"),

0 commit comments

Comments
 (0)