Repository navigation
Conversation
6f996e0 to
32e3283
Compare
Regression test report ✅Commit: Selected 1 changed tests (limit=20, 0 not selected) 2 tests: regression=2 unreleased=0 coverage=0 failing=0
TestAccept/bundle/python/venv-path-subdir/DMS=/PYDAB_VERSION=current: branch ✅ | main (9e5ad79) ❌ | latest (v1.28.0) ❌main (9e5ad79): latest (v1.28.0): 1 more failure details omitted, see the full report in the run. |
✅ Integration test reportCommit: 75ed012
Top 3 slowest tests (at least 2 minutes):
|
66aaff2 to
7fdc45f
Compare
There was a problem hiding this comment.
Automated review at 7fdc45f. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) and 1 question(s) below.
This PR resolves a relative python.venv_path against the bundle root and passes an absolute interpreter path to the subprocess, so bundle commands work from a subdirectory, including with a relative DATABRICKS_BUNDLE_ROOT. The fix works for the template default .venv, and the new acceptance and unit cases cover it. I have one open question: should relative paths be resolved against the bundle root or against the file that defines them? I also have two small doc fixes.
Questions
- Should a relative
venv_pathresolve against the directory of the file that defines it, asRewriteSyncPaths(bundle/config/mutator/rewrite_sync_paths.go) andtranslate_pathsdo through the value's dyn location, rather than against the bundle root? As written,venv_path: .venvinsub/python.ymlresolves to<root>/.venv, whilesync.pathsin the same file resolves under<root>/sub/. Switching later would be a second behavior change. Options: resolve via the dyn location now, or keep bundle-root-relative and document it. (non-blocking)
Comments outside the changed lines
- [nice to have]
bundle/config/experimental.go: This PR decides that a relativevenv_pathis resolved against the bundle root, but theVEnvPathdoc comment still only says "path to the virtual environment". Users who read the schema won't learn this, and they can't tell whyvenv_path: .venvinresources/python.ymlpoints at<root>/.venv. Can the comment say that relative paths resolve against the bundle root, withbundle/schema/jsonschema.jsonregenerated?
7fdc45f to
de1c5a8
Compare
|
🤖 Thanks for the review. Answers to the review body: Bundle root vs. the defining file. I kept bundle-root-relative and documented it (de1c5a8), rather than resolving through the dyn location:
Docs. Done in de1c5a8: the AI agent (opus5.5, isaac_claude) |
|
Heads-up: #7975 removed the To fix: use |
|
🤖 Thanks, fixed in 7b6ce93: a merge of the test branch (no force-push). With the fix all three AI agent (opus5.5, isaac_claude) |
A relative venv_path was resolved against the current directory, so every bundle command run from a subdirectory of a bundle with the pydabs template default venv_path: .venv failed with can't find ".venv/bin/python3". Join a relative venv_path with the bundle root and return an absolute interpreter path (the subprocess runs in the bundle root, so a path relative to the current directory fails there, e.g. with DATABRICKS_BUNDLE_ROOT=..). Windows drive-relative (C:venv) and drive-rooted (\venv) values keep their meaning. Document the rule on venv_path and regenerate the schema. Co-authored-by: Isaac <no-reply@databricks.com>
There was a problem hiding this comment.
Automated review at 7b6ce93. Each finding was verified against the code.
No blocking issues found. 2 non-blocking comment(s) and 1 question(s) below.
This PR resolves a relative python.venv_path against the bundle root and passes an absolute interpreter path to the Python subprocess, so bundle commands now work from a subdirectory. The fix works for the template default set in the root databricks.yml. Two test-side gaps remain: the unit stub never checks the interpreter it is given, and one acceptance replacement never matches anything. Also, the "can't find" error now shows the path joined with the bundle root, so the description's claim that the error text is unchanged only holds in the unit test, where the bundle root is empty.
Questions
- Other relative paths in bundle config resolve against the directory of the file that defines them (
rewrite_sync_paths.gousesfilepath.Dir(v.Location().File), andtranslate_pathsdoes the same). This PR resolvesvenv_pathagainst the bundle root instead, sovenv_path: .venvin an includedsub/python.ymlpoints to<root>/.venv, and the schema description now documents that rule publicly. ShouldgetOptsuse the directory ofvenv_path'sdyn.Locationinstead? For the template default in the rootdatabricks.ymlthat gives the same result. Or is root-relative deliberate, to match the subprocess working directory, in which case is it worth committing to in the schema? (non-blocking)
7b6ce93 to
cbba414
Compare
|
🤖 Rebased onto main after #8181 merged: now one fix-only commit, cbba414. Its diff is the same as the previous head 7b6ce93 minus the test-PR commits; the test it updates is now on main. Unit tests, TestAccept/bundle/python and bundle/templates/pydabs pass locally, and the venv-path-subdir test still fails at the AI agent (opus5.5, isaac_claude) |
…unused Repl withProcessStub now compares the command line with the expected arguments, and withFakeVEnv returns the absolute interpreter path, so the unit tests pin both the bundle-root join and the absolute path. The venv-path-subdir output no longer has an interpreter path, so its Repl never matched. Co-authored-by: Isaac <no-reply@databricks.com>
Changes
detectExecutablein the Python mutator now joins a relativevenv_pathwith the bundle root before looking up the interpreter, and returns the interpreter as an absolute path: the subprocess runs with the bundle root as its working directory, so a path relative to the current directory would not resolve there (e.g. withDATABRICKS_BUNDLE_ROOT=..). An absolute path, an unsetvenv_path(Python from PATH), and on Windows a drive-relative (C:venv) or drive-rooted (\venv) path behave as before; the "can't find" error text is unchanged.Why
With the pydabs template default
venv_path: .venv, every bundle command run from a subdirectory of the bundle failed to find the venv (see the test PR #8181). The Python subprocess already runs in the bundle root, and the other relative paths in databricks.yml are relative to it as well.Tests
bundle summaryfromsrc/now prints the same job as from the root; Badness removed. A new case runs it fromsrc/with a relativeDATABRICKS_BUNDLE_ROOT=..; it fails without the absolute path (fork/exec ../.venv/bin/python3: no such file or directory).can't find ".venv/bin/python3").go test ./bundle/... ./libs/python/...and TestAccept/bundle/python and bundle/templates/pydabs pass locally.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).
Gaps and risks
filepath.IsAbs/Joinhandle both separators and CI covers the unit test there.venv_pathis relative to the bundle root even when it is set in an included file in a subdirectory (before it was relative to the current directory, so neither matched the defining file);../.venvunder a symlinked bundle root resolves lexically. All look rare next to the template default.venv. Thevenv_pathdoc comment and schema description now say a relative path is relative to the bundle root.🤖 AI agent (opus5.5, isaac_claude)
This pull request and its description were written by Isaac.