From 407805aa2d8b6f0d0269d3ce8127b6c43bf1e354 Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:31:30 -0800 Subject: [PATCH 1/4] Require the complete technical suite on merge queue commits --- .github/workflows/advisory.yml | 3 +- .github/workflows/application-vaults.yml | 3 +- .github/workflows/browser-model.yml | 3 +- .github/workflows/browser-v1-1.yml | 3 +- .github/workflows/changelog.yml | 11 ++- .github/workflows/credential-stores.yml | 3 +- .github/workflows/devcontainer.yml | 3 +- .github/workflows/dfv-check.yml | 4 +- .github/workflows/dfv-models.yml | 23 ++--- .github/workflows/fogvault-integration.yml | 3 +- .../workflows/fogvault-native-languages.yml | 3 +- .github/workflows/fuzz.yml | 13 ++- .github/workflows/merge-gate.yml | 97 +++++++++++++++++++ .github/workflows/model-datafog.yml | 3 +- .github/workflows/native-python-host.yml | 1 + .github/workflows/node-binding.yml | 3 +- .github/workflows/python-binding.yml | 4 +- .github/workflows/rust-quality.yml | 4 +- .github/workflows/wasm-binding.yml | 3 +- .github/workflows/workspace-contract.yml | 1 + .github/workflows/workspace-integration.yml | 1 + CONTRIBUTING.md | 37 +++++++ scripts/check-merge-gate.py | 42 ++++++++ scripts/test-merge-gate.py | 85 ++++++++++++++++ 24 files changed, 324 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/merge-gate.yml create mode 100644 scripts/check-merge-gate.py create mode 100644 scripts/test-merge-gate.py diff --git a/.github/workflows/advisory.yml b/.github/workflows/advisory.yml index 84cff364..60a43668 100644 --- a/.github/workflows/advisory.yml +++ b/.github/workflows/advisory.yml @@ -1,6 +1,7 @@ name: Advisory scan on: + workflow_call: schedule: # Advisories are published independently of our commits, so scan daily. - cron: "17 6 * * *" @@ -14,7 +15,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-advisory-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: diff --git a/.github/workflows/application-vaults.yml b/.github/workflows/application-vaults.yml index af3a1bb5..885c5406 100644 --- a/.github/workflows/application-vaults.yml +++ b/.github/workflows/application-vaults.yml @@ -1,13 +1,14 @@ name: Application vaults on: + workflow_call: push: branches: [main] pull_request: workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} + group: ${{ github.workflow }}-application-vaults-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: diff --git a/.github/workflows/browser-model.yml b/.github/workflows/browser-model.yml index 4acf55af..b63dd8a3 100644 --- a/.github/workflows/browser-model.yml +++ b/.github/workflows/browser-model.yml @@ -1,6 +1,7 @@ name: Browser model on: + workflow_call: workflow_dispatch: pull_request: paths: @@ -40,7 +41,7 @@ permissions: contents: read concurrency: - group: browser-model-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-browser-model-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: diff --git a/.github/workflows/browser-v1-1.yml b/.github/workflows/browser-v1-1.yml index 6d84eb9a..87aafd9a 100644 --- a/.github/workflows/browser-v1-1.yml +++ b/.github/workflows/browser-v1-1.yml @@ -1,6 +1,7 @@ name: Browser CNN and Workspace vaults on: + workflow_call: pull_request: paths: - 'crates/**' @@ -30,7 +31,7 @@ permissions: contents: read concurrency: - group: browser-v1-1-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-browser-v1-1-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index a92f0093..32995d82 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -1,6 +1,8 @@ name: Changelog on: + merge_group: + types: [checks_requested] pull_request: types: [opened, synchronize, reopened, edited, labeled, unlabeled, ready_for_review] @@ -8,8 +10,8 @@ permissions: contents: read concurrency: - group: changelog-${{ github.event.pull_request.number }} - cancel-in-progress: true + group: changelog-${{ github.event_name }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: changelog: @@ -19,14 +21,17 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} + ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: "3.12" - name: Test changelog policy run: python scripts/test-changelog.py + # Queue admission already requires this policy on each constituent PR. + # A merge_group has no single PR body/labels to pass to the checker. - name: Check PR entry or explicit exemption + if: github.event_name == 'pull_request' env: CHANGELOG_BASE: ${{ github.event.pull_request.base.sha }} run: python scripts/check-changelog.py --event "$GITHUB_EVENT_PATH" diff --git a/.github/workflows/credential-stores.yml b/.github/workflows/credential-stores.yml index e2364270..29337246 100644 --- a/.github/workflows/credential-stores.yml +++ b/.github/workflows/credential-stores.yml @@ -1,13 +1,14 @@ name: Native credential stores on: + workflow_call: push: branches: [main] pull_request: workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} + group: ${{ github.workflow }}-credential-stores-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index b0bb5689..6e07fb01 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -1,6 +1,7 @@ name: Development container on: + workflow_call: pull_request: paths: - ".cursor/Dockerfile" @@ -33,7 +34,7 @@ permissions: packages: read concurrency: - group: devcontainer-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-devcontainer-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: diff --git a/.github/workflows/dfv-check.yml b/.github/workflows/dfv-check.yml index 559ea082..828b3ab0 100644 --- a/.github/workflows/dfv-check.yml +++ b/.github/workflows/dfv-check.yml @@ -1,12 +1,13 @@ name: Verification CLI on: + workflow_call: push: branches: [main, "release/**"] pull_request: concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-dfv-check-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: @@ -33,6 +34,7 @@ jobs: done <<< "$files" fi fi + if [[ "$GITHUB_EVENT_NAME" == merge_group ]]; then code=true; fi echo "code=$code" >> "$GITHUB_OUTPUT" - if: steps.scope.outputs.code == 'true' id: rust-version diff --git a/.github/workflows/dfv-models.yml b/.github/workflows/dfv-models.yml index 84cb96d9..b2d4673e 100644 --- a/.github/workflows/dfv-models.yml +++ b/.github/workflows/dfv-models.yml @@ -1,6 +1,7 @@ name: Model verification on: + workflow_call: pull_request: paths: - 'crates/core/src/models/**' @@ -21,7 +22,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-dfv-models-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: @@ -241,30 +242,30 @@ jobs: - name: Run model eval run: cargo dfv eval --models --json - - name: Set up Node for nightly parity - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + - name: Set up Node for full parity + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' uses: actions/setup-node@v4 with: node-version-file: .nvmrc - name: Build Node binding for parity - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' run: cargo dfv build --sdk node - - name: Install WASM tooling for nightly parity - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + - name: Install WASM tooling for full parity + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' run: cargo install wasm-bindgen-cli --version "$(./scripts/pin.sh wasm-bindgen)" --locked - name: Build WASM binding for parity - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' run: cargo dfv build --sdk wasm - - name: Install Chromium dependencies for nightly parity - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + - name: Install Chromium dependencies for full parity + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' run: npx --prefix bindings/wasm playwright install --with-deps chromium - - name: Full live parity check (nightly/manual only) - if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + - name: Full live parity check (nightly/manual/queue) + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' run: cargo dfv parity --live --full --json - if: always() diff --git a/.github/workflows/fogvault-integration.yml b/.github/workflows/fogvault-integration.yml index 3225edaa..92138080 100644 --- a/.github/workflows/fogvault-integration.yml +++ b/.github/workflows/fogvault-integration.yml @@ -1,6 +1,7 @@ name: Core and FogVault integration on: + workflow_call: push: branches: [main] pull_request: @@ -9,7 +10,7 @@ on: # PRs, main pushes and manual runs retain separate scopes. No path filters leave # required checks waiting forever when a change only affects documentation. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} + group: ${{ github.workflow }}-fogvault-integration-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: diff --git a/.github/workflows/fogvault-native-languages.yml b/.github/workflows/fogvault-native-languages.yml index 9b56229b..7dc85e58 100644 --- a/.github/workflows/fogvault-native-languages.yml +++ b/.github/workflows/fogvault-native-languages.yml @@ -1,6 +1,7 @@ name: Core and FogVault native language packages on: + workflow_call: push: branches: [main] pull_request: @@ -9,7 +10,7 @@ on: # Every PR receives explicit results, including docs-only changes. Superseded PR # runs are cancelled; main pushes and manual runs retain their own scopes. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} + group: ${{ github.workflow }}-fogvault-native-languages-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}-${{ github.event_name }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index d57cd1a5..716f83d1 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -1,6 +1,7 @@ name: Fuzz on: + workflow_call: workflow_dispatch: # Pull requests only build the targets. A fuzz run is nightly work. pull_request: @@ -12,12 +13,12 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-fuzz-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.event_name == 'merge_group' runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -33,13 +34,17 @@ jobs: BASE: ${{ github.event.pull_request.base.sha }} run: | code=true - files="$(git diff --name-only "$BASE" "$GITHUB_SHA")" + files="" + if [[ "$GITHUB_EVENT_NAME" == pull_request ]]; then + files="$(git diff --name-only "$BASE" "$GITHUB_SHA")" + fi if [[ -n "$files" ]]; then code=false while IFS= read -r file; do case "$file" in docs/*|*.md|*.mdx) ;; *) code=true ;; esac done <<< "$files" fi + if [[ "$GITHUB_EVENT_NAME" == merge_group ]]; then code=true; fi echo "code=$code" >> "$GITHUB_OUTPUT" - if: steps.scope.outputs.code == 'true' uses: dtolnay/rust-toolchain@nightly @@ -70,7 +75,7 @@ jobs: with: workspaces: crates/core/fuzz - name: Install cargo-fuzz - run: cargo install cargo-fuzz --locked --version 0.13.2 + run: cargo +nightly install cargo-fuzz --locked --version 0.13.2 - name: Fuzz ${{ matrix.target }} for 60s # `-max_total_time` is the budget; libFuzzer exits non-zero with the crash # in `artifacts//`. Seeds are committed, so a fresh target starts diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml new file mode 100644 index 00000000..e4e8fbfc --- /dev/null +++ b/.github/workflows/merge-gate.yml @@ -0,0 +1,97 @@ +name: Merge gate + +on: + pull_request: + merge_group: + types: [checks_requested] + +permissions: + contents: read + +concurrency: + group: merge-gate-${{ github.event_name }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + policy: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - run: python scripts/test-merge-gate.py + - run: python scripts/test-changelog.py + advisory: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/advisory.yml + application-vaults: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/application-vaults.yml + browser-model: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/browser-model.yml + browser-v1-1: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/browser-v1-1.yml + credential-stores: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/credential-stores.yml + devcontainer: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/devcontainer.yml + permissions: + contents: read + packages: read + dfv-check: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/dfv-check.yml + dfv-models: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/dfv-models.yml + fogvault-integration: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/fogvault-integration.yml + fogvault-native-languages: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/fogvault-native-languages.yml + fuzz: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/fuzz.yml + model-datafog: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/model-datafog.yml + native-python-host: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/native-python-host.yml + node-binding: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/node-binding.yml + python-binding: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/python-binding.yml + rust-quality: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/rust-quality.yml + wasm-binding: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/wasm-binding.yml + workspace-contract: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/workspace-contract.yml + workspace-integration: + if: github.event_name == 'merge_group' + uses: ./.github/workflows/workspace-integration.yml + gate: + name: Full technical suite + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + needs: ["policy", "advisory", "application-vaults", "browser-model", "browser-v1-1", "credential-stores", "devcontainer", "dfv-check", "dfv-models", "fogvault-integration", "fogvault-native-languages", "fuzz", "model-datafog", "native-python-host", "node-binding", "python-binding", "rust-quality", "wasm-binding", "workspace-contract", "workspace-integration"] + steps: + - uses: actions/checkout@v4 + - name: Require every selected check to succeed + env: + GATE_RESULTS: ${{ toJSON(needs) }} + run: python3 scripts/check-merge-gate.py diff --git a/.github/workflows/model-datafog.yml b/.github/workflows/model-datafog.yml index a4102d31..66f56908 100644 --- a/.github/workflows/model-datafog.yml +++ b/.github/workflows/model-datafog.yml @@ -1,8 +1,9 @@ name: Model integration -# Explicit integration checks only. Routine PR/push CI never downloads model assets. +# Integration checks run manually and in the full merge-queue suite. # Cached files are reverified by the pinned provisioner before every installation. on: + workflow_call: workflow_dispatch: permissions: diff --git a/.github/workflows/native-python-host.yml b/.github/workflows/native-python-host.yml index f43d252d..3b571a93 100644 --- a/.github/workflows/native-python-host.yml +++ b/.github/workflows/native-python-host.yml @@ -1,6 +1,7 @@ name: Native Python host qualification on: + workflow_call: pull_request: paths: - 'bindings/python/**' diff --git a/.github/workflows/node-binding.yml b/.github/workflows/node-binding.yml index fa1b19f3..0d95488b 100644 --- a/.github/workflows/node-binding.yml +++ b/.github/workflows/node-binding.yml @@ -1,6 +1,7 @@ name: Node binding on: + workflow_call: # Tags are excluded: release tags point at commits already tested on a branch. push: branches: [main, "release/**"] @@ -37,7 +38,7 @@ on: # Superseded pull request runs are cancelled. Pushes to main and release # branches get their own group, so every pushed commit is tested. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-node-binding-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: diff --git a/.github/workflows/python-binding.yml b/.github/workflows/python-binding.yml index 88d06e94..fff93bd9 100644 --- a/.github/workflows/python-binding.yml +++ b/.github/workflows/python-binding.yml @@ -1,6 +1,7 @@ name: Python binding on: + workflow_call: # Tags are excluded: release tags point at commits already tested on a branch. push: branches: [main, "release/**"] @@ -9,7 +10,7 @@ on: # Superseded pull request runs are cancelled. Pushes to main and release # branches get their own group, so every pushed commit is tested. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-python-binding-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: @@ -49,6 +50,7 @@ jobs: done <<< "$files" fi fi + if [[ "$GITHUB_EVENT_NAME" == merge_group ]]; then code=true; fi echo "code=$code" >> "$GITHUB_OUTPUT" - if: steps.scope.outputs.code == 'true' id: rust-version diff --git a/.github/workflows/rust-quality.yml b/.github/workflows/rust-quality.yml index effb0562..dd499917 100644 --- a/.github/workflows/rust-quality.yml +++ b/.github/workflows/rust-quality.yml @@ -1,6 +1,7 @@ name: Rust quality on: + workflow_call: # Tags are excluded: release tags point at commits already tested on a branch. push: branches: [main, "release/**"] @@ -9,7 +10,7 @@ on: # Superseded pull request runs are cancelled. Pushes to main and release # branches get their own group, so every pushed commit is tested. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-rust-quality-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: @@ -38,6 +39,7 @@ jobs: done <<< "$files" fi fi + if [[ "$GITHUB_EVENT_NAME" == merge_group ]]; then code=true; fi echo "code=$code" >> "$GITHUB_OUTPUT" - if: steps.scope.outputs.code == 'true' id: rust-version diff --git a/.github/workflows/wasm-binding.yml b/.github/workflows/wasm-binding.yml index 3bd078a0..51036f8b 100644 --- a/.github/workflows/wasm-binding.yml +++ b/.github/workflows/wasm-binding.yml @@ -1,6 +1,7 @@ name: WASM binding on: + workflow_call: # Tags are excluded: release tags point at commits already tested on a branch. push: branches: [main, "release/**"] @@ -37,7 +38,7 @@ on: # Superseded pull request runs are cancelled. Pushes to main and release # branches get their own group, so every pushed commit is tested. concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} + group: ${{ github.workflow }}-wasm-binding-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: diff --git a/.github/workflows/workspace-contract.yml b/.github/workflows/workspace-contract.yml index 0be48717..5bf91543 100644 --- a/.github/workflows/workspace-contract.yml +++ b/.github/workflows/workspace-contract.yml @@ -1,6 +1,7 @@ name: Workspace contract draft on: + workflow_call: pull_request: paths: - 'docs/contracts/**' diff --git a/.github/workflows/workspace-integration.yml b/.github/workflows/workspace-integration.yml index 5b058fc2..1ab3e945 100644 --- a/.github/workflows/workspace-integration.yml +++ b/.github/workflows/workspace-integration.yml @@ -1,6 +1,7 @@ name: Workspace integration on: + workflow_call: push: branches: [main] paths: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f078c7a6..00caa3c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -224,3 +224,40 @@ event file is supplied with `--event`. Once the workflow lands on `main`, add `Changelog policy` to the required checks in GitHub branch rules. The workflow alone does not prevent merging a failed check. + + +## Merge queue verification + +Require the `Full technical suite` and `Changelog policy` checks in the main-branch +ruleset, and require pull requests to enter the merge queue. Keep the existing PR +checks required for early feedback. Path-selected PR workflows remain unchanged; +the aggregate's PR run validates the gate configuration and policy tests so any +PR can enter the queue, including documentation-only changes. + +On `merge_group`, the aggregate calls every non-publication technical workflow +against the queue's merge commit. This includes the complete platform matrices, +installed model packages, model evaluation and full live parity, bounded fuzzing, +advisory scanning, and container builds. No technical workflow is path-filtered +at queue admission, and docs-only shortcuts are disabled. The model candidate +builder runs through model integration; it is not invoked a second time. Release +publication workflows are excluded because they upload packages to registries. + +The final `Full technical suite` job runs even after dependency failure and accepts +only success from every technical workflow. Missing, skipped, cancelled, or failed +queue results block it. Its PR admission result does not assert that the full suite +ran on the PR; the full suite is required on the queue commit before merge. Queue +runs are isolated from standalone workflow concurrency groups and are not cancelled +by newer PR updates. Only the container call gets package-read permission; no +repository secrets are forwarded by the aggregate. + +`Changelog policy` validates each PR's committed entry or its explicit label/body +exemption before queue admission. Its queue run executes the policy regression +tests on the merge commit, without treating a group as a single PR or inventing +an exemption. Keep that check required on PRs as well as the aggregate. + +Run `python3 scripts/test-merge-gate.py`, `python3 scripts/test-changelog.py`, and +`actionlint` when changing the gate. The inventory test requires every new technical +workflow to be added to the aggregate. After deployment, confirm a queue run on a +throwaway PR with a deliberate formatting failure ends with a failed aggregate and +cannot merge; remove that failure before merging the PR. Branch protection and +merge queue rules are repository settings and are not enabled by this workflow. diff --git a/scripts/check-merge-gate.py b/scripts/check-merge-gate.py new file mode 100644 index 00000000..7066f395 --- /dev/null +++ b/scripts/check-merge-gate.py @@ -0,0 +1,42 @@ +"""Require successful queue checks; PRs validate the gate before queue admission.""" + +import json +import os +import sys + + +TECHNICAL_WORKFLOWS = ( + "advisory", "application-vaults", "browser-model", "browser-v1-1", + "credential-stores", "devcontainer", "dfv-check", "dfv-models", + "fogvault-integration", "fogvault-native-languages", "fuzz", "model-datafog", + "native-python-host", "node-binding", "python-binding", "rust-quality", + "wasm-binding", "workspace-contract", "workspace-integration", +) + + +def validate(event_name, results): + if event_name not in {"pull_request", "merge_group"}: + raise ValueError(f"Unsupported gate event: {event_name}") + expected = {"policy", *TECHNICAL_WORKFLOWS} + if not isinstance(results, dict) or set(results) != expected: + raise ValueError("Gate results must contain exactly every configured dependency") + for name, result in results.items(): + required = "success" + if event_name == "pull_request" and name != "policy": + required = "skipped" + if not isinstance(result, dict) or result.get("result") != required: + raise ValueError(f"{name}: expected {required}, received {result!r}") + + +def main(): + try: + validate(os.environ["GITHUB_EVENT_NAME"], json.loads(os.environ["GATE_RESULTS"])) + except (KeyError, ValueError, TypeError) as error: + print(f"Merge gate failed: {error}", file=sys.stderr) + return 1 + print("Every dependency has the required result for this event.") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/test-merge-gate.py b/scripts/test-merge-gate.py new file mode 100644 index 00000000..67e65b44 --- /dev/null +++ b/scripts/test-merge-gate.py @@ -0,0 +1,85 @@ +"""Exercise fail-closed aggregation and guard the complete workflow inventory.""" + +import copy +import importlib.util +import json +from pathlib import Path +import re +import unittest + +ROOT = Path(__file__).resolve().parents[1] +spec = importlib.util.spec_from_file_location("gate", ROOT / "scripts/check-merge-gate.py") +gate = importlib.util.module_from_spec(spec) +spec.loader.exec_module(gate) + + +class MergeGateTests(unittest.TestCase): + def results(self, event="merge_group"): + return { + name: {"result": "success" if event == "merge_group" or name == "policy" else "skipped"} + for name in ("policy", *gate.TECHNICAL_WORKFLOWS) + } + + def test_complete_queue_passes(self): + gate.validate("merge_group", self.results()) + + def test_every_unsuccessful_dependency_blocks_queue(self): + for name in self.results(): + for state in ("failure", "cancelled", "skipped", "timed_out", "neutral", None): + with self.subTest(name=name, state=state): + results = self.results() + results[name]["result"] = state + with self.assertRaises(ValueError): + gate.validate("merge_group", results) + + def test_missing_extra_and_malformed_results_fail(self): + variants = [None, [], {}, {**self.results(), "unknown": {"result": "success"}}] + for name in self.results(): + missing = self.results() + del missing[name] + variants.append(missing) + malformed = self.results() + malformed[name] = "success" + variants.append(malformed) + for results in variants: + with self.subTest(results=results), self.assertRaises(ValueError): + gate.validate("merge_group", results) + + def test_pr_admission_requires_policy_and_does_not_claim_full_execution(self): + results = self.results("pull_request") + gate.validate("pull_request", results) + for state in ("skipped", "failure", "cancelled"): + invalid = copy.deepcopy(results) + invalid["policy"]["result"] = state + with self.assertRaises(ValueError): + gate.validate("pull_request", invalid) + with self.assertRaises(ValueError): + gate.validate("push", self.results()) + + def test_workflow_inventory_and_dependencies_are_complete(self): + directory = ROOT / ".github/workflows" + excluded = {"changelog", "model-candidates", "merge-gate"} + technical = { + path.stem for path in directory.glob("*.yml") + if path.stem not in excluded and not path.stem.startswith("publish-") + } + self.assertEqual(technical, set(gate.TECHNICAL_WORKFLOWS)) + workflow = (directory / "merge-gate.yml").read_text() + dependencies = json.loads(re.search(r"^ needs: (\[.*\])$", workflow, re.MULTILINE)[1]) + self.assertEqual(set(dependencies), {"policy", *technical}) + self.assertEqual(len(dependencies), len(set(dependencies))) + calls = re.findall(r"^ uses: \./.github/workflows/(.*)\.yml$", workflow, re.MULTILINE) + self.assertEqual(set(calls), technical) + self.assertEqual(len(calls), len(technical)) + self.assertIn(" if: always()\n", workflow) + for name in technical: + source = (directory / f"{name}.yml").read_text() + self.assertIn(" workflow_call:\n", source, name) + self.assertNotIn("continue-on-error:", source, name) + self.assertIn(f" {name}:\n if: github.event_name == 'merge_group'\n", workflow) + if "id: scope" in source: + self.assertIn('if [[ "$GITHUB_EVENT_NAME" == merge_group ]]; then code=true; fi', source) + + +if __name__ == "__main__": + unittest.main() From 236915dd1644a65c98a021d2995a875386939a1b Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:29:33 -0800 Subject: [PATCH 2/4] Validate the pinned Chromium runtime directly on the model parity runner --- .github/workflows/dfv-models.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dfv-models.yml b/.github/workflows/dfv-models.yml index b2d4673e..7b5d32d4 100644 --- a/.github/workflows/dfv-models.yml +++ b/.github/workflows/dfv-models.yml @@ -260,9 +260,12 @@ jobs: if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' run: cargo dfv build --sdk wasm - - name: Install Chromium dependencies for full parity + - name: Install and launch pinned Chromium for full parity if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' - run: npx --prefix bindings/wasm playwright install --with-deps chromium + working-directory: bindings/wasm + run: | + node node_modules/playwright/cli.js install chromium + node --input-type=module -e 'import { chromium } from "playwright"; const browser = await chromium.launch(); await browser.close();' - name: Full live parity check (nightly/manual/queue) if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' From 98c13c32cdb0f713a6c9b747cdd9cf3f5b50324b Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:59:42 -0800 Subject: [PATCH 3/4] Reject skipped technical children in merge queue verification --- .github/workflows/merge-gate.yml | 4 ++ CONTRIBUTING.md | 10 ++- scripts/check-merge-gate.py | 79 +++++++++++++++++++++- scripts/test-merge-gate.py | 110 +++++++++++++++++++++++++++++++ 4 files changed, 199 insertions(+), 4 deletions(-) diff --git a/.github/workflows/merge-gate.yml b/.github/workflows/merge-gate.yml index e4e8fbfc..99421728 100644 --- a/.github/workflows/merge-gate.yml +++ b/.github/workflows/merge-gate.yml @@ -84,6 +84,9 @@ jobs: if: github.event_name == 'merge_group' uses: ./.github/workflows/workspace-integration.yml gate: + permissions: + contents: read + actions: read name: Full technical suite if: always() runs-on: ubuntu-latest @@ -94,4 +97,5 @@ jobs: - name: Require every selected check to succeed env: GATE_RESULTS: ${{ toJSON(needs) }} + GH_TOKEN: ${{ github.token }} run: python3 scripts/check-merge-gate.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00caa3c5..e72d2565 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -243,8 +243,14 @@ builder runs through model integration; it is not invoked a second time. Release publication workflows are excluded because they upload packages to registries. The final `Full technical suite` job runs even after dependency failure and accepts -only success from every technical workflow. Missing, skipped, cancelled, or failed -queue results block it. Its PR admission result does not assert that the full suite +only success from every technical workflow. It also reads every job from the +current run attempt through the paginated Actions API: a reusable workflow can +report success even when a technical child was skipped. Every child must have +completed successfully, and every selected workflow must be represented. Only +the currently executing final gate job is excluded, matched by exact name and +runner identity. Missing API data, API errors, skipped, cancelled, or failed jobs +block the gate. Rerun the entire suite when a fresh attempt is needed; successful +jobs from an older attempt do not satisfy current-attempt coverage. Its PR admission result does not assert that the full suite ran on the PR; the full suite is required on the queue commit before merge. Queue runs are isolated from standalone workflow concurrency groups and are not cancelled by newer PR updates. Only the container call gets package-read permission; no diff --git a/scripts/check-merge-gate.py b/scripts/check-merge-gate.py index 7066f395..4f65bc57 100644 --- a/scripts/check-merge-gate.py +++ b/scripts/check-merge-gate.py @@ -3,6 +3,7 @@ import json import os import sys +from urllib.request import Request, urlopen TECHNICAL_WORKFLOWS = ( @@ -28,10 +29,84 @@ def validate(event_name, results): raise ValueError(f"{name}: expected {required}, received {result!r}") + +def read_jobs(repository, run_id, attempt, token, api_url): + """Read this attempt only; verify pagination did not omit or repeat jobs.""" + jobs = [] + total = None + for page in range(1, 101): + url = (f"{api_url}/repos/{repository}/actions/runs/{run_id}/attempts/{attempt}" + f"/jobs?per_page=100&page={page}") + request = Request(url, headers={ + "Authorization": f"Bearer {token}", + "Accept": "application/vnd.github+json", + "X-GitHub-Api-Version": "2022-11-28", + }) + with urlopen(request, timeout=30) as response: + payload = json.load(response) + if not isinstance(payload, dict): + raise ValueError("Jobs API returned a malformed response") + count = payload.get("total_count") + batch = payload.get("jobs") + if type(count) is not int or count <= 0 or not isinstance(batch, list) or not batch: + raise ValueError("Jobs API returned missing or malformed job data") + if total is not None and total != count: + raise ValueError("Jobs API total changed during pagination") + total = count + jobs.extend(batch) + if len(jobs) >= total: + if len(jobs) != total: + raise ValueError("Jobs API returned more jobs than its declared total") + return jobs + raise ValueError("Jobs API pagination exceeded the bounded page limit") + + +def validate_jobs(jobs, run_id, attempt, head_sha, runner_name): + """Reusable workflow success does not guarantee every child job succeeded.""" + expected = {"policy", *TECHNICAL_WORKFLOWS} + covered = set() + identifiers = set() + current_gate = [] + for job in jobs: + if not isinstance(job, dict) or type(job.get("id")) is not int: + raise ValueError("Jobs API returned a malformed job identity") + if job["id"] in identifiers: + raise ValueError("Jobs API returned duplicate jobs") + identifiers.add(job["id"]) + if (job.get("run_id"), job.get("run_attempt"), job.get("head_sha")) != (run_id, attempt, head_sha): + raise ValueError("Jobs API returned a job from another run, attempt, or commit") + name = job.get("name") + if name == "Full technical suite": + if (job.get("runner_name") != runner_name or job.get("status") != "in_progress" + or job.get("conclusion") is not None): + raise ValueError("Final gate job does not match the executing runner") + current_gate.append(job["id"]) + continue + if not isinstance(name, str): + raise ValueError("Jobs API returned a job without a name") + workflow = name.split(" / ", 1)[0] + if workflow not in expected: + raise ValueError(f"Unexpected job in merge gate: {name}") + if job.get("status") != "completed" or job.get("conclusion") != "success": + raise ValueError(f"Technical job did not succeed: {name}: {job.get('conclusion')}") + covered.add(workflow) + if len(current_gate) != 1: + raise ValueError("Jobs API must contain exactly one executing final gate job") + if covered != expected: + raise ValueError(f"Missing technical workflow coverage: {sorted(expected - covered)}") + + def main(): try: - validate(os.environ["GITHUB_EVENT_NAME"], json.loads(os.environ["GATE_RESULTS"])) - except (KeyError, ValueError, TypeError) as error: + event = os.environ["GITHUB_EVENT_NAME"] + validate(event, json.loads(os.environ["GATE_RESULTS"])) + if event == "merge_group": + run_id = int(os.environ["GITHUB_RUN_ID"]) + attempt = int(os.environ["GITHUB_RUN_ATTEMPT"]) + jobs = read_jobs(os.environ["GITHUB_REPOSITORY"], run_id, attempt, + os.environ["GH_TOKEN"], os.environ["GITHUB_API_URL"]) + validate_jobs(jobs, run_id, attempt, os.environ["GITHUB_SHA"], os.environ["RUNNER_NAME"]) + except (KeyError, ValueError, TypeError, AttributeError, OSError) as error: print(f"Merge gate failed: {error}", file=sys.stderr) return 1 print("Every dependency has the required result for this event.") diff --git a/scripts/test-merge-gate.py b/scripts/test-merge-gate.py index 67e65b44..3846da87 100644 --- a/scripts/test-merge-gate.py +++ b/scripts/test-merge-gate.py @@ -3,9 +3,13 @@ import copy import importlib.util import json +import io +import os from pathlib import Path import re import unittest +from unittest.mock import patch +from urllib.error import URLError ROOT = Path(__file__).resolve().parents[1] spec = importlib.util.spec_from_file_location("gate", ROOT / "scripts/check-merge-gate.py") @@ -81,5 +85,111 @@ def test_workflow_inventory_and_dependencies_are_complete(self): self.assertIn('if [[ "$GITHUB_EVENT_NAME" == merge_group ]]; then code=true; fi', source) +class JobVerificationTests(unittest.TestCase): + def jobs(self): + jobs = [ + {"id": index, "run_id": 123, "run_attempt": 2, "head_sha": "abc", + "name": "policy" if name == "policy" else f"{name} / technical child", + "status": "completed", "conclusion": "success"} + for index, name in enumerate(("policy", *gate.TECHNICAL_WORKFLOWS), 1) + ] + jobs.append({"id": 100, "run_id": 123, "run_attempt": 2, "head_sha": "abc", + "name": "Full technical suite", "runner_name": "gate-runner", + "status": "in_progress", "conclusion": None}) + return jobs + + def check(self, jobs): + gate.validate_jobs(jobs, 123, 2, "abc", "gate-runner") + + def test_successful_children_pass(self): + self.check(self.jobs()) + + def test_green_workflow_with_skipped_child_fails(self): + gate.validate("merge_group", MergeGateTests().results()) + jobs = self.jobs() + jobs.append(dict(jobs[1], id=101, name="application-vaults / another child", conclusion="skipped")) + with self.assertRaisesRegex(ValueError, "Technical job did not succeed"): + self.check(jobs) + + def test_every_non_success_child_and_unfinished_child_fails(self): + for state in ("failure", "cancelled", "skipped", "neutral", "timed_out", None): + with self.subTest(state=state), self.assertRaises(ValueError): + jobs = self.jobs() + jobs[1]["conclusion"] = state + self.check(jobs) + jobs = self.jobs() + jobs[1]["status"] = "in_progress" + with self.assertRaises(ValueError): + self.check(jobs) + + def test_missing_workflow_or_gate_and_duplicate_jobs_fail(self): + for index in range(len(self.jobs())): + jobs = self.jobs() + del jobs[index] + with self.subTest(index=index), self.assertRaises(ValueError): + self.check(jobs) + with self.assertRaises(ValueError): + self.check(self.jobs() + [self.jobs()[0]]) + with self.assertRaises(ValueError): + self.check(self.jobs() + [dict(self.jobs()[-1], id=101)]) + + def test_exact_gate_identity_and_attempt_are_required(self): + for field, value in (("runner_name", "other"), ("name", "Full technical suite / other"), + ("status", "completed"), ("conclusion", "success")): + jobs = self.jobs() + jobs[-1][field] = value + with self.subTest(field=field), self.assertRaises(ValueError): + self.check(jobs) + for field, value in (("run_id", 999), ("run_attempt", 1), ("head_sha", "old"), + ("id", None), ("name", None), ("name", "unknown / child")): + jobs = self.jobs() + jobs[0][field] = value + with self.subTest(field=field), self.assertRaises(ValueError): + self.check(jobs) + + def response(self, payload): + return io.BytesIO(json.dumps(payload).encode()) + + def test_paginated_current_attempt_api(self): + jobs = self.jobs() + with patch.object(gate, "urlopen", side_effect=[ + self.response({"total_count": len(jobs), "jobs": jobs[:10]}), + self.response({"total_count": len(jobs), "jobs": jobs[10:]}), + ]) as fetch: + received = gate.read_jobs("owner/repo", 123, 2, "token", "https://api.github.com") + self.check(received) + self.assertEqual(fetch.call_count, 2) + for page, call in enumerate(fetch.call_args_list, 1): + self.assertEqual(call.args[0].full_url, + f"https://api.github.com/repos/owner/repo/actions/runs/123/attempts/2/jobs?per_page=100&page={page}") + self.assertEqual(call.kwargs["timeout"], 30) + + def test_missing_inconsistent_and_malformed_api_data_fail(self): + for payload in (None, [], {}, {"total_count": 0, "jobs": []}, {"total_count": 1}, + {"total_count": 1, "jobs": []}, {"total_count": 1, "jobs": [1, 2]}, + {"total_count": "1", "jobs": [{}]}): + with patch.object(gate, "urlopen", return_value=self.response(payload)): + with self.subTest(payload=payload), self.assertRaises(ValueError): + gate.read_jobs("owner/repo", 123, 2, "token", "https://api.github.com") + for second in ({"total_count": 3, "jobs": [{}]}, {"total_count": 2, "jobs": []}): + with patch.object(gate, "urlopen", side_effect=[ + self.response({"total_count": 2, "jobs": [{}]}), self.response(second) + ]), self.assertRaises(ValueError): + gate.read_jobs("owner/repo", 123, 2, "token", "https://api.github.com") + + def test_api_errors_fail_closed_and_pr_never_calls_api(self): + env = {"GITHUB_EVENT_NAME": "merge_group", "GATE_RESULTS": json.dumps(MergeGateTests().results()), + "GITHUB_RUN_ID": "123", "GITHUB_RUN_ATTEMPT": "2", "GITHUB_REPOSITORY": "owner/repo", + "GH_TOKEN": "token", "GITHUB_API_URL": "https://api.github.com"} + for error in (URLError("unavailable"), ValueError("bad JSON"), TimeoutError("timeout")): + with patch.dict(os.environ, env, clear=True), patch.object(gate, "read_jobs", side_effect=error): + self.assertEqual(gate.main(), 1) + env = {"GITHUB_EVENT_NAME": "pull_request", + "GATE_RESULTS": json.dumps(MergeGateTests().results("pull_request"))} + with patch.dict(os.environ, env, clear=True), patch.object(gate, "read_jobs") as fetch: + self.assertEqual(gate.main(), 0) + fetch.assert_not_called() + + if __name__ == "__main__": unittest.main() From 3612f4ca0ac04e71ad7571e832b9e2a8e71d00de Mon Sep 17 00:00:00 2001 From: Sid Mohan <61345237+sidmohan0@users.noreply.github.com> Date: Thu, 19 Nov 2026 18:00:30 -0800 Subject: [PATCH 4/4] Report worker qualification progress and trace prolonged waits --- scripts/model-fault-conformance.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/model-fault-conformance.py b/scripts/model-fault-conformance.py index 3b635475..e09c372e 100644 --- a/scripts/model-fault-conformance.py +++ b/scripts/model-fault-conformance.py @@ -1,5 +1,6 @@ """Explicit installed-wheel lifecycle/failure qualification with actual local workers.""" from concurrent.futures import ThreadPoolExecutor +import faulthandler import json from pathlib import Path import sys @@ -71,7 +72,10 @@ def reject(call, code): raise AssertionError(f"expected {code}; operation returned successful protection") +# Emit stacks if a worker exceeds its request and cleanup budgets on CI. +faulthandler.dump_traceback_later(wait_seconds, repeat=True) with ThreadPoolExecutor(max_workers=1) as executor: + print("Checking active cancellation and busy admission", flush=True) session, worker, processes = open_worker() try: reject(lambda: session.scan_model("x" * (limits["max_input_bytes"] + 1)), "invalid_configuration") @@ -93,6 +97,7 @@ def reject(call, code): finally: session.close() + print("Checking abrupt worker death", flush=True) session, worker, processes = open_worker() try: stopped_at = time.monotonic() @@ -103,6 +108,7 @@ def reject(call, code): finally: session.close() + print("Checking close during active inference", flush=True) session, worker, processes = open_worker() baseline = cpu_time(processes) pending = executor.submit(session.scan_model, long_text) @@ -113,6 +119,7 @@ def reject(call, code): assert_stopped(processes, stopped_at) session.close() +print("Checking model startup failures", flush=True) if "gliner2" in config: # The Core test interpreter has the runner but no optional model dependencies. missing_runtime = dict(config, gliner2=dict(config["gliner2"], python=sys.executable)) @@ -123,4 +130,5 @@ def reject(call, code): bad = dict(config, manifest_sha256="0" * 64) reject(lambda: ModelSession.open(bad), "model_load_failed") +faulthandler.cancel_dump_traceback_later() print("Actual worker active cancellation, busy admission, abrupt death, close interruption, oversize and sanitized atomic failures passed.")