From 1c0b749800a7dd66a440c602f2ede13c8f23b587 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 23 Jul 2026 17:59:55 +0200 Subject: [PATCH 1/4] acc: fix change detection skipping new tests on windows/macOS PRs The acceptance subset selector runs `git diff --merge-base origin/main` to always run the tests a PR adds/changes on the windows/macOS cells, but the test job's shallow checkout has no origin/main, so the diff failed and the error was swallowed, silently disabling change detection. Fetch origin/main in CI and fail loudly on a failed diff instead. --- .github/workflows/push.yml | 15 +++++++++++++++ acceptance/acceptance_test.go | 2 +- acceptance/skiplocal_test.go | 18 ++++++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 593b0ad8229..4f39093beb3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -137,6 +137,21 @@ jobs: with: cache-key: test-${{ matrix.deployment }} + # Make origin/main available with enough history for `git diff --merge-base + # origin/main`, which the acceptance subset selector uses to always run the + # tests this PR adds/changes on the windows/macOS cells. actions/checkout does + # a shallow single-ref clone by default, so origin/main is otherwise absent and + # the diff fails, silently disabling change detection. This must run AFTER + # setup-build-environment, whose own checkout would re-shallow the repo. Only + # PRs subset tests, so the fetch is unnecessary elsewhere. + - name: Fetch origin/main for change detection + if: ${{ github.event_name == 'pull_request' }} + run: | + git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main + if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then + git fetch --no-tags --unshallow origin + fi + - name: Run tests env: ENVFILTER: DATABRICKS_BUNDLE_ENGINE=${{ matrix.deployment }} diff --git a/acceptance/acceptance_test.go b/acceptance/acceptance_test.go index ae650a19ddf..2c9c2b31a1c 100644 --- a/acceptance/acceptance_test.go +++ b/acceptance/acceptance_test.go @@ -450,7 +450,7 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int { // subset selector keep these tests, so detect them at most once here. var changedTests map[string][]string if skipLocalWithChanged || subset.enabled { - changedTests = selectChangedLocalTests(testDirsSet) + changedTests = selectChangedLocalTests(t, testDirsSet) } subset.changed = changedTests diff --git a/acceptance/skiplocal_test.go b/acceptance/skiplocal_test.go index c72f7c39a3f..e627b90587e 100644 --- a/acceptance/skiplocal_test.go +++ b/acceptance/skiplocal_test.go @@ -1,10 +1,12 @@ package acceptance_test import ( + "errors" "os/exec" "path/filepath" "slices" "strings" + "testing" ) // DATABRICKS_TEST_SKIPLOCAL controls skipping of Local acceptance tests. @@ -61,8 +63,20 @@ func testDirForFile(repoRelPath string, testDirs map[string]bool) string { // committed. The three-dot form origin/main...HEAD only covers committed // changes and misses unstaged edits, which breaks the "touch a config, run // the test" local dev workflow (same reason lintdiff.py uses --merge-base). -func selectChangedLocalTests(testDirs map[string]bool) map[string][]string { - out, _ := exec.Command("git", "diff", "--name-status", "--merge-base", "-M", "origin/main").Output() +func selectChangedLocalTests(t *testing.T, testDirs map[string]bool) map[string][]string { + out, err := exec.Command("git", "diff", "--name-status", "--merge-base", "-M", "origin/main").Output() + if err != nil { + // A failed diff (most commonly a missing origin/main in a shallow CI + // checkout) must not be silently treated as "nothing changed": that + // disables change detection and lets newly added tests skip on every + // windows/macOS PR run. Fail loudly instead. See push.yml, which fetches + // full history so origin/main resolves. + stderr := "" + if exitErr, ok := errors.AsType[*exec.ExitError](err); ok { + stderr = strings.TrimSpace(string(exitErr.Stderr)) + } + t.Fatalf("git diff --merge-base origin/main failed: %v\n%s", err, stderr) + } diff := strings.TrimSpace(string(out)) // result accumulates dirs with their filters; added tracks brand-new dirs. From d2893a017ff77d315e6e0f5fcb45c29d1d36401b Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 23 Jul 2026 18:08:01 +0200 Subject: [PATCH 2/4] TEMP: verify change detection selects modified test on all OSes Do not merge. Modifies selftest/basic/script so its golden comparison fails, to confirm from CI logs that change detection runs this test on the windows/macOS subset cells (not skipped by TESTS_SELECT_SUBSET_PCT). --- acceptance/selftest/basic/script | 3 +++ 1 file changed, 3 insertions(+) diff --git a/acceptance/selftest/basic/script b/acceptance/selftest/basic/script index 546d4a4b80e..0ab588b8e49 100644 --- a/acceptance/selftest/basic/script +++ b/acceptance/selftest/basic/script @@ -36,3 +36,6 @@ trace $CLI --version touch ignored_file.txt mkdir ignored_dir touch ignored_dir/hello.txt + +printf "\n=== TEMP: intentional divergence to verify change detection selects this test\n" +echo "this line is not in output.txt and must fail the golden comparison" From e113e42d4f35b0ba9a2679ccd1d13177280c9adb Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 23 Jul 2026 18:32:21 +0200 Subject: [PATCH 3/4] Revert "TEMP: verify change detection selects modified test on all OSes" This reverts commit d2893a017ff77d315e6e0f5fcb45c29d1d36401b. --- acceptance/selftest/basic/script | 3 --- 1 file changed, 3 deletions(-) diff --git a/acceptance/selftest/basic/script b/acceptance/selftest/basic/script index 0ab588b8e49..546d4a4b80e 100644 --- a/acceptance/selftest/basic/script +++ b/acceptance/selftest/basic/script @@ -36,6 +36,3 @@ trace $CLI --version touch ignored_file.txt mkdir ignored_dir touch ignored_dir/hello.txt - -printf "\n=== TEMP: intentional divergence to verify change detection selects this test\n" -echo "this line is not in output.txt and must fail the golden comparison" From cd3252bb75bec32fcadfdee4a6ac015e2ace986f Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Fri, 24 Jul 2026 09:10:52 +0200 Subject: [PATCH 4/4] acc: fail open when change detection diff fails t.Fatal on a failed `git diff --merge-base origin/main` broke integration runs (DATABRICKS_TEST_SKIPLOCAL=withchanged) whose checkout has no origin/main. Log a warning and continue instead; the push.yml PR cells still fetch full history so change detection works there. --- acceptance/skiplocal_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/acceptance/skiplocal_test.go b/acceptance/skiplocal_test.go index e627b90587e..a16de1f0ef2 100644 --- a/acceptance/skiplocal_test.go +++ b/acceptance/skiplocal_test.go @@ -67,15 +67,16 @@ func selectChangedLocalTests(t *testing.T, testDirs map[string]bool) map[string] out, err := exec.Command("git", "diff", "--name-status", "--merge-base", "-M", "origin/main").Output() if err != nil { // A failed diff (most commonly a missing origin/main in a shallow CI - // checkout) must not be silently treated as "nothing changed": that - // disables change detection and lets newly added tests skip on every - // windows/macOS PR run. Fail loudly instead. See push.yml, which fetches - // full history so origin/main resolves. + // checkout) disables change detection, so newly added tests fall back to + // the seeded subset and may not run. Log loudly but continue: failing the + // test here breaks integration runs whose checkout has no origin/main. The + // push.yml PR cells fetch full history so origin/main resolves there. stderr := "" if exitErr, ok := errors.AsType[*exec.ExitError](err); ok { stderr = strings.TrimSpace(string(exitErr.Stderr)) } - t.Fatalf("git diff --merge-base origin/main failed: %v\n%s", err, stderr) + t.Logf("WARNING: change detection disabled: git diff --merge-base origin/main failed: %v\n%s", err, stderr) + return nil } diff := strings.TrimSpace(string(out))