From ada9ce6f4c242d110a13e10b8ac6a11dd20bbb16 Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:02:30 +0000 Subject: [PATCH 1/9] ci(adbc): dispatch dedicated integration tests Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 159 ++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 .github/workflows/trigger-rust-adbc-integration-tests.yml diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml new file mode 100644 index 00000000..3c407678 --- /dev/null +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -0,0 +1,159 @@ +# Copyright (c) 2026 Databricks, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Trigger Rust ADBC Integration Tests + +# The native kernel gate dispatches separately. Only changes to the Rust ADBC +# driver (or this workflow) request the full live ADBC suite in driver-test. +on: + pull_request: + types: [labeled] + merge_group: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + dispatch: + if: | + vars.INTEGRATION_TESTS_ENABLED == 'true' && + (github.event_name == 'merge_group' || + (github.event_name == 'pull_request' && github.event.label.name == 'integration-test')) + runs-on: + group: databricks-protected-runner-group + labels: linux-ubuntu-latest + steps: + - name: Resolve test target + id: target + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + with: + script: | + if (context.eventName === 'pull_request') { + const pr = context.payload.pull_request; + core.setOutput('base_sha', pr.base.sha); + core.setOutput('head_sha', pr.head.sha); + core.setOutput('pr_number', pr.number); + } else { + const group = context.payload.merge_group; + const match = /^refs\/heads\/gh-readonly-queue\/.+\/pr-(\d+)-[0-9a-f]+$/.exec(group.head_ref); + if (!match) throw new Error(`Unexpected merge-group ref: ${group.head_ref}`); + core.setOutput('base_sha', group.base_sha); + core.setOutput('head_sha', group.head_sha); + core.setOutput('pr_number', match[1]); + } + + - name: Checkout changed revision + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ steps.target.outputs.head_sha }} + fetch-depth: 0 + persist-credentials: false + + - name: Detect Rust ADBC changes + id: changed + env: + BASE_SHA: ${{ steps.target.outputs.base_sha }} + HEAD_SHA: ${{ steps.target.outputs.head_sha }} + run: | + set -euo pipefail + if git diff --quiet "$BASE_SHA" "$HEAD_SHA" -- \ + adbc/ .github/workflows/trigger-rust-adbc-integration-tests.yml; then + echo "changed=false" >> "$GITHUB_OUTPUT" + else + diff_status=$? + if [ "$diff_status" -ne 1 ]; then exit "$diff_status"; fi + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Generate integration App token + id: app-token + if: steps.changed.outputs.changed == 'true' + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 + with: + app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} + private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }} + owner: databricks + repositories: | + databricks-sql-kernel + databricks-driver-test + permission-contents: write + permission-checks: write + + - name: Create Rust ADBC check + id: check + if: steps.changed.outputs.changed == 'true' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + HEAD_SHA: ${{ steps.target.outputs.head_sha }} + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + const { data: check } = await github.rest.checks.create({ + ...context.repo, + name: 'Rust ADBC Integration Tests', + head_sha: process.env.HEAD_SHA, + status: 'in_progress', + started_at: new Date().toISOString(), + details_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` + }); + return check.id; + + - name: Build Rust ADBC payload + id: payload + if: steps.changed.outputs.changed == 'true' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + HEAD_SHA: ${{ steps.target.outputs.head_sha }} + PR_NUMBER: ${{ steps.target.outputs.pr_number }} + CHECK_RUN_ID: ${{ steps.check.outputs.result }} + with: + script: | + core.setOutput('json', JSON.stringify({ + commit_sha: process.env.HEAD_SHA, + pr_number: process.env.PR_NUMBER, + check_run_id: process.env.CHECK_RUN_ID + })); + + - name: Dispatch Rust ADBC tests + if: steps.changed.outputs.changed == 'true' + uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0 + with: + token: ${{ steps.app-token.outputs.token }} + repository: databricks/databricks-driver-test + event-type: rust-adbc-pr-test + client-payload: ${{ steps.payload.outputs.json }} + + - name: Report dispatch failure + if: failure() && steps.check.outputs.result != '' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + CHECK_RUN_ID: ${{ steps.check.outputs.result }} + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + await github.rest.checks.update({ + ...context.repo, + check_run_id: Number(process.env.CHECK_RUN_ID), + status: 'completed', + conclusion: 'failure', + completed_at: new Date().toISOString(), + output: { + title: 'Rust ADBC dispatch failed', + summary: 'Could not dispatch Rust ADBC integration tests. Check the sender workflow logs.' + } + }); From 8c230dd47a1d4b996cc3a28c47015ad5f909862c Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:16:56 +0000 Subject: [PATCH 2/9] ci(adbc): fix change filtering and dispatch check lifecycle Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 47 +++++++++++++------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index 3c407678..c6fe9f18 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -25,15 +25,14 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}-${{ github.event.label.name || github.event_name }} cancel-in-progress: true jobs: dispatch: if: | - vars.INTEGRATION_TESTS_ENABLED == 'true' && - (github.event_name == 'merge_group' || - (github.event_name == 'pull_request' && github.event.label.name == 'integration-test')) + github.event_name == 'merge_group' || + (github.event_name == 'pull_request' && github.event.label.name == 'integration-test') runs-on: group: databricks-protected-runner-group labels: linux-ubuntu-latest @@ -58,6 +57,7 @@ jobs: } - name: Checkout changed revision + if: vars.INTEGRATION_TESTS_ENABLED == 'true' uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ steps.target.outputs.head_sha }} @@ -66,12 +66,13 @@ jobs: - name: Detect Rust ADBC changes id: changed + if: vars.INTEGRATION_TESTS_ENABLED == 'true' env: BASE_SHA: ${{ steps.target.outputs.base_sha }} HEAD_SHA: ${{ steps.target.outputs.head_sha }} run: | set -euo pipefail - if git diff --quiet "$BASE_SHA" "$HEAD_SHA" -- \ + if git diff --quiet "$BASE_SHA...$HEAD_SHA" -- \ adbc/ .github/workflows/trigger-rust-adbc-integration-tests.yml; then echo "changed=false" >> "$GITHUB_OUTPUT" else @@ -82,7 +83,6 @@ jobs: - name: Generate integration App token id: app-token - if: steps.changed.outputs.changed == 'true' uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 with: app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} @@ -96,19 +96,36 @@ jobs: - name: Create Rust ADBC check id: check - if: steps.changed.outputs.changed == 'true' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: HEAD_SHA: ${{ steps.target.outputs.head_sha }} + TESTS_ENABLED: ${{ vars.INTEGRATION_TESTS_ENABLED }} + ADBC_CHANGED: ${{ steps.changed.outputs.changed }} with: github-token: ${{ steps.app-token.outputs.token }} script: | + const enabled = process.env.TESTS_ENABLED === 'true'; + const runTests = enabled && process.env.ADBC_CHANGED === 'true'; + const timestamp = new Date().toISOString(); + const state = runTests ? { + status: 'in_progress', + started_at: timestamp + } : { + status: 'completed', + conclusion: 'skipped', + completed_at: timestamp, + output: { + title: 'Rust ADBC integration tests skipped', + summary: enabled + ? 'No Rust ADBC driver or trigger workflow changes.' + : 'INTEGRATION_TESTS_ENABLED is not true.' + } + }; const { data: check } = await github.rest.checks.create({ ...context.repo, name: 'Rust ADBC Integration Tests', head_sha: process.env.HEAD_SHA, - status: 'in_progress', - started_at: new Date().toISOString(), + ...state, details_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` }); return check.id; @@ -130,6 +147,7 @@ jobs: })); - name: Dispatch Rust ADBC tests + id: dispatch if: steps.changed.outputs.changed == 'true' uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0 with: @@ -138,11 +156,12 @@ jobs: event-type: rust-adbc-pr-test client-payload: ${{ steps.payload.outputs.json }} - - name: Report dispatch failure - if: failure() && steps.check.outputs.result != '' + - name: Report incomplete dispatch + if: (failure() || cancelled()) && steps.check.outputs.result != '' && steps.changed.outputs.changed == 'true' && steps.dispatch.outcome != 'success' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: CHECK_RUN_ID: ${{ steps.check.outputs.result }} + CONCLUSION: ${{ job.status == 'cancelled' && 'cancelled' || 'failure' }} with: github-token: ${{ steps.app-token.outputs.token }} script: | @@ -150,10 +169,10 @@ jobs: ...context.repo, check_run_id: Number(process.env.CHECK_RUN_ID), status: 'completed', - conclusion: 'failure', + conclusion: process.env.CONCLUSION, completed_at: new Date().toISOString(), output: { - title: 'Rust ADBC dispatch failed', - summary: 'Could not dispatch Rust ADBC integration tests. Check the sender workflow logs.' + title: 'Rust ADBC dispatch incomplete', + summary: `Rust ADBC integration dispatch ${process.env.CONCLUSION}. Check the sender workflow logs.` } }); From 195efd010489e3c196783ba6dbb63c2a51b9dfd6 Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:22:56 +0000 Subject: [PATCH 3/9] ci(adbc): isolate rollout and reuse pending integration checks Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index c6fe9f18..0dc58ec8 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -16,6 +16,8 @@ name: Trigger Rust ADBC Integration Tests # The native kernel gate dispatches separately. Only changes to the Rust ADBC # driver (or this workflow) request the full live ADBC suite in driver-test. +# Advisory check; do not require it on ordinary, unlabeled PRs. +# Enable RUST_ADBC_INTEGRATION_TESTS_ENABLED after driver-test#1957 lands. on: pull_request: types: [labeled] @@ -26,7 +28,8 @@ permissions: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}-${{ github.event.label.name || github.event_name }} - cancel-in-progress: true + # Finish the dispatch before a later run can reuse its pending check. + cancel-in-progress: false jobs: dispatch: @@ -57,7 +60,7 @@ jobs: } - name: Checkout changed revision - if: vars.INTEGRATION_TESTS_ENABLED == 'true' + if: vars.RUST_ADBC_INTEGRATION_TESTS_ENABLED == 'true' uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: ${{ steps.target.outputs.head_sha }} @@ -66,7 +69,7 @@ jobs: - name: Detect Rust ADBC changes id: changed - if: vars.INTEGRATION_TESTS_ENABLED == 'true' + if: vars.RUST_ADBC_INTEGRATION_TESTS_ENABLED == 'true' env: BASE_SHA: ${{ steps.target.outputs.base_sha }} HEAD_SHA: ${{ steps.target.outputs.head_sha }} @@ -99,11 +102,26 @@ jobs: uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: HEAD_SHA: ${{ steps.target.outputs.head_sha }} - TESTS_ENABLED: ${{ vars.INTEGRATION_TESTS_ENABLED }} + TESTS_ENABLED: ${{ vars.RUST_ADBC_INTEGRATION_TESTS_ENABLED }} ADBC_CHANGED: ${{ steps.changed.outputs.changed }} + APP_ID: ${{ secrets.INTEGRATION_TEST_APP_ID }} with: github-token: ${{ steps.app-token.outputs.token }} script: | + const checks = await github.paginate(github.rest.checks.listForRef, { + ...context.repo, + ref: process.env.HEAD_SHA, + check_name: 'Rust ADBC Integration Tests', + per_page: 100 + }); + const pending = checks.find(check => + check.app?.id === Number(process.env.APP_ID) && check.status !== 'completed' + ); + if (pending) { + core.info(`Rust ADBC check ${pending.id} is already pending for this commit.`); + core.setOutput('dispatch', 'false'); + return pending.id; + } const enabled = process.env.TESTS_ENABLED === 'true'; const runTests = enabled && process.env.ADBC_CHANGED === 'true'; const timestamp = new Date().toISOString(); @@ -118,7 +136,7 @@ jobs: title: 'Rust ADBC integration tests skipped', summary: enabled ? 'No Rust ADBC driver or trigger workflow changes.' - : 'INTEGRATION_TESTS_ENABLED is not true.' + : 'RUST_ADBC_INTEGRATION_TESTS_ENABLED is not true.' } }; const { data: check } = await github.rest.checks.create({ @@ -128,11 +146,12 @@ jobs: ...state, details_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}` }); + core.setOutput('dispatch', String(runTests)); return check.id; - name: Build Rust ADBC payload id: payload - if: steps.changed.outputs.changed == 'true' + if: steps.check.outputs.dispatch == 'true' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: HEAD_SHA: ${{ steps.target.outputs.head_sha }} @@ -148,7 +167,7 @@ jobs: - name: Dispatch Rust ADBC tests id: dispatch - if: steps.changed.outputs.changed == 'true' + if: steps.check.outputs.dispatch == 'true' uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0 with: token: ${{ steps.app-token.outputs.token }} @@ -157,7 +176,7 @@ jobs: client-payload: ${{ steps.payload.outputs.json }} - name: Report incomplete dispatch - if: (failure() || cancelled()) && steps.check.outputs.result != '' && steps.changed.outputs.changed == 'true' && steps.dispatch.outcome != 'success' + if: (failure() || cancelled()) && steps.check.outputs.dispatch == 'true' && steps.check.outputs.result != '' && steps.dispatch.outcome != 'success' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: CHECK_RUN_ID: ${{ steps.check.outputs.result }} From ee14801cedab0044e8189ffcbae5b71321c03de2 Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:27:27 +0000 Subject: [PATCH 4/9] ci(adbc): recover stale checks and guard fork dispatches Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index 0dc58ec8..4d9cf3cf 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -35,7 +35,8 @@ jobs: dispatch: if: | github.event_name == 'merge_group' || - (github.event_name == 'pull_request' && github.event.label.name == 'integration-test') + (github.event_name == 'pull_request' && github.event.label.name == 'integration-test' && + github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name) runs-on: group: databricks-protected-runner-group labels: linux-ubuntu-latest @@ -114,13 +115,33 @@ jobs: check_name: 'Rust ADBC Integration Tests', per_page: 100 }); - const pending = checks.find(check => + const pending = checks.filter(check => check.app?.id === Number(process.env.APP_ID) && check.status !== 'completed' ); - if (pending) { - core.info(`Rust ADBC check ${pending.id} is already pending for this commit.`); + // Allow 120 minutes of tests plus an hour for queueing and reporting. + const expiresBefore = Date.now() - 3 * 60 * 60 * 1000; + const expired = check => { + const started = Date.parse(check.started_at || check.created_at || ''); + return !Number.isFinite(started) || started <= expiresBefore; + }; + for (const check of pending.filter(expired)) { + await github.rest.checks.update({ + ...context.repo, + check_run_id: check.id, + status: 'completed', + conclusion: 'cancelled', + completed_at: new Date().toISOString(), + output: { + title: 'Previous Rust ADBC run expired', + summary: 'Superseded by a new request after three hours.' + } + }); + } + const active = pending.find(check => !expired(check)); + if (active) { + core.info(`Rust ADBC check ${active.id} is already pending for this commit.`); core.setOutput('dispatch', 'false'); - return pending.id; + return active.id; } const enabled = process.env.TESTS_ENABLED === 'true'; const runTests = enabled && process.env.ADBC_CHANGED === 'true'; From 2e3b49d2f591d12f72bfae1594f88fa826403f1d Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:32:08 +0000 Subject: [PATCH 5/9] docs(ci): explain intentional Rust ADBC trigger scope Signed-off-by: Vu Anh Phung --- .github/workflows/trigger-rust-adbc-integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index 4d9cf3cf..2d82c614 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -14,8 +14,8 @@ name: Trigger Rust ADBC Integration Tests -# The native kernel gate dispatches separately. Only changes to the Rust ADBC -# driver (or this workflow) request the full live ADBC suite in driver-test. +# Kernel-only changes intentionally skip this suite, matching Python/Node/Go. +# Full nightly ADBC coverage catches regressions from shared kernel changes. # Advisory check; do not require it on ordinary, unlabeled PRs. # Enable RUST_ADBC_INTEGRATION_TESTS_ENABLED after driver-test#1957 lands. on: From 42b77f06fe4bff0cf9cbd30487c19b36b8291007 Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:37:25 +0000 Subject: [PATCH 6/9] ci(adbc): honor label retries and report setup failures Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 72 +++++++++++++------ 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index 2d82c614..a0e8d550 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -41,6 +41,19 @@ jobs: group: databricks-protected-runner-group labels: linux-ubuntu-latest steps: + - name: Generate integration App token + id: app-token + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 + with: + app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} + private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }} + owner: databricks + repositories: | + databricks-sql-kernel + databricks-driver-test + permission-contents: write + permission-checks: write + - name: Resolve test target id: target uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 @@ -85,19 +98,6 @@ jobs: echo "changed=true" >> "$GITHUB_OUTPUT" fi - - name: Generate integration App token - id: app-token - uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 - with: - app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} - private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }} - owner: databricks - repositories: | - databricks-sql-kernel - databricks-driver-test - permission-contents: write - permission-checks: write - - name: Create Rust ADBC check id: check uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 @@ -109,6 +109,9 @@ jobs: with: github-token: ${{ steps.app-token.outputs.token }} script: | + const enabled = process.env.TESTS_ENABLED === 'true'; + const runTests = enabled && process.env.ADBC_CHANGED === 'true'; + const retry = runTests && context.eventName === 'pull_request'; const checks = await github.paginate(github.rest.checks.listForRef, { ...context.repo, ref: process.env.HEAD_SHA, @@ -124,7 +127,7 @@ jobs: const started = Date.parse(check.started_at || check.created_at || ''); return !Number.isFinite(started) || started <= expiresBefore; }; - for (const check of pending.filter(expired)) { + for (const check of pending.filter(check => retry || expired(check))) { await github.rest.checks.update({ ...context.repo, check_run_id: check.id, @@ -132,19 +135,26 @@ jobs: conclusion: 'cancelled', completed_at: new Date().toISOString(), output: { - title: 'Previous Rust ADBC run expired', - summary: 'Superseded by a new request after three hours.' + title: 'Previous Rust ADBC run superseded', + summary: retry + ? 'A maintainer requested a fresh Rust ADBC run.' + : 'Pending check expired after three hours.' } }); } - const active = pending.find(check => !expired(check)); + const active = pending.find(check => !retry && !expired(check)); if (active) { - core.info(`Rust ADBC check ${active.id} is already pending for this commit.`); + await github.rest.checks.update({ + ...context.repo, + check_run_id: active.id, + output: { + title: 'Rust ADBC integration tests already running', + summary: 'An existing run covers this commit. Re-add integration-test on the PR to request a fresh run.' + } + }); core.setOutput('dispatch', 'false'); return active.id; } - const enabled = process.env.TESTS_ENABLED === 'true'; - const runTests = enabled && process.env.ADBC_CHANGED === 'true'; const timestamp = new Date().toISOString(); const state = runTests ? { status: 'in_progress', @@ -216,3 +226,25 @@ jobs: summary: `Rust ADBC integration dispatch ${process.env.CONCLUSION}. Check the sender workflow logs.` } }); + + - name: Report setup failure + if: failure() && steps.check.outputs.result == '' && steps.app-token.outcome == 'success' + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + HEAD_SHA: ${{ steps.target.outputs.head_sha || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + await github.rest.checks.create({ + ...context.repo, + name: 'Rust ADBC Integration Tests', + head_sha: process.env.HEAD_SHA, + status: 'completed', + conclusion: 'failure', + completed_at: new Date().toISOString(), + details_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, + output: { + title: 'Rust ADBC dispatch setup failed', + summary: 'Could not prepare Rust ADBC integration tests. Check the sender workflow logs.' + } + }); From 623b2cb4e9856b669e735350114a4a27cdd41d1a Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:45:35 +0000 Subject: [PATCH 7/9] ci(adbc): expire abandoned checks and identify merge groups Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 89 +++++++++++++++++-- 1 file changed, 81 insertions(+), 8 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index a0e8d550..e84e6321 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -22,10 +22,15 @@ on: pull_request: types: [labeled] merge_group: + schedule: + - cron: '17 * * * *' permissions: contents: read +env: + RUST_ADBC_CHECK_TIMEOUT_HOURS: "3" + concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.merge_group.head_ref || github.ref }}-${{ github.event.label.name || github.event_name }} # Finish the dispatch before a later run can reuse its pending check. @@ -66,11 +71,9 @@ jobs: core.setOutput('pr_number', pr.number); } else { const group = context.payload.merge_group; - const match = /^refs\/heads\/gh-readonly-queue\/.+\/pr-(\d+)-[0-9a-f]+$/.exec(group.head_ref); - if (!match) throw new Error(`Unexpected merge-group ref: ${group.head_ref}`); core.setOutput('base_sha', group.base_sha); core.setOutput('head_sha', group.head_sha); - core.setOutput('pr_number', match[1]); + core.setOutput('merge_group_ref', group.head_ref); } - name: Checkout changed revision @@ -122,11 +125,12 @@ jobs: check.app?.id === Number(process.env.APP_ID) && check.status !== 'completed' ); // Allow 120 minutes of tests plus an hour for queueing and reporting. - const expiresBefore = Date.now() - 3 * 60 * 60 * 1000; + const expiresBefore = Date.now() - Number(process.env.RUST_ADBC_CHECK_TIMEOUT_HOURS) * 60 * 60 * 1000; const expired = check => { const started = Date.parse(check.started_at || check.created_at || ''); return !Number.isFinite(started) || started <= expiresBefore; }; + // The companion receiver preserves cancelled checks and cancels older PR runs. for (const check of pending.filter(check => retry || expired(check))) { await github.rest.checks.update({ ...context.repo, @@ -138,7 +142,7 @@ jobs: title: 'Previous Rust ADBC run superseded', summary: retry ? 'A maintainer requested a fresh Rust ADBC run.' - : 'Pending check expired after three hours.' + : `Pending check expired after ${process.env.RUST_ADBC_CHECK_TIMEOUT_HOURS} hours.` } }); } @@ -187,14 +191,17 @@ jobs: env: HEAD_SHA: ${{ steps.target.outputs.head_sha }} PR_NUMBER: ${{ steps.target.outputs.pr_number }} + MERGE_GROUP_REF: ${{ steps.target.outputs.merge_group_ref }} CHECK_RUN_ID: ${{ steps.check.outputs.result }} with: script: | - core.setOutput('json', JSON.stringify({ + const payload = { commit_sha: process.env.HEAD_SHA, - pr_number: process.env.PR_NUMBER, check_run_id: process.env.CHECK_RUN_ID - })); + }; + if (process.env.PR_NUMBER) payload.pr_number = process.env.PR_NUMBER; + if (process.env.MERGE_GROUP_REF) payload.merge_group_ref = process.env.MERGE_GROUP_REF; + core.setOutput('json', JSON.stringify(payload)); - name: Dispatch Rust ADBC tests id: dispatch @@ -248,3 +255,69 @@ jobs: summary: 'Could not prepare Rust ADBC integration tests. Check the sender workflow logs.' } }); + + expire-stalled-checks: + if: github.event_name == 'schedule' + runs-on: + group: databricks-protected-runner-group + labels: linux-ubuntu-latest + timeout-minutes: 10 + steps: + - name: Generate check maintenance App token + id: app-token + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 + with: + app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} + private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }} + owner: databricks + repositories: databricks-sql-kernel + permission-contents: read + permission-pull-requests: read + permission-checks: write + + - name: Cancel expired Rust ADBC checks on active revisions + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + APP_ID: ${{ secrets.INTEGRATION_TEST_APP_ID }} + with: + github-token: ${{ steps.app-token.outputs.token }} + script: | + const prs = await github.paginate(github.rest.pulls.list, { + ...context.repo, state: 'open', per_page: 100 + }); + const { data: refs } = await github.rest.git.listMatchingRefs({ + ...context.repo, ref: 'heads/gh-readonly-queue/' + }); + const fullName = `${context.repo.owner}/${context.repo.repo}`; + const revisions = new Set([ + ...prs.filter(pr => pr.head.repo?.full_name === fullName).map(pr => pr.head.sha), + ...refs.map(ref => ref.object.sha) + ]); + const expiresBefore = Date.now() - Number(process.env.RUST_ADBC_CHECK_TIMEOUT_HOURS) * 60 * 60 * 1000; + for (const ref of revisions) { + let checks; + try { + checks = await github.paginate(github.rest.checks.listForRef, { + ...context.repo, ref, check_name: 'Rust ADBC Integration Tests', + filter: 'all', status: 'in_progress', per_page: 100 + }); + } catch (error) { + if (error.status === 404) continue; + throw error; + } + for (const check of checks) { + const started = Date.parse(check.started_at || check.created_at || ''); + if (check.app?.id !== Number(process.env.APP_ID) || started > expiresBefore) continue; + await github.rest.checks.update({ + ...context.repo, + check_run_id: check.id, + status: 'completed', + conclusion: 'cancelled', + completed_at: new Date().toISOString(), + output: { + title: 'Rust ADBC check timed out', + summary: `No result within ${process.env.RUST_ADBC_CHECK_TIMEOUT_HOURS} hours. Re-add integration-test to retry.` + } + }); + } + } From c49515c684441b0496f24f51e533ec477a589678 Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:50:31 +0000 Subject: [PATCH 8/9] ci(adbc): inspect all check runs and narrow token scopes Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index e84e6321..f77f0a9c 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -45,18 +45,16 @@ jobs: runs-on: group: databricks-protected-runner-group labels: linux-ubuntu-latest + timeout-minutes: 10 steps: - - name: Generate integration App token + - name: Generate kernel checks App token id: app-token uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 with: app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }} owner: databricks - repositories: | - databricks-sql-kernel - databricks-driver-test - permission-contents: write + repositories: databricks-sql-kernel permission-checks: write - name: Resolve test target @@ -119,6 +117,7 @@ jobs: ...context.repo, ref: process.env.HEAD_SHA, check_name: 'Rust ADBC Integration Tests', + filter: 'all', per_page: 100 }); const pending = checks.filter(check => @@ -203,12 +202,23 @@ jobs: if (process.env.MERGE_GROUP_REF) payload.merge_group_ref = process.env.MERGE_GROUP_REF; core.setOutput('json', JSON.stringify(payload)); + - name: Generate driver-test dispatch token + id: dispatch-token + if: steps.check.outputs.dispatch == 'true' + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 + with: + app-id: ${{ secrets.INTEGRATION_TEST_APP_ID }} + private-key: ${{ secrets.INTEGRATION_TEST_PRIVATE_KEY }} + owner: databricks + repositories: databricks-driver-test + permission-contents: write + - name: Dispatch Rust ADBC tests id: dispatch if: steps.check.outputs.dispatch == 'true' uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0 with: - token: ${{ steps.app-token.outputs.token }} + token: ${{ steps.dispatch-token.outputs.token }} repository: databricks/databricks-driver-test event-type: rust-adbc-pr-test client-payload: ${{ steps.payload.outputs.json }} @@ -257,6 +267,7 @@ jobs: }); expire-stalled-checks: + # Keep maintenance active when dispatch is disabled so existing checks expire. if: github.event_name == 'schedule' runs-on: group: databricks-protected-runner-group From b9c73404a4a5b8b3677ba3759ee658227efe18af Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Sun, 8 Nov 2026 19:56:10 +0000 Subject: [PATCH 9/9] ci(adbc): handle setup cancellation and partial sweep failures Signed-off-by: Vu Anh Phung --- .../trigger-rust-adbc-integration-tests.yml | 69 ++++++++++++------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/.github/workflows/trigger-rust-adbc-integration-tests.yml b/.github/workflows/trigger-rust-adbc-integration-tests.yml index f77f0a9c..9abd9d70 100644 --- a/.github/workflows/trigger-rust-adbc-integration-tests.yml +++ b/.github/workflows/trigger-rust-adbc-integration-tests.yml @@ -244,11 +244,12 @@ jobs: } }); - - name: Report setup failure - if: failure() && steps.check.outputs.result == '' && steps.app-token.outcome == 'success' + - name: Report incomplete setup + if: (failure() || cancelled()) && steps.check.outputs.result == '' && steps.app-token.outcome == 'success' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 env: HEAD_SHA: ${{ steps.target.outputs.head_sha || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} + CONCLUSION: ${{ job.status == 'cancelled' && 'cancelled' || 'failure' }} with: github-token: ${{ steps.app-token.outputs.token }} script: | @@ -257,12 +258,12 @@ jobs: name: 'Rust ADBC Integration Tests', head_sha: process.env.HEAD_SHA, status: 'completed', - conclusion: 'failure', + conclusion: process.env.CONCLUSION, completed_at: new Date().toISOString(), details_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`, output: { - title: 'Rust ADBC dispatch setup failed', - summary: 'Could not prepare Rust ADBC integration tests. Check the sender workflow logs.' + title: 'Rust ADBC dispatch setup incomplete', + summary: `Rust ADBC dispatch setup ${process.env.CONCLUSION}. Check the sender workflow logs.` } }); @@ -293,12 +294,25 @@ jobs: with: github-token: ${{ steps.app-token.outputs.token }} script: | - const prs = await github.paginate(github.rest.pulls.list, { - ...context.repo, state: 'open', per_page: 100 - }); - const { data: refs } = await github.rest.git.listMatchingRefs({ - ...context.repo, ref: 'heads/gh-readonly-queue/' - }); + let failures = 0; + let prs = []; + let refs = []; + try { + prs = await github.paginate(github.rest.pulls.list, { + ...context.repo, state: 'open', per_page: 100 + }); + } catch (error) { + core.warning(`Could not list PR revisions: ${error.message}`); + failures++; + } + try { + ({ data: refs } = await github.rest.git.listMatchingRefs({ + ...context.repo, ref: 'heads/gh-readonly-queue/' + })); + } catch (error) { + core.warning(`Could not list merge-queue revisions: ${error.message}`); + failures++; + } const fullName = `${context.repo.owner}/${context.repo.repo}`; const revisions = new Set([ ...prs.filter(pr => pr.head.repo?.full_name === fullName).map(pr => pr.head.sha), @@ -313,22 +327,29 @@ jobs: filter: 'all', status: 'in_progress', per_page: 100 }); } catch (error) { - if (error.status === 404) continue; - throw error; + core.warning(`Could not inspect Rust ADBC checks at ${ref}: ${error.message}`); + if (error.status !== 404 && error.status !== 422) failures++; + continue; } for (const check of checks) { const started = Date.parse(check.started_at || check.created_at || ''); if (check.app?.id !== Number(process.env.APP_ID) || started > expiresBefore) continue; - await github.rest.checks.update({ - ...context.repo, - check_run_id: check.id, - status: 'completed', - conclusion: 'cancelled', - completed_at: new Date().toISOString(), - output: { - title: 'Rust ADBC check timed out', - summary: `No result within ${process.env.RUST_ADBC_CHECK_TIMEOUT_HOURS} hours. Re-add integration-test to retry.` - } - }); + try { + await github.rest.checks.update({ + ...context.repo, + check_run_id: check.id, + status: 'completed', + conclusion: 'cancelled', + completed_at: new Date().toISOString(), + output: { + title: 'Rust ADBC check timed out', + summary: `No result within ${process.env.RUST_ADBC_CHECK_TIMEOUT_HOURS} hours. Re-add integration-test to retry.` + } + }); + } catch (error) { + core.warning(`Could not expire Rust ADBC check ${check.id}: ${error.message}`); + failures++; + } } } + if (failures) core.setFailed(`Rust ADBC maintenance had ${failures} API failures; see warnings.`);