Skip to content

[10/?] feat(python-setup): setup-state storage key for drift detection - #2055

Merged
rugpanov merged 2 commits into
mainfrom
rugpanov/python-setup-state
Jul 28, 2026
Merged

[10/?] feat(python-setup): setup-state storage key for drift detection#2055
rugpanov merged 2 commits into
mainfrom
rugpanov/python-setup-state

Conversation

@rugpanov

Copy link
Copy Markdown
Contributor

Why

After a successful uv-native Python environment setup, the extension needs to remember what environment was provisioned, so a later change of compute target can be detected as drift (the local env no longer matches the selected target) and surfaced to the user. This lands the persistence key.

Scoped deliberately to the storage layer: it builds off main with no dependency on the (still-open) wiring stack. The write site — the orchestrator's saveState — is wired separately when the extension-wiring PR (#2054) lands; it currently holds a TODO(DECO-27784) no-op that this key will back.

What

  • PythonSetupState type — {envKey, pythonVersion, timestamp}:
    • envKey: the CLI's resolved environment key for the target (e.g. serverless/serverless-v5).
    • pythonVersion: the provisioned interpreter minor version (e.g. 3.12).
    • timestamp: ISO-8601 time of the successful setup.
  • "databricks.pythonSetup.setupState" StorageConfigurations entry, workspace-scoped (drift is per-project). Flows through the existing typed get/set surface — no new accessor code.
  • First StateStorage unit test (in-memory Memento fake): round-trip, undefined-before-write, clear-on-undefined, and workspace-not-global placement.

Verification

  • yarn --cwd packages/databricks-vscode build / test:lint / test:unit — 329 passing (4 new). Build confirms the typed key resolves through get/set.

This pull request and its description were written by Isaac.

*Why*
After a successful uv-native setup, the extension needs to remember what
environment was provisioned so a later change of compute target can be detected
as drift and surfaced to the user. This adds the persistence key; the write site
(the orchestrator's saveState) is wired separately when the extension-wiring PR
lands (it currently holds a TODO(DECO-27784) no-op).

*What*
- Add the PythonSetupState type ({envKey, pythonVersion, timestamp}) and a
  workspace-scoped StorageConfigurations entry
  "databricks.pythonSetup.setupState". Workspace (per-project) location because
  drift is per-project. Flows through the existing typed get/set surface.
- Add the first StateStorage unit test (in-memory Memento fake): round-trip,
  undefined-before-write, clear-on-undefined, and workspace-not-global placement.

*Verification*
yarn --cwd packages/databricks-vscode build / test:lint / test:unit
(329 passing; 4 new). Build confirms the typed key resolves through get/set.

Co-authored-by: Isaac
@rugpanov

rugpanov commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests ✅ all 35 test jobs passed for 3c81cfb0.
View run

@rugpanov rugpanov changed the title [9/?] feat(python-setup): setup-state storage key for drift detection [10/?] feat(python-setup): setup-state storage key for drift detection Jul 27, 2026
@rugpanov
rugpanov enabled auto-merge (squash) July 28, 2026 09:40
@rugpanov
rugpanov temporarily deployed to test-trigger-is July 28, 2026 09:41 — with GitHub Actions Inactive
@rugpanov
rugpanov merged commit 2f18f16 into main Jul 28, 2026
6 checks passed
@rugpanov

Copy link
Copy Markdown
Contributor Author

🤖 Integration tests triggered for 202b7373 — ⏳ running.
View run

@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: 2055
  • Commit SHA: 202b7373368c66aac96d82451c0e4d8f2f254f57

Checks will be approved automatically on success.

@rugpanov
rugpanov temporarily deployed to test-trigger-is July 28, 2026 09:44 — with GitHub Actions Inactive
rugpanov added a commit that referenced this pull request Jul 29, 2026
*Why*
The extension-wiring PR left saveState as a TODO(DECO-27784) no-op and carried
seam-doc comments claiming the visibility/compute seams were still stubbed.
Both are now resolved: the storage key landed (#2055) and this PR wires the real
implementations.

*What*
- Implement saveState (DECO-27784 write half): makePythonSetupDeps stamps the
  orchestrator's {envKey, pythonVersion} with an ISO-8601 timestamp and forwards
  it through a new injected persistSetupState seam; extension.ts wires that to
  stateStorage.set("databricks.pythonSetup.setupState", ...). Workspace-scoped,
  so drift detection is per-project.
- Correct the now-stale PythonSetupSetupDeps seam docs on isVisible/resolveCompute
  -- they described "the extension passes a stub"; the real gate (flag +
  shouldShowPythonSetup) and compute resolution (cluster / persisted
  serverlessVersion) are now wired.
- Tests: makePythonSetupDeps.saveState stamps+forwards a valid timestamp;
  adoptInterpreter routes through the seam with the OS-correct venv path.

*Verification*
yarn --cwd packages/databricks-vscode build / test:lint (clean); test:unit
429 passing (VSCODE_TEST_VERSION=1.130.0; default stable pulls VS Code 1.131.0
which breaks @vscode/test-electron locally -- repo-wide infra skew, unrelated).

Co-authored-by: Isaac
@github-actions github-actions Bot mentioned this pull request Jul 30, 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