From d42bccf7c4e3fddf342a227d2c867e35da1560e4 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 13:00:09 +0900 Subject: [PATCH 1/5] fix(actions): avoid inactive PR runs --- .github/workflows/ontology-pages.yml | 4 ++-- .github/workflows/prov-o-contract.yml | 4 ++-- .github/workflows/tests.yml | 9 +++------ tests/test_tests_workflow_contract.py | 10 +++++----- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ontology-pages.yml b/.github/workflows/ontology-pages.yml index 383600baa..f1f64bfab 100644 --- a/.github/workflows/ontology-pages.yml +++ b/.github/workflows/ontology-pages.yml @@ -2,7 +2,7 @@ name: Ontology Pages on: pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] + types: [opened, synchronize, reopened, ready_for_review] branches: [main] paths: - "docs/index.html" @@ -44,7 +44,7 @@ concurrency: jobs: validate: name: Validate ontology publication - if: github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.draft == false + if: github.event_name == 'pull_request' && github.event.pull_request.draft == false runs-on: ubuntu-24.04 steps: - name: Checkout repository diff --git a/.github/workflows/prov-o-contract.yml b/.github/workflows/prov-o-contract.yml index 008f73405..aa63b2284 100644 --- a/.github/workflows/prov-o-contract.yml +++ b/.github/workflows/prov-o-contract.yml @@ -2,7 +2,7 @@ name: PROV-O contract on: pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] + types: [opened, synchronize, reopened, ready_for_review] branches: [main] paths: - "lineageweave/prov_o.py" @@ -35,7 +35,7 @@ concurrency: jobs: standards-contract: name: Registry, inference, coverage, PostgreSQL - if: github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false runs-on: ubuntu-24.04 services: postgres: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b82226a7e..26a649079 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,22 +4,19 @@ on: push: branches: [main] pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] + types: [opened, synchronize, reopened, ready_for_review] permissions: contents: read concurrency: - # A merged pull request can report the base ref on ``closed``. Keying PR - # events by number lets that close run cancel an older queued synchronize - # run for the same PR instead of consuming runners after the PR is closed. group: ${{ github.workflow }}-${{ github.repository }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: pytest: name: Full test suite - if: github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false runs-on: ubuntu-24.04 services: postgres: @@ -65,7 +62,7 @@ jobs: frontend: name: Frontend lint, test, build - if: github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false runs-on: ubuntu-24.04 steps: - name: Checkout repository diff --git a/tests/test_tests_workflow_contract.py b/tests/test_tests_workflow_contract.py index b0953f6f9..b8698591d 100644 --- a/tests/test_tests_workflow_contract.py +++ b/tests/test_tests_workflow_contract.py @@ -13,19 +13,19 @@ "cancel-in-progress: ${{ github.event_name == 'pull_request' }}" ) _PULL_REQUEST_TYPES = ( - "types: [opened, synchronize, reopened, ready_for_review, " - "converted_to_draft, closed]" + "types: [opened, synchronize, reopened, ready_for_review]" ) _DRAFT_ADMISSION = "github.event.pull_request.draft == false" -def test_pull_request_concurrency_survives_closed_ref_change() -> None: - """Key synchronize and closed events by PR number so close cancels stale work.""" +def test_product_workflows_do_not_create_inactive_pr_runs() -> None: + """Leave draft and closed lifecycle cleanup to the central workflow.""" workflow = (_WORKFLOW_DIRECTORY / "tests.yml").read_text(encoding="utf-8") assert _PULL_REQUEST_TYPES in workflow - assert workflow.count("github.event.action != 'closed'") == 2 + assert "converted_to_draft" not in workflow + assert "github.event.action != 'closed'" not in workflow def test_pull_request_workflows_cancel_only_superseded_same_pr_runs() -> None: From b2ec8b53df37944e1fb96a68081ec28b46a6bd67 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 13:01:33 +0900 Subject: [PATCH 2/5] test(ci): preserve draft and close cancellation events --- tests/test_tests_workflow_contract.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/test_tests_workflow_contract.py b/tests/test_tests_workflow_contract.py index b8698591d..d32cc5624 100644 --- a/tests/test_tests_workflow_contract.py +++ b/tests/test_tests_workflow_contract.py @@ -13,19 +13,27 @@ "cancel-in-progress: ${{ github.event_name == 'pull_request' }}" ) _PULL_REQUEST_TYPES = ( - "types: [opened, synchronize, reopened, ready_for_review]" + "types: [opened, synchronize, reopened, ready_for_review, " + "converted_to_draft, closed]" ) _DRAFT_ADMISSION = "github.event.pull_request.draft == false" +_INACTIVE_ADMISSION = ( + "github.event.action != 'closed' && github.event.pull_request.draft == false" +) -def test_product_workflows_do_not_create_inactive_pr_runs() -> None: - """Leave draft and closed lifecycle cleanup to the central workflow.""" - - workflow = (_WORKFLOW_DIRECTORY / "tests.yml").read_text(encoding="utf-8") +def test_lifecycle_events_cancel_inactive_pr_work() -> None: + """Keep lifecycle events so Draft/close transitions cancel active local work.""" - assert _PULL_REQUEST_TYPES in workflow - assert "converted_to_draft" not in workflow - assert "github.event.action != 'closed'" not in workflow + expected_inactive_guards = { + "tests.yml": 2, + "prov-o-contract.yml": 1, + "ontology-pages.yml": 1, + } + for workflow_name, expected_guard_count in expected_inactive_guards.items(): + workflow = (_WORKFLOW_DIRECTORY / workflow_name).read_text(encoding="utf-8") + assert _PULL_REQUEST_TYPES in workflow, workflow_name + assert workflow.count(_INACTIVE_ADMISSION) == expected_guard_count, workflow_name def test_pull_request_workflows_cancel_only_superseded_same_pr_runs() -> None: From 8eff81f15eb12b54262393175915af661ba888fd Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 13:01:52 +0900 Subject: [PATCH 3/5] fix(ci): cancel active local jobs on draft and close --- .github/workflows/tests.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26a649079..635495d23 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,19 +4,21 @@ on: push: branches: [main] pull_request: - types: [opened, synchronize, reopened, ready_for_review] + types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] permissions: contents: read concurrency: + # Draft/closed events deliberately create a no-job run in this workflow so + # workflow-level concurrency can cancel any older active run for the same PR. group: ${{ github.workflow }}-${{ github.repository }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: pytest: name: Full test suite - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + if: github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) runs-on: ubuntu-24.04 services: postgres: @@ -62,7 +64,7 @@ jobs: frontend: name: Frontend lint, test, build - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + if: github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) runs-on: ubuntu-24.04 steps: - name: Checkout repository From a6c149c9bf5cdb4ded78f6fc2332074ad7ef2aa7 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 13:02:04 +0900 Subject: [PATCH 4/5] fix(ci): preserve PROV-O lifecycle cancellation --- .github/workflows/prov-o-contract.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prov-o-contract.yml b/.github/workflows/prov-o-contract.yml index aa63b2284..6f24a61c7 100644 --- a/.github/workflows/prov-o-contract.yml +++ b/.github/workflows/prov-o-contract.yml @@ -2,7 +2,7 @@ name: PROV-O contract on: pull_request: - types: [opened, synchronize, reopened, ready_for_review] + types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] branches: [main] paths: - "lineageweave/prov_o.py" @@ -29,13 +29,15 @@ permissions: contents: read concurrency: + # Draft/closed events intentionally skip the product job but retain the + # workflow event needed to cancel an older active run for this same PR. group: ${{ github.workflow }}-${{ github.repository }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: standards-contract: name: Registry, inference, coverage, PostgreSQL - if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + if: github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) runs-on: ubuntu-24.04 services: postgres: From de4e6cf9a48b042af0bb1128fa9b194abd1952a5 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 13:02:18 +0900 Subject: [PATCH 5/5] fix(ci): preserve ontology lifecycle cancellation --- .github/workflows/ontology-pages.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ontology-pages.yml b/.github/workflows/ontology-pages.yml index f1f64bfab..a4c911dc7 100644 --- a/.github/workflows/ontology-pages.yml +++ b/.github/workflows/ontology-pages.yml @@ -2,7 +2,7 @@ name: Ontology Pages on: pull_request: - types: [opened, synchronize, reopened, ready_for_review] + types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] branches: [main] paths: - "docs/index.html" @@ -38,13 +38,15 @@ permissions: contents: read concurrency: + # Pull-request lifecycle events share the PR-scoped group: Draft/closed + # transitions skip validation while cancelling any older active validation. group: ${{ github.workflow }}-${{ github.repository }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: validate: name: Validate ontology publication - if: github.event_name == 'pull_request' && github.event.pull_request.draft == false + if: github.event_name == 'pull_request' && github.event.action != 'closed' && github.event.pull_request.draft == false runs-on: ubuntu-24.04 steps: - name: Checkout repository