From cb24bce6ce19ba5577f1addcd8175ef24fb0d11a Mon Sep 17 00:00:00 2001 From: xeonvs <11463419+xeonvs@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:37:30 +0100 Subject: [PATCH 1/6] Limit site notification triggers to release and recovery branches --- .github/workflows/site-release-notify.yml | 1 + tests/test_site_release_notify.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/site-release-notify.yml b/.github/workflows/site-release-notify.yml index 4c23003c..1b4374fa 100644 --- a/.github/workflows/site-release-notify.yml +++ b/.github/workflows/site-release-notify.yml @@ -3,6 +3,7 @@ name: Notify toolkit site of stable release on: workflow_run: workflows: [Release] + branches: ['release/v*', main] types: [completed] permissions: {} diff --git a/tests/test_site_release_notify.py b/tests/test_site_release_notify.py index f73bbfa4..abb9713c 100644 --- a/tests/test_site_release_notify.py +++ b/tests/test_site_release_notify.py @@ -22,7 +22,9 @@ def _verification_step() -> str: def test_site_dispatch_occurs_once_after_read_only_verification() -> None: - jobs = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))["jobs"] + workflow = yaml.load(WORKFLOW.read_text(encoding="utf-8"), Loader=yaml.BaseLoader) + assert set(workflow["on"]["workflow_run"]["branches"]) == {"release/v*", "main"} + jobs = workflow["jobs"] steps = jobs["notify"]["steps"] assert "--method POST" not in _verification_step() assert "OCR_SITE_DISPATCH_TOKEN" not in str(jobs["verify"]) From 35d672e294a4da128c51d0f0d494a906fa641afe Mon Sep 17 00:00:00 2001 From: xeonvs <11463419+xeonvs@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:39:15 +0100 Subject: [PATCH 2/6] Group scheduled runtime patch updates on dev --- .github/dependabot.yml | 4 ++++ docs/contributor-intake.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9bd2596a..2bd86943 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,6 +12,10 @@ updates: development-tooling: dependency-type: development patterns: ["*"] + runtime-patches: + applies-to: version-updates + dependency-type: production + update-types: [patch] labels: [dependencies, python] commit-message: prefix: deps diff --git a/docs/contributor-intake.md b/docs/contributor-intake.md index 7bc0490a..faf5654f 100644 --- a/docs/contributor-intake.md +++ b/docs/contributor-intake.md @@ -12,4 +12,4 @@ 2. Review the full diff at those revisions before approving fork CI. Check workflow and executable changes, dependency and lockfile sources, installation and container inputs, Action pins and OCR qualification integrity values. Review additions and removals and both paths of renames and copies. Confirm a human updater's maintainer role in GitHub's repository access settings. For Dependabot updates to `dev`, verify the configured bot account, repository-owned branch and GitHub-verified commits through the reviewed head. Treat labels and branch names as context. Have a maintainer prepare dependency changes requested by an outside contributor. [Dependency audit and upstream review](development.md#dependency-audit-before-push) 3. Mark the PR ready and verify the full applicable protected CI ran and passed for the live base and head. Repeat review and checks when either revision changes. The maintainer verifies the author, source, target and revisions immediately before manual merge. Require an independent approval and dismiss stale approvals when there are two eligible maintainers. With a sole maintainer, record the exact revision reviewed and retain protected PR checks for maintainer-authored work. Squash eligible fork changes into `dev` with contributor attribution. For a CLI squash merge, supply the reviewed head with `gh pr merge "$PR_NUMBER" --squash --match-head-commit "$REVIEWED_HEAD"`. Whenever current main is no longer an ancestor of dev, including after a squash promotion or stable release, create a maintainer sync branch at the current `dev` tip, merge current `main` into it with a signed merge, and open a PR back to `dev`. Use a merge commit to preserve ancestry. Check that the current `main` tip is an ancestor of `dev` before the next promotion. [GitHub CLI merge options](https://cli.github.com/manual/gh_pr_merge) -Dependabot's `target-branch: dev` applies to scheduled version updates. GitHub opens security update PRs against the default branch. Retarget those to `dev` for review or prepare the fix there on a maintainer branch. [Dependabot target-branch behavior](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference#target-branch) +Dependabot groups scheduled runtime patch updates into one PR to `dev`. Review the lockfile changes for each package. GitHub opens security update PRs against the default branch. Retarget those to `dev` for review or prepare the fix there on a maintainer branch. [Dependabot target-branch behavior](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference#target-branch) From 417a31b50e07ad17c3b3236c22162fb02cec95f4 Mon Sep 17 00:00:00 2001 From: xeonvs <11463419+xeonvs@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:40:34 +0100 Subject: [PATCH 3/6] Skip runners and isolate unrelated closures from the release queue --- .github/workflows/release.yml | 50 ++++++++++++++--------------- tests/test_release_authorization.py | 35 +++++++++++++++----- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cb9f5bb..e0a3de49 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,39 +31,39 @@ permissions: contents: read concurrency: - group: production-release + # Match authorize.if so skipped events cannot replace a pending release. + group: >- + ${{ + github.event.repository.private == false && + github.ref == 'refs/heads/main' && + (github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && + github.event.action == 'closed' && + github.event.pull_request.merged == true && + github.event.pull_request.base.repo.full_name == github.repository && + github.event.pull_request.base.ref == 'main' && + github.event.pull_request.head.repo.full_name == github.repository && + startsWith(github.event.pull_request.head.ref, 'release/v') && + startsWith(github.event.pull_request.title, 'Release v'))) && + 'production-release' || format('release-ignored-{0}', github.run_id) + }} cancel-in-progress: false jobs: - classify: - name: classify-release-trigger - runs-on: ubuntu-latest - timeout-minutes: 2 - outputs: - release: ${{ steps.classify.outputs.release }} - steps: - - id: classify - env: - EVENT_NAME: ${{ github.event_name }} - PR_MERGED: ${{ github.event.pull_request.merged }} - PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} - run: | - release=false - if [ "${EVENT_NAME}" = workflow_dispatch ]; then - release=true - elif [ "${PR_MERGED}" = true ] && [[ "${PR_HEAD_REF}" == release/v* ]]; then - release=true - fi - echo "release=${release}" >> "${GITHUB_OUTPUT}" - authorize: name: authorize-release - needs: classify if: >- github.event.repository.private == false && github.ref == 'refs/heads/main' && - (github.event_name == 'workflow_dispatch' || github.event.pull_request.head.repo.full_name == github.repository) && - needs.classify.outputs.release == 'true' + (github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && + github.event.action == 'closed' && + github.event.pull_request.merged == true && + github.event.pull_request.base.repo.full_name == github.repository && + github.event.pull_request.base.ref == 'main' && + github.event.pull_request.head.repo.full_name == github.repository && + startsWith(github.event.pull_request.head.ref, 'release/v') && + startsWith(github.event.pull_request.title, 'Release v'))) runs-on: ubuntu-latest timeout-minutes: 5 permissions: diff --git a/tests/test_release_authorization.py b/tests/test_release_authorization.py index 17f8d5d1..e56ebcc7 100644 --- a/tests/test_release_authorization.py +++ b/tests/test_release_authorization.py @@ -333,13 +333,31 @@ def test_required_check_and_ruleset_synchronization_are_exact() -> None: authorize(protection=protection) -def test_release_workflow_classifies_ordinary_merges_before_authorization() -> None: - workflow = WORKFLOW.read_text(encoding="utf-8") - - assert "name: classify-release-trigger" in workflow - assert '[[ "${PR_HEAD_REF}" == release/v* ]]' in workflow - assert "needs: classify" in workflow - assert "needs.classify.outputs.release == 'true'" in workflow +def test_release_workflow_guards_authorization_and_isolates_skipped_runs() -> None: + workflow = yaml.load(WORKFLOW.read_text(encoding="utf-8"), Loader=yaml.BaseLoader) + assert workflow["on"]["pull_request"] == {"types": ["closed"], "branches": ["main"]} + assert "workflow_dispatch" in workflow["on"] + jobs = workflow["jobs"] + assert {name for name, job in jobs.items() if "needs" not in job} == {"authorize"} + assert jobs["build"]["needs"] == "authorize" + assert jobs["build"]["if"] == "needs.authorize.outputs.approved == 'true'" + + gate = " ".join(jobs["authorize"]["if"].split()) + assert gate == ( + "github.event.repository.private == false && github.ref == 'refs/heads/main' && " + "(github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && " + "github.event.action == 'closed' && github.event.pull_request.merged == true && " + "github.event.pull_request.base.repo.full_name == github.repository && " + "github.event.pull_request.base.ref == 'main' && " + "github.event.pull_request.head.repo.full_name == github.repository && " + "startsWith(github.event.pull_request.head.ref, 'release/v') && " + "startsWith(github.event.pull_request.title, 'Release v')))" + ) + concurrency = workflow["concurrency"] + assert " ".join(concurrency["group"].split()) == ( + f"${{{{ {gate} && 'production-release' || format('release-ignored-{{0}}', github.run_id) }}}}" + ) + assert concurrency["cancel-in-progress"] == "false" @pytest.mark.parametrize( @@ -460,7 +478,8 @@ def test_release_workflow_keeps_strict_release_authorization() -> None: assert "--validate-issue-only" in workflow assert 'test "$(git rev-parse HEAD^{tree})" = "${EXPECTED_TREE}"' in workflow assert 'test "$(git rev-parse FETCH_HEAD^{tree})" = "${EXPECTED_TREE}"' in workflow - assert "github.event.pull_request.merged == true" not in workflow + assert '"repos/${REPOSITORY}/pulls/${PR_NUMBER}" /tmp/release-pr.json' in workflow + assert "--pr-json /tmp/release-pr.json" in workflow def test_bounded_github_helper_rejects_unknown_endpoints_and_writes_atomically( From 46176128aadbb5303f48d0570ab2ed89b1be54a9 Mon Sep 17 00:00:00 2001 From: xeonvs <11463419+xeonvs@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:40:34 +0100 Subject: [PATCH 4/6] Track repeat validation and CI queue costs for hosted testing --- docs/codex/TASKS_BACKLOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/codex/TASKS_BACKLOG.md b/docs/codex/TASKS_BACKLOG.md index 725b0cd5..018e79de 100644 --- a/docs/codex/TASKS_BACKLOG.md +++ b/docs/codex/TASKS_BACKLOG.md @@ -136,3 +136,13 @@ The [signal-ownership audit](../engineering/review_signal_ownership.md) remains - **Exclusions:** Learned online routing, per-tool models, multiple agents, or silent policy changes. - **Validation:** Offline replay, adversarial boundaries, fallback tests, and quality thresholds. - **Release classification expectation:** `release-required`. + +## Maintainer CI + +### BL-026: Avoid redundant PR validations without replacing required checks + +- **Status:** planned +- **Activation trigger:** A hosted test repository can reproduce this project's required Actions and CodeQL app checks on protected branches. +- **Evidence:** A description edit on #361 cancelled checks and started a second validation of the same synthetic merge commit. Two completed CI runs for Dependabot #348 and #349 used a combined 6,949 job-seconds around their automatic closure. In #363 the macOS Python 3.12 runner waited 14m40s before starting. [Original validation](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46740538729) · [Replacement validation](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46740601948) · [Release CI](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46746189464) +- **Next safe action:** Measure runner queue and execution time separately across releases. Finalize PR descriptions before marking a PR ready. For later status updates, use PR comments. Evaluate metadata-only edits and already-closed Dependabot work in an isolated hosted repository. +- **Acceptance:** An edit to the title or body alone neither cancels work on the same revision nor emits a passing or skipped required check in place of a pending or failed one. Recheck the exact head, base and test-merge revisions on retarget, synchronization, draft/ready transitions, or ambiguous events. Verify merge eligibility for forks and repository-owned PRs with the actual required app identities. Preserve independent platform, secret, provenance and registry-install checks. From f19accca0eb87a35fc9449bd9f3c4cf6ff92af11 Mon Sep 17 00:00:00 2001 From: xeonvs <11463419+xeonvs@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:45:46 +0100 Subject: [PATCH 5/6] Record upcoming CI and maintenance changes --- changelog.d/364.maintenance.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/364.maintenance.md diff --git a/changelog.d/364.maintenance.md b/changelog.d/364.maintenance.md new file mode 100644 index 00000000..4ddc03ce --- /dev/null +++ b/changelog.d/364.maintenance.md @@ -0,0 +1 @@ +Skip release authorization runners for ordinary PR closures, limit site notifications to release and recovery branches, and group scheduled runtime patch updates to dev. From e7fd650dacd049bf0c3f2e1ed7bf6d9c2cfcd3d3 Mon Sep 17 00:00:00 2001 From: xeonvs <11463419+xeonvs@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:47:54 +0100 Subject: [PATCH 6/6] Reconcile superseded bot proposals before moving the protected base --- docs/codex/TASKS_BACKLOG.md | 2 +- docs/contributor-intake.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/codex/TASKS_BACKLOG.md b/docs/codex/TASKS_BACKLOG.md index 018e79de..7f71e16c 100644 --- a/docs/codex/TASKS_BACKLOG.md +++ b/docs/codex/TASKS_BACKLOG.md @@ -143,6 +143,6 @@ The [signal-ownership audit](../engineering/review_signal_ownership.md) remains - **Status:** planned - **Activation trigger:** A hosted test repository can reproduce this project's required Actions and CodeQL app checks on protected branches. -- **Evidence:** A description edit on #361 cancelled checks and started a second validation of the same synthetic merge commit. Two completed CI runs for Dependabot #348 and #349 used a combined 6,949 job-seconds around their automatic closure. In #363 the macOS Python 3.12 runner waited 14m40s before starting. [Original validation](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46740538729) · [Replacement validation](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46740601948) · [Release CI](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46746189464) +- **Evidence:** A description edit on #361 cancelled checks and started a second validation of the same synthetic merge commit. During promotion, eight CI runs on Dependabot #346–349 used a combined 13,122 job-seconds on allocated runners. Four runs were created shortly after automatic closure and ran 22 test jobs to success. In #363 the macOS Python 3.12 runner waited 14m40s before starting. [Original validation](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46740538729) · [Replacement validation](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46740601948) · [Release CI](https://github.com/xeonvs/open-code-review-toolkit/actions/runs/46746189464) - **Next safe action:** Measure runner queue and execution time separately across releases. Finalize PR descriptions before marking a PR ready. For later status updates, use PR comments. Evaluate metadata-only edits and already-closed Dependabot work in an isolated hosted repository. - **Acceptance:** An edit to the title or body alone neither cancels work on the same revision nor emits a passing or skipped required check in place of a pending or failed one. Recheck the exact head, base and test-merge revisions on retarget, synchronization, draft/ready transitions, or ambiguous events. Verify merge eligibility for forks and repository-owned PRs with the actual required app identities. Preserve independent platform, secret, provenance and registry-install checks. diff --git a/docs/contributor-intake.md b/docs/contributor-intake.md index faf5654f..e7a414d0 100644 --- a/docs/contributor-intake.md +++ b/docs/contributor-intake.md @@ -13,3 +13,15 @@ 3. Mark the PR ready and verify the full applicable protected CI ran and passed for the live base and head. Repeat review and checks when either revision changes. The maintainer verifies the author, source, target and revisions immediately before manual merge. Require an independent approval and dismiss stale approvals when there are two eligible maintainers. With a sole maintainer, record the exact revision reviewed and retain protected PR checks for maintainer-authored work. Squash eligible fork changes into `dev` with contributor attribution. For a CLI squash merge, supply the reviewed head with `gh pr merge "$PR_NUMBER" --squash --match-head-commit "$REVIEWED_HEAD"`. Whenever current main is no longer an ancestor of dev, including after a squash promotion or stable release, create a maintainer sync branch at the current `dev` tip, merge current `main` into it with a signed merge, and open a PR back to `dev`. Use a merge commit to preserve ancestry. Check that the current `main` tip is an ancestor of `dev` before the next promotion. [GitHub CLI merge options](https://cli.github.com/manual/gh_pr_merge) Dependabot groups scheduled runtime patch updates into one PR to `dev`. Review the lockfile changes for each package. GitHub opens security update PRs against the default branch. Retarget those to `dev` for review or prepare the fix there on a maintainer branch. [Dependabot target-branch behavior](https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference#target-branch) + +### Reconcile superseded Dependabot PRs before promotion + +Before merging a protected development promotion, list open Dependabot PRs targeting its base. This covers older version-update PRs that still target `main`. + +```sh +gh pr list --state open --base main --author app/dependabot --json number,title,headRefName,headRefOid +``` + +For a scheduled version update already incorporated in the reviewed promotion, compare the complete proposed dependency and lockfile or Action-pin diff, including transitive changes. If every change is accounted for, record the promotion PR and close the superseded bot PR before moving the base. Keep outstanding changes and security updates open until the target contains their fix. + +Check for queued or in-progress PR runs on the bot branch after closure. A queued event can create a run after the PR closes. Before cancelling an individual run, re-read the PR state and verify its closed, unmerged head, source repository and branch against the run. Limit cancellation to superseded pull-request validation runs in the same repository and confirm no open PR still uses that branch and revision. Use the run ID for cancellation and read back its terminal state. Ordinary dependency PRs continue through the usual required checks.