Skip to content

feat(python-setup): resolve serverless version from pyproject.toml - #2130

Merged
rugpanov merged 3 commits into
mainfrom
feat-pyproject-serverless-version
Aug 19, 2026
Merged

feat(python-setup): resolve serverless version from pyproject.toml#2130
rugpanov merged 3 commits into
mainfrom
feat-pyproject-serverless-version

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Why

The environments team is introducing a [tool.databricks.environment] table in pyproject.toml that carries the serverless environment_version:

[tool.databricks.environment]
environment_version = "4"

The CLI writes this section during a serverless setup-local run. Because it is an explicit user declaration, it is a more reliable signal for the serverless version picker than the current heuristics (bundle YAML, notebook metadata, workspace default), and it lets the chosen value round-trip.

What

  • Add a new pyproject scoring source, weighted above every current signal (200 vs bundle's 100), so an explicit declaration becomes the recommended default — while still flowing through the picker, so there is no silent auto-selection.
  • New pyprojectServerlessVersion.ts: a pure, comment-aware line scan that reads environment_version from the canonical [tool.databricks.environment] table (no TOML dependency — matching the repo's existing pyproject.toml handling in packageManagerDetection.ts), plus a thin I/O reader over the project-root file.
  • Wire the source into collectServerlessVersionObservations as an independently guarded branch, and label it pyproject.toml in the picker's provenance.

Purely additive: no behaviour change when there is no pyproject.toml or no [tool.databricks.environment] table. Extends the earlier serverless version resolution work (#2052 / #2053).

Scope note

The scan handles the canonical block form the paired CLI work writes; exotic TOML spellings (dotted-key / inline-table) are intentionally not parsed. A value outside the supported range is dropped like any other source (the CLI would reject it too).

Verification

  • yarn test:unit858 passing, 0 failing (11 new pyproject collector tests + 3 extended scoring/observations/picker tests).
  • prettier -c and eslint clean on all changed files.

This pull request and its description were written by Isaac.

*Why*

The environments team is introducing a `[tool.databricks.environment]` table
in `pyproject.toml` that carries the serverless `environment_version`, written
by the CLI during a serverless setup-local run. Because it is an explicit user
declaration, it is a more reliable signal for the serverless version picker than
the existing heuristics (bundle YAML, notebook metadata, workspace default), and
lets the chosen value round-trip.

*What*

- Add a new `pyproject` scoring source, weighted above every current signal, so
  an explicit declaration becomes the recommended default while still flowing
  through the picker (no silent auto-selection).
- New `pyprojectServerlessVersion.ts`: a pure, comment-aware line scan that reads
  `environment_version` from the canonical `[tool.databricks.environment]` table
  (no TOML dependency, matching the repo's existing pyproject handling), plus a
  thin I/O reader over the project-root file.
- Wire the source into the observation collector as an independently guarded
  branch, and label it "pyproject.toml" in the picker.

Purely additive: no behaviour change when there is no `pyproject.toml` or no
`[tool.databricks.environment]` table.

*Verification*

- `yarn test:unit` — 858 passing, 0 failing (11 new pyproject tests + 3 extended
  scoring/observations/picker tests).
- `prettier -c` and `eslint` clean on all changed files.

Co-authored-by: Isaac
@rugpanov
rugpanov deployed to test-trigger-is August 19, 2026 09:17 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 19, 2026 09:17 — with GitHub Actions Active
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for 9c0772a1 — ⏳ running.
View run

*Why*

Review feedback: the resolver docstrings still enumerated the evidence sources
without the new pyproject.toml one, and the pyproject line scanner's
string-context blind spots were only partly documented.

*What*

- Name pyproject.toml alongside the other sources in serverlessVersionResolver
  docstrings.
- Extend the pyprojectServerlessVersion doc-comment to state the accepted
  line-scan limitations (multi-line strings, array-continuation lines), matching
  the sibling packageManagerDetection scanners.

Comment-only; no behaviour change.

*Verification*

- prettier -c and eslint clean on both files.

Co-authored-by: Isaac
@rugpanov
rugpanov deployed to test-trigger-is August 19, 2026 09:25 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 19, 2026 09:25 — with GitHub Actions Active
@rugpanov

rugpanov commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 1 of 37 test jobs failed for 8dd4ff2d (36 passed).
View run

@rugpanov
rugpanov marked this pull request as ready for review August 19, 2026 09:37
@rugpanov

Copy link
Copy Markdown
Contributor Author

Integration Tests failure is an unrelated flake — not caused by this PR.

Only a single Windows e2e shard failed; all Linux shards and the rest of the Windows matrix passed. The failing suite is Bundle Init (should initialize new project / should wait for connection / should find resource explorer view), and the root cause is a dropped WebDriver connection:

Error: waitUntil condition failed: Connection closed. Code: 1006
WebDriverError: no such window: target window already closed
from unknown error: web view not found

This is a WebDriver/webview websocket flake (1006 = abnormal closure) in the test harness, not a product failure. This PR only touches the serverless-version resolution utilities under python-setup/utils/, which the Bundle Init flow does not exercise. Unit tests pass on both Linux and Windows (852+ passing; the single Windows unit failure was a separate bundled CLI version process-spawn timeout flake, which has been re-run).

Re-triggering the e2e job.

@rugpanov
rugpanov deployed to test-trigger-is August 19, 2026 12:58 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown
Contributor

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/vscode

Inputs:

  • PR number: 2130
  • Commit SHA: 39c8752287272f0c7d9f785aa89fc2aaa4b9f62f

Checks will be approved automatically on success.

@rugpanov
rugpanov deployed to test-trigger-is August 19, 2026 12:58 — with GitHub Actions Active
@rugpanov
rugpanov merged commit f7008b6 into main Aug 19, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants