Skip to content

Create the root_path dir in bundle generate pipeline when nothing is downloaded - #8289

Open
denik wants to merge 2 commits into
acc-record-generate-pipeline-empty-root-pathfrom
fix-generate-pipeline-empty-root-path
Open

denik wants to merge 2 commits into
acc-record-generate-pipeline-empty-root-pathfrom
fix-generate-pipeline-empty-root-path

Conversation

@denik

@denik denik commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Changes

bundle generate pipeline for a pipeline with root_path now creates the source directory after downloading. Before, it was only created as a side effect of downloading files. So for a root_path that is an empty workspace folder, the generated config pointed at a directory that did not exist, and bundle validate failed with stat src/pl: no such file or directory.

This uses the same fix as #8244 for bundle generate app: one os.MkdirAll(sourceDir) after FlushToDisk, only when the pipeline has a root_path. Pipelines without root_path don't get root_path in the generated config and don't need the directory, so they are unchanged.

Stacked on #8287 (the test recording the bug). Review this PR's own commit only, or wait for #8287 to merge.

Why

The generated bundle should load without manual fixes. A newly created Lakeflow pipeline whose root folder has no files yet is a realistic input.

This PR was created by analyzing coverage gaps.

Coverage: http://go/cli/dashboard/coverage/file/cmd/bundle/generate/pipeline.go (NewGeneratePipelineCommand, the RootPath != "" branch around lines 91-96).

Tests

acceptance/bundle/generate/pipeline_empty_root_path (added in #8287) now shows src/pl created and Validation OK!, and its Badness is removed. Other bundle/generate pipeline tests pass unchanged (pipeline, lakeflow_pipelines, pipeline_with_glob, pipeline_and_deploy, auto-bind).

Gaps and risks

  • Only local (testserver).
  • MkdirAll on an existing directory does nothing, so re-running generate over an existing src/ is unaffected.
  • Risk: low.

Reviewed by an AI agent (gpt-6-2-astra, high effort): no findings.

🤖 AI agent (author claude-opus-5-5, review gpt-6-2-astra, isaac_claude)

This pull request and its description were written by Isaac.

…downloaded

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

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 12670a609 | Workflow run

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

2 tests: regression=2 unreleased=0 coverage=0 failing=0
test branch main (21589ba) latest (v1.28.0)
TestAccept/bundle/generate/pipeline_empty_root_path/DMS= ✅ ❌ ❌
TestAccept/bundle/generate/pipeline_empty_root_path/DMS=true ✅ ❌ ❌
TestAccept/bundle/generate/pipeline_empty_root_path/DMS=: branch ✅ | main (21589ba) ❌ | latest (v1.28.0) ❌

main (21589ba):

acceptance_test.go:1439: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1439
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1180
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:730
        	Error:      	Not equal: 
        	            	expected: "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nsrc/pl\n\n>>> [CLI] bundle validate\nName: pipeline_empty_root_path\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default\n\nValidation OK!\n"
        	            	actual  : "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nExpected 1, got 0\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -10,12 +10,5 @@
        	            	 >>> find.py --dirs ^src/pl$ --expect 1
        	            	-src/pl
        	            	+Expected 1, got 0
        	            	 
        	            	->>> [CLI] bundle validate
        	            	-Name: pipeline_empty_root_path
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default
        	            	+Exit code: 1
        	            	 
        	            	-Validation OK!
        	            	-
        	Test:       	TestAccept/bundle/generate/pipeline_empty_root_path/DMS=
        	Messages:   	bundle/generate/pipeline_empty_root_path/output.txt vs /tmp/TestAcceptbundlegeneratepipeline_empty_root_pathDMS=2998857146/002/output.txt

latest (v1.28.0):

acceptance_test.go:1439: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1439
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1180
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:730
        	Error:      	Not equal: 
        	            	expected: "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nsrc/pl\n\n>>> [CLI] bundle validate\nName: pipeline_empty_root_path\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default\n\nValidation OK!\n"
        	            	actual  : "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nExpected 1, got 0\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -10,12 +10,5 @@
        	            	 >>> find.py --dirs ^src/pl$ --expect 1
        	            	-src/pl
        	            	+Expected 1, got 0
        	            	 
        	            	->>> [CLI] bundle validate
        	            	-Name: pipeline_empty_root_path
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default
        	            	+Exit code: 1
        	            	 
        	            	-Validation OK!
        	            	-
        	Test:       	TestAccept/bundle/generate/pipeline_empty_root_path/DMS=
        	Messages:   	bundle/generate/pipeline_empty_root_path/output.txt vs /tmp/TestAcceptbundlegeneratepipeline_empty_root_pathDMS=3407290819/002/output.txt
FAIL
TestAccept/bundle/generate/pipeline_empty_root_path/DMS=true: branch ✅ | main (21589ba) ❌ | latest (v1.28.0) ❌

main (21589ba):

acceptance_test.go:1439: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1439
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1180
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:730
        	Error:      	Not equal: 
        	            	expected: "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nsrc/pl\n\n>>> [CLI] bundle validate\nName: pipeline_empty_root_path\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default\n\nValidation OK!\n"
        	            	actual  : "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nExpected 1, got 0\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -10,12 +10,5 @@
        	            	 >>> find.py --dirs ^src/pl$ --expect 1
        	            	-src/pl
        	            	+Expected 1, got 0
        	            	 
        	            	->>> [CLI] bundle validate
        	            	-Name: pipeline_empty_root_path
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default
        	            	+Exit code: 1
        	            	 
        	            	-Validation OK!
        	            	-
        	Test:       	TestAccept/bundle/generate/pipeline_empty_root_path/DMS=true
        	Messages:   	bundle/generate/pipeline_empty_root_path/output.txt vs /tmp/TestAcceptbundlegeneratepipeline_empty_root_pathDMS=true3371787700/002/output.txt
FAIL

latest (v1.28.0):

acceptance_test.go:1439: 
        	Error Trace:	/home/runner/work/cli/cli/libs/testdiff/testdiff.go:22
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1439
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:1180
        	            				/home/runner/work/cli/cli/acceptance/acceptance_test.go:730
        	Error:      	Not equal: 
        	            	expected: "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nsrc/pl\n\n>>> [CLI] bundle validate\nName: pipeline_empty_root_path\nTarget: default\nWorkspace:\n  User: [USERNAME]\n  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default\n\nValidation OK!\n"
        	            	actual  : "\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace mkdirs /Workspace/Users/[USERNAME]/my_pipeline\n\n>>> MSYS_NO_PATHCONV=1 [CLI] workspace list /Workspace/Users/[USERNAME]/my_pipeline\nID  Type  Language  Path\n\n>>> [CLI] bundle generate pipeline --existing-pipeline-id [UUID] --key out --config-dir . --source-dir src/pl\nPipeline configuration successfully saved to out.pipeline.yml\n\n>>> find.py --dirs ^src/pl$ --expect 1\nExpected 1, got 0\n\nExit code: 1\n"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -10,12 +10,5 @@
        	            	 >>> find.py --dirs ^src/pl$ --expect 1
        	            	-src/pl
        	            	+Expected 1, got 0
        	            	 
        	            	->>> [CLI] bundle validate
        	            	-Name: pipeline_empty_root_path
        	            	-Target: default
        	            	-Workspace:
        	            	-  User: [USERNAME]
        	            	-  Path: /Workspace/Users/[USERNAME]/.bundle/pipeline_empty_root_path/default
        	            	+Exit code: 1
        	            	 
        	            	-Validation OK!
        	            	-
        	Test:       	TestAccept/bundle/generate/pipeline_empty_root_path/DMS=true
        	Messages:   	bundle/generate/pipeline_empty_root_path/output.txt vs /tmp/TestAcceptbundlegeneratepipeline_empty_root_pathDMS=true2598309180/002/output.txt
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 12670a6

Run: 46846718343

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 60 7 1:47
💚​ aws-windows-latest-4core-16gb 1 60 7 3:08
💚​ azure linux-2core-8gb 1 60 7 1:57
💚​ azure-windows-latest-4core-16gb 1 60 7 3:01
💚​ gcp linux-2core-8gb 1 60 7 1:44
💚​ gcp-windows-latest-4core-16gb 1 60 7 3:07
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:06 aws-windows-latest-4core-16gb TestAccept
3:06 gcp-windows-latest-4core-16gb TestAccept
3:00 azure-windows-latest-4core-16gb TestAccept
@denik
denik marked this pull request as ready for review December 2, 2026 09:26
@denik
denik requested review from a team as code owners December 2, 2026 09:26

@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 12670a6. Each finding was verified against the code.

No blocking issues found.

This PR makes bundle generate pipeline create the root_path source directory after FlushToDisk, so a pipeline whose workspace root folder has no files now produces a bundle that passes bundle validate. The guard is the same one used to mark the root path for download, it matches the existing fix in app.go, and the updated acceptance test covers the empty-folder case. One thing I checked and set aside: if the YAML already exists and --force isn't set, the command can leave an empty src/pl behind. That's harmless, FlushToDisk already writes files at that point, and app.go behaves the same way. I found no defects that should block the merge.

@Sankalp-Mittal Sankalp-Mittal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[AI Generated] Review by review-factory (Claude Opus 5.5 + Claude Opus 5.5, cross-verified). Only points the reviewers agreed on are posted.

No issues found.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants