Skip to content

acc: record relative python.venv_path failing from a bundle subdirectory - #8181

Merged
denik merged 4 commits into
mainfrom
denik/acc-python-venv-subdir
Nov 30, 2026
Merged

denik merged 4 commits into
mainfrom
denik/acc-python-venv-subdir

Conversation

@denik

@denik denik commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Changes

New test acceptance/bundle/python/venv-path-subdir: a bundle with python.venv_path: .venv (the default in the pydabs template) and a venv with databricks-bundles in the bundle root, and a Python loader that adds one job. bundle summary lists the job from the root and fails from src/:

Error: failed to get Python interpreter path: can't find ".venv/bin/python3", check if virtualenv is created

The Python mutator passes venv_path to the venv lookup as is, so a relative path is resolved against the current directory. Bundle commands otherwise work from any directory inside the bundle, and the Python subprocess itself already runs in the bundle root. Badness in test.toml says what is wrong and what is right.

Why

This PR was created by analyzing coverage gaps. Coverage: http://go/cli/dashboard/coverage/file/bundle/config/mutator/python/python_mutator.go ((*pythonMutator).Apply, lines 231-369).
I added a new small test rather than extending a test under bundle/python, because none of them creates a venv; they all use uv run --with. It runs only for PYDAB_VERSION=current (the bug doesn't depend on the databricks-bundles version) and takes ~1.5s per variant locally, most of it for uv venv and uv pip install of the local wheel.

Fix: #8184

Gaps and risks

  • Only Linux was run locally; the test also runs on Windows in CI (a Repl maps bin/python3 and Scripts\python.exe to [VENV_PYTHON]).
  • Risk: low (test only).

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions github-actions Bot added DABs DABs related issues PyDABs test-only-fix PRs that update failing of flaky tests without changing CLI code. labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 88f45d5a4 | Workflow run

Selected 1 changed tests (limit=20, 0 not selected)

2 tests: regression=0 unreleased=0 coverage=2 failing=0
test branch main (3442593) latest (v1.28.0)
TestAccept/bundle/python/venv-path-subdir/DMS=/PYDAB_VERSION=current ✅ ✅ ✅
TestAccept/bundle/python/venv-path-subdir/DMS=true/PYDAB_VERSION=current ✅ ✅ ✅

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 88f45d5

Run: 46423749652

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 90 7 3:01
💚​ aws-windows-latest-4core-16gb 1 90 7 3:05
💚​ azure linux-2core-8gb 1 90 7 2:56
💚​ azure-windows-latest-4core-16gb 1 90 7 3:18
💚​ gcp linux-2core-8gb 1 90 7 3:56
💚​ gcp-windows-latest-4core-16gb 1 90 7 2:37
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
3:16 azure-windows-latest-4core-16gb TestAccept
3:03 aws-windows-latest-4core-16gb TestAccept
2:36 gcp-windows-latest-4core-16gb TestAccept

The script and the recorded error use the Unix venv layout (bin/python3).

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik marked this pull request as ready for review November 30, 2026 01:20
@denik
denik requested review from a team as code owners November 30, 2026 01:20

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at 642d8d1. Each finding was verified against the code.

No blocking issues found. 3 non-blocking comment(s) below.

This PR adds an acceptance test, with a Badness entry, showing that a relative python.venv_path is resolved against the current directory: bundle validate works from the bundle root and fails from src/. The setup matches the bug in python_mutator.go, and the golden output follows from the script. Three changes would make the test better, none of them blocking: keep it running on Windows, make the root run and the src/ run produce comparable output that shows Python actually loaded something, and use the existing script helpers.

…t and src

Co-authored-by: Isaac <no-reply@databricks.com>
@denik

denik commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Heads-up: #7975 removed the errcode acceptance helper, so the errcode calls this PR adds will fail with errcode: command not found once it's tested against current main.

To fix: use musterr CMD for a command that must fail, and run commands expected to succeed without a wrapper. When the exact exit code is what the test checks, print it after musterr with printf '\nExit code: %s\n' "$MUSTERR_EXIT_CODE". cmd || true is only for best-effort cleanup. Details are in .agents/rules/testing.md.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik
denik requested a review from andrewnester November 30, 2026 12:56
@denik

denik commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Thanks, fixed in 88f45d5 (a new commit, no force-push): the bundle-root bundle summary runs without a wrapper, and the src/ run, which records the bug, is now musterr. The golden only lost the Exit code: 1 line. The test passes on this branch and merged with current main, where errcode no longer exists.

AI agent (opus5.5, isaac_claude)

@denik
denik added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 3009b3e Nov 30, 2026
30 checks passed
@denik
denik deleted the denik/acc-python-venv-subdir branch November 30, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues factory-generated PyDABs test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants