Skip to content

[VPEX][5/8] Add local-env pipeline, detection, and package-manager interface#5828

Open
rugpanov wants to merge 4 commits into
dbconnect/04-mergefrom
dbconnect/05-pipeline
Open

[VPEX][5/8] Add local-env pipeline, detection, and package-manager interface#5828
rugpanov wants to merge 4 commits into
dbconnect/04-mergefrom
dbconnect/05-pipeline

Conversation

@rugpanov

@rugpanov rugpanov commented Jul 3, 2026

Copy link
Copy Markdown

Context

PR 5 of 8 in the stacked databricks local-env python sync series (see #5823 for the full plan). Stacked on #5827 — review #5823, #5824, #5826, #5827 first; this PR's diff is the five files below. This PR completes the libs/localenv engine; the uv backend and the CLI command follow in PRs 6–8.

What this PR contains

  • pipeline.go — the six-phase orchestrator (preflight → resolve → fetch → merge → provision → validate) that ties the earlier layers together and records per-phase status into the Result. It drives everything through the PackageManager interface, so it's unit-tested end-to-end against a fake package manager and a stub compute client. This file also owns the filesystem/artifact constants and the canonical phase-order slice that the foundation PR intentionally left to their consumer.
  • pkgmanager.go — the PackageManager interface the pipeline provisions through (implemented by uv in the next PR).
  • detect.go — package-manager detection (uv vs conda vs pip) and the writability preflight, biased toward uv since uv's native project file is the pyproject.toml this command already merges.

Worth close review

A read error on an existing pyproject.toml that is not a not-exist error is treated as a failure rather than as greenfield — so a permission change or transient I/O error can never cause the project to be overwritten with a fresh file and no backup (the !greenfield path is the only one that takes a backup).

Dependencies & surface

Depends on the foundation, target, constraints, and merge PRs (#5823/#5824/#5826/#5827). Still dormant — nothing under cmd/ imports the package.

This pull request and its description were written by Isaac.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Waiting for approval

Could not determine reviewers from git history.
Round-robin suggestion: @renaudhartert-db

Eligible reviewers: @andrewnester, @anton-107, @denik, @janniklasrose, @pietern, @renaudhartert-db, @shreyas-goenka, @simonfaltum

Suggestions based on git history. See OWNERS for ownership rules.

@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 12:29 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 12:29 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: d8f0de9

Run: 28679632492

Env 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 7 14 230 1045 4:26
💚​ aws windows 7 14 232 1043 3:44
💚​ aws-ucws linux 7 14 314 963 5:25
💚​ aws-ucws windows 7 14 316 961 3:48
💚​ azure linux 4 15 230 1044 4:39
💚​ azure windows 4 15 232 1042 3:37
💚​ azure-ucws linux 4 15 316 960 5:29
💚​ azure-ucws windows 4 15 318 958 3:37
💚​ gcp linux 4 15 229 1046 3:57
💚​ gcp windows 4 15 231 1044 3:35
21 interesting tests: 14 SKIP, 7 RECOVERED
Test Name aws linux aws windows aws-ucws linux aws-ucws windows azure linux azure windows azure-ucws linux azure-ucws windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct 💚​R 💚​R 💚​R 💚​R
💚​ TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/resources/postgres_branches/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/recreate 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/replace_existing 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/update_protected 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_branches/without_branch_id 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_endpoints/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/postgres_projects/update_display_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/synced_database_tables/basic 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 5 slowest tests (at least 2 minutes):
duration env testname
2:51 aws windows TestAccept
2:50 gcp windows TestAccept
2:45 azure windows TestAccept
2:43 aws-ucws windows TestAccept
2:42 azure-ucws windows TestAccept

@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from ccc19f1 to 92f1dda Compare July 3, 2026 13:20
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from 6289ebf to b94edd5 Compare July 3, 2026 13:20
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 13:21 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 13:21 — with GitHub Actions Inactive
@rugpanov rugpanov changed the title Add dbconnect pipeline, detection, and package-manager interface [VPEX][5/8] Add local-env pipeline, detection, and package-manager interface Jul 3, 2026
@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from 92f1dda to b96bf8b Compare July 3, 2026 15:26
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from b94edd5 to dcdd6f3 Compare July 3, 2026 15:26
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:27 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:27 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from b96bf8b to 6477a4c Compare July 3, 2026 15:31
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from dcdd6f3 to aa3fa6f Compare July 3, 2026 15:31
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:31 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:31 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from 6477a4c to f4cc1c7 Compare July 3, 2026 15:41
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from aa3fa6f to 965e3d0 Compare July 3, 2026 15:41
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:42 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 15:42 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from 965e3d0 to d6aeed6 Compare July 3, 2026 17:55
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 17:55 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 17:55 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:01 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:01 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from 56b496d to 7b23583 Compare July 3, 2026 18:15
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from b7c9e6d to 14d8d17 Compare July 3, 2026 18:15
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:15 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:15 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from 7b23583 to a1644d9 Compare July 3, 2026 18:27
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from 14d8d17 to c010a22 Compare July 3, 2026 18:27
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:27 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 18:27 — with GitHub Actions Inactive
rugpanov added 3 commits July 3, 2026 21:13
Fifth in the stacked local-env series. This completes the libs/localenv
engine; the uv backend and the CLI command follow in later PRs.

- pipeline.go: the six-phase orchestrator (preflight → resolve → fetch →
  merge → provision → validate) that ties the earlier layers together and
  records per-phase status into the Result. It drives everything through the
  PackageManager interface, so it is unit-tested end to end against a fake
  package manager and a stub compute client. This file also owns the
  filesystem/artifact constants and the canonical phase-order slice, which
  the foundation PR intentionally left to their consumer.
- pkgmanager.go: the PackageManager interface the pipeline provisions
  through (implemented by uv in the next PR).
- detect.go: package-manager detection (uv vs conda vs pip) and the
  writability preflight, biased toward uv since uv's native project file is
  the pyproject.toml this command already merges.

A read error on an existing pyproject.toml that is not a not-exist error is
treated as a failure rather than as greenfield, so a permission or transient
I/O error can never cause the project to be overwritten with a fresh file
and no backup.

Depends on the foundation, target, constraints, and merge PRs. The package
is still dormant: nothing under cmd/ imports it.

Co-authored-by: Isaac
Review of the pipeline layer found:

- applyMerge treated every os.Stat error on the backup as "does not exist" and
  proceeded to copyFile over it. An existing-but-unstattable backup (permission
  or I/O error) would thus be overwritten with the already-merged content,
  destroying the canonical original the merge base relies on. It now only
  creates the backup on os.ErrNotExist and fails on any other stat error.

- A backup-copy failure was reported with DiskMutated=false even though
  copyFile creates/truncates the .bak path and can leave a partial file. That
  path now reports DiskMutated=true.

- majorVersion accepted any non-empty prefix before the first dot, so a
  malformed version like "bad.version" yielded major "bad" and could be
  compared as a real major. It now returns "" for a non-numeric major so the
  validate phase rejects malformed versions.

Adds a direct applyMerge test for the unstattable-backup branch and extends
the majorVersion cases with non-numeric inputs.

Co-authored-by: Isaac
Round-4 review noted preflight ran ensureWritable even under --check, which
creates and removes a temp file (a disk mutation in a dry run) and fails a
read-only project the user only wants to inspect. The probe now runs only for a
real (non-check) run; it exists to fail fast before a write that --check never
performs.

Co-authored-by: Isaac
@rugpanov rugpanov force-pushed the dbconnect/04-merge branch from a1644d9 to 79113e4 Compare July 3, 2026 19:14
@rugpanov rugpanov force-pushed the dbconnect/05-pipeline branch from c010a22 to 27e56f9 Compare July 3, 2026 19:14
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 19:15 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 3, 2026 19:15 — with GitHub Actions Inactive
Round-5 review noted that although --check now skips the writability probe, it
still called PackageManager.EnsureAvailable, which may install the manager (uv)
when missing — another disk mutation in a dry run. Preflight now performs
neither write-side step under --check (neither is needed to compute the plan)
and reports the phase as "check". Adds a test with a PackageManager that errors
on every method, asserting --check still succeeds and produces a plan.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants