Skip to content

[Bug Bash] Frictionless VSCode Python Setup — default-on build - #2111

Draft
rugpanov wants to merge 9 commits into
mainfrom
bugbash/python-setup
Draft

[Bug Bash] Frictionless VSCode Python Setup — default-on build#2111
rugpanov wants to merge 9 commits into
mainfrom
bugbash/python-setup

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Not for merge — bug-bash build only. Draft PR whose sole purpose is to have CI
produce a darwin-arm64 VSIX for the Frictionless VSCode Python Setup bug bash
(Thu Aug 13, 3:00pm).

What this branch is

  • Stacked on feat(python-setup): detect compute drift and offer re-run #2110 (python-setup-drift-detection), so the build includes the
    compute-drift-detection work that's also under test.
  • Plus one change: flips the default of databricks.experiments.optInto to
    include environment.pythonSetup, so the feature is enabled by default.
    Testers just install the VSIX — no enable script, no manual settings — which is
    exactly the default-on experience the bug bash is a go/no-go on.

Getting the VSIX

Open the "Package Arm64 VSIX" check on this PR → its Actions run → download the
"VSIX artifacts" artifact → code --install-extension <file>.vsix → reload.

After the bug bash

Discard this draft. If the result is GO, the default-on flip lands via a proper PR
(and #2110 merges on its own track).

This pull request and its description were written by Isaac.

@rugpanov

rugpanov commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 3 of 4 test jobs failed for 67b6a6a0 (0 passed, 1 skipped).
View run

@rugpanov
rugpanov marked this pull request as ready for review August 13, 2026 10:34
*Why*
Drift detection needs one place to decide whether the recorded environment key
still matches the selected compute's, with a fail-safe rule that unknown inputs
never raise a false alarm.

*What*
Add a pure isDrifted(persistedEnvKey, currentEnvKey) helper plus unit tests
covering equal/differing keys and both unknown-input cases.

*Verification*
yarn workspace databricks run test:unit --grep "isDrifted" — 5 passing.

Co-authored-by: Isaac
*Why*
Drift detection needs the authoritative environment key for the selected
compute without mutating disk; a dry run resolves compute and reports
compute.envKey while writing nothing.

*What*
Add an optional dryRun flag to SetupLocalInvocation and emit --dry-run from
buildSetupLocalArgs when set (before --output json). Cover the on/off cases in
the args unit test.

*Verification*
yarn workspace databricks run test:unit --grep "buildSetupLocalArgs" — passing.

Co-authored-by: Isaac
*Why*
We want to measure how often a stale local environment is detected and whether
the passive indicator drives re-runs, matching the rest of the python-setup
funnel.

*What*
Add the PYTHON_ENV_DRIFT event (trigger + from/to envKey) to the telemetry
schema and a recordPythonSetupDrift emitter that sanitizes both keys through
categoricalEnvKey. Cover the happy path and the unrecognized-key collapse.

*Verification*
yarn workspace databricks run test:unit --grep "recordPythonSetupDrift" — passing.

Co-authored-by: Isaac
*Why*
Something has to watch for the selected compute drifting away from the recorded
setup state, silently and without nagging, and hold a flag the config view can
render.

*What*
Add PythonSetupDriftManager: gated + debounced, it resolves the current envKey
authoritatively via an injected seam, compares with isDrifted, exposes a
drifted flag + onDidChangeState, reports python_env.drift once per distinct
mismatch, and stays fail-safe when the key is unknown. evaluate() swallows any
dep rejection (e.g. isVisible/dry-run failing) as "unknown" and leaves the flag
untouched, so the debounced void path can never leak an unhandled rejection; the
generation guard now also covers the post-isVisible early-return branches so a
stale evaluate cannot retract a fresher flag. Unit-tested via fakes.

*Verification*
yarn workspace databricks run test:unit — 683 passing, 0 failing, 10 pending;
all 8 PythonSetupDriftManager tests pass with no unhandled-rejection output.

Co-authored-by: Isaac
*Why*
The config-view Python row now reflects two independent signals — setup
readiness and compute drift. When the local environment has drifted from the
selected compute, the row should say so and offer a one-click re-run, taking
precedence over the ready/set-up states, and it must refresh when either
signal changes.

*What*
- Extend PythonSetupEntry with a drifted flag and give buildPythonSetupEntry a
  third state: a warning-icon "Python environment out of date" row wired to the
  re-run command, with drift taking precedence over ready.
- Add composePythonSetupEntry to merge the setup controller's ready and the
  drift manager's drifted into one PythonSetupEntry with a merged change event
  and forwarded getters.
- Update EnvironmentComponent.getRoot to pass drifted + the re-run command id
  into the builder, and wire the composed entry in extension.ts (with an inert
  drift source until the drift manager is wired) so the package compiles.

*Verification*
yarn workspace databricks run test:unit — 687 passing, 0 failing, 10 pending.
yarn workspace databricks run build — exit 0.

Co-authored-by: Isaac
*Why*
The drift manager and the config-view row state exist but nothing drives them;
the composition root must build the manager, feed it the selected compute's env
key via a silent CLI dry-run, subscribe it to compute/open/setup triggers, and
show its state in the configuration row.

*What*
Replace the inert placeholder drift source in activate() with a real
PythonSetupDriftManager: a silent, fail-safe resolveCurrentEnvKey (reusing
resolveComputeFrom + a --dry-run CLI call, returning undefined on any failure
and never surfacing UI), wired to compute-change / workspace-open /
setup-completed triggers, and passed to the already-present composed
setup+drift config-view entry. Remove the now-unused EventEmitter import (and
its undisposed inert emitter). Also register the previously-unregistered
databricks.environment.rerunPythonEnv command (a base-branch gap the drifted
row's click depends on), reusing the re-entrancy-guarded setup handler, and add
its package.json command entry. Additive; no new storage.

*Verification*
yarn build, yarn test:lint, and yarn test:unit all pass (687 passing, 10
pending, 0 failing — baseline unchanged). Manual Extension Development Host
smoke left for a human (GUI-only): switching compute flips the row to "out of
date" (no toast) and a re-run clears it.

Co-authored-by: Isaac
*Why*
Clicking the drifted "Python environment" row did nothing. The row reused the
same tree-item id as the ready/set-up row, and VS Code does not reliably rebind
a node's command when the same id swaps to a different command on refresh: the
label updated but the click stayed bound to the old (inert) command. Ready and
set-up share one command (setupPythonEnv); the drifted state points at a
distinct command (rerunPythonEnv, for its own re-run telemetry), so it must be a
separate node.

*What*
Give the drifted row a distinct tree-item id so it renders as a fresh node and
its rerunPythonEnv command binds. Rename the row label to "Python environment is
drifted". Add a regression test asserting the drifted id differs from the
ready/set-up id.

*Verification*
yarn workspace databricks run test:unit — 688 passing, 0 failing, 10 pending.

Co-authored-by: Isaac
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for f97ebb20 — ⏳ running.
View run

@rugpanov
rugpanov force-pushed the bugbash/python-setup branch from f97ebb2 to 978dde4 Compare August 13, 2026 10:43
@rugpanov
rugpanov deployed to test-trigger-is August 13, 2026 10:43 — with GitHub Actions Active
@rugpanov
rugpanov deployed to test-trigger-is August 13, 2026 10:44 — with GitHub Actions Active
@rugpanov

rugpanov commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ✅ all 35 test jobs passed for 978dde4f.
View run

@rugpanov
rugpanov marked this pull request as draft August 13, 2026 10:46
…o-op checks

*Why*
Re-picking the serverless version while serverless was already selected (e.g.
v4 -> v2) fired neither onDidChangeCluster nor onDidChangeState — it only writes
the serverlessVersion config key — so drift was never re-evaluated and the row
never updated. Separately, onDidChangeCluster fires on every cluster runtime
state transition (RUNNING -> TERMINATED), each spawning a dry-run that cannot
change the answer; and a detached compute left a stale drift badge.

*What*
- Watch the serverlessVersion config key and re-check drift on change.
- Add a cheap synchronous compute-descriptor to the drift manager: skip the
  dry-run when a compute-change trigger's identity is unchanged (a runtime-state
  transition, not a switch), and clear drift when no comparable compute is
  attached (you cannot be drifted from nothing). Transient dry-run failures
  still leave the flag unchanged (fail-safe).
- Unit tests for the skip and clear paths; realistic recurrence in the dedupe
  test (a distinct compute identity).

*Verification*
yarn workspace databricks run test:unit — 756 passing, 0 failing, 10 pending;
test:lint clean.

Co-authored-by: Isaac
*Why*: The Aug 13 bug bash decides go/no-go on shipping environment.pythonSetup
enabled by default. Testers should validate that exact experience by just
installing the VSIX — no enable script, no manual settings.

*What*: Flip the default of `databricks.experiments.optInto` to include
`environment.pythonSetup`. Every gate (isPythonSetupEnabled, FeatureManager, the
when-clause context key) reads this setting, so the single default change turns
the feature on for fresh installs. Rebased on the latest #2110 head so the build
carries its newest drift-detection fixes.

*Verification*: CI (push.yml) builds the darwin-arm64 "VSIX artifacts" for this
PR; installing that build shows the Python setup row with no opt-in. Bug-bash
build only — not intended to merge.

Co-authored-by: Isaac
@rugpanov
rugpanov marked this pull request as ready for review August 13, 2026 11:25
@rugpanov
rugpanov force-pushed the bugbash/python-setup branch from 978dde4 to 7ed77e9 Compare August 13, 2026 11:25
@rugpanov
rugpanov deployed to test-trigger-is August 13, 2026 11:25 — 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: 2111
  • Commit SHA: 7ed77e97ae994d7d87bee895570ea33d22b437a4

Checks will be approved automatically on success.

@rugpanov
rugpanov deployed to test-trigger-is August 13, 2026 11:26 — with GitHub Actions Active
@rugpanov

rugpanov commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ❌ 1 of 35 test jobs failed for 7ed77e97 (34 passed).
View run

@rugpanov
rugpanov marked this pull request as draft August 13, 2026 11:28
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.

1 participant