Skip to content

[VPEX][5c] Skip constraint cache writes under --check#5854

Open
rugpanov wants to merge 2 commits into
mainfrom
dbconnect/05c-check-nocache
Open

[VPEX][5c] Skip constraint cache writes under --check#5854
rugpanov wants to merge 2 commits into
mainfrom
dbconnect/05c-check-nocache

Conversation

@rugpanov

@rugpanov rugpanov commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Why

Codex review of the pipeline PR (#5851) flagged that a --check dry run still writes to disk: FetchConstraints populates the on-disk constraint cache on every successful live fetch, so --check mutated the cache directory whenever it was writable — even though the pipeline deliberately skips every other write-side step (writability probe, package-manager availability, the pyproject.toml write) under --check.

The cache lives under os.UserCacheDir() and is disposable, so this was never a correctness or safety bug. But the code frames --check as performing no writes, and this was the one path that broke that framing. This makes behavior match the contract.

What

  • Thread a writeCache bool through FetchConstraints. When false, the successful live-fetch path skips writeCacheAtomic. An existing cache is still read for offline fallback, since reading is not a mutation.
  • The pipeline passes !p.Check, so a real run caches as before and a dry run does not.

Testing strategy

  • TestFetchConstraintsSkipsCacheWriteWhenDisabled — a live fetch with writeCache=false succeeds but leaves the cache dir empty.
  • TestPipelineCheckMutatesNothing — strengthened to assert the cache dir stays empty after a --check run (previously it only checked the project file).
  • Gates: go build, go test, golangci-lint (0 issues), deadcode, gofmt — all green.

About this stack

Follow-up to the databricks local-env python sync stack. It is stacked on #5851 (the six-phase pipeline) because the fix spans two layers: the cache write lives in the fetch layer, but the --check dry-run concept it must respect only exists in the pipeline. Review bottom-up — this PR's diff shows only the cache-write change.

This pull request and its description were written by Isaac.

@rugpanov rugpanov temporarily deployed to test-trigger-is July 8, 2026 11:02 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 8, 2026 11:02 — with GitHub Actions Inactive
@eng-dev-ecosystem-bot

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

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: ad1b317

Run: 29259258191

Env 🟨​KNOWN 🔄​flaky 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
💚​ aws linux 4 4 230 1083 5:05
💚​ aws windows 4 4 232 1081 6:50
💚​ aws-ucws linux 4 4 316 1000 7:19
💚​ aws-ucws windows 4 4 318 998 7:56
💚​ azure linux 4 4 230 1082 5:59
💚​ azure windows 4 4 232 1080 6:52
💚​ azure-ucws linux 4 4 318 997 7:41
🟨​ azure-ucws windows 2 1 1 4 320 995 9:19
💚​ gcp linux 4 4 229 1084 5:10
🔄​ gcp windows 1 3 4 231 1082 9:05
8 interesting tests: 4 SKIP, 2 KNOWN, 1 RECOVERED, 1 flaky
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/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 🟨​K 💚​R 🔄​f
🔄​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 🔄​f 💚​R 💚​R
🟨​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R 🟨​K 💚​R 💚​R
Top 10 slowest tests (at least 2 minutes):
duration env testname
6:38 aws-ucws windows TestAccept
6:21 azure-ucws windows TestAccept
6:01 gcp windows TestAccept
5:55 azure windows TestAccept
5:52 aws windows TestAccept
2:51 gcp linux TestAccept
2:49 azure linux TestAccept
2:49 aws linux TestAccept
2:47 aws-ucws linux TestAccept
2:44 azure-ucws linux TestAccept

@rugpanov rugpanov force-pushed the dbconnect/05b-pipeline branch from af9d41b to c2e8b69 Compare July 8, 2026 14:44
@rugpanov rugpanov force-pushed the dbconnect/05c-check-nocache branch from 8b12b87 to 4716210 Compare July 8, 2026 14:44
@rugpanov rugpanov temporarily deployed to test-trigger-is July 8, 2026 14:44 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 8, 2026 14:44 — with GitHub Actions Inactive

@anton-107 anton-107 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.

Approving. Tight, correct follow-up: writeCache threaded through FetchConstraints with the pipeline passing !p.Check, and an existing cache is still read for offline fallback (reading isn't a mutation) — exactly right. Test pair is the right shape: unit (TestFetchConstraintsSkipsCacheWriteWhenDisabled) plus the strengthened end-to-end TestPipelineCheckMutatesNothing asserting the cache dir stays empty. All call sites updated. No findings.

@rugpanov rugpanov force-pushed the dbconnect/05c-check-nocache branch from 4716210 to d6462fd Compare July 9, 2026 14:06
@rugpanov rugpanov temporarily deployed to test-trigger-is July 9, 2026 14:06 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 9, 2026 14:06 — with GitHub Actions Inactive
@rugpanov rugpanov force-pushed the dbconnect/05c-check-nocache branch from d6462fd to 3127207 Compare July 10, 2026 13:37
@rugpanov rugpanov temporarily deployed to test-trigger-is July 10, 2026 13:37 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 10, 2026 13:37 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 13, 2026 14:23 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 13, 2026 14:23 — with GitHub Actions Inactive
Base automatically changed from dbconnect/05b-pipeline to main July 13, 2026 14:30
@rugpanov rugpanov force-pushed the dbconnect/05c-check-nocache branch from 4bd0477 to b09b9ce Compare July 13, 2026 14:30
@rugpanov

Copy link
Copy Markdown
Contributor Author

codex review [P2] — duplicate databricks-connect pins — fixed in b09b9ce.

Confirmed the bug (reproduced: 2 pins for both dev = ["databricks-connect~=16", opening-line arrays and elements with a trailing comment). The multi-line detection used an anchored per-line regex (dbconnectLineRe, …"$) that started scanning at devStart+1, so a pin on the dev = [ line or one carrying a trailing comment was missed → the insert path added a second pin.

Fix: the multi-line branch now scans the whole array span (devStart..arrayLast), detects an existing databricks-connect token comment-aware (via dbconnectTokenRe), and rewrites it in place; it inserts only when no element exists anywhere. Removed the now-unused dbconnectLineRe. Regression tests: TestMergeReplacesDatabricksConnectOnDevLine, TestMergeReplacesDatabricksConnectWithTrailingComment. All gates green.

rugpanov added 2 commits July 13, 2026 16:41
A --check dry run must not mutate disk, but FetchConstraints wrote the
fetched artifact into the cache dir on every successful live fetch — so a
dry run still populated the cache whenever it was writable, even though the
pipeline skips every other write-side step under --check.

Thread a writeCache flag through FetchConstraints; the pipeline passes
!p.Check. An existing cache is still read for offline fallback, since
reading is not a mutation. Assert both directly (FetchConstraints with
writeCache=false leaves the cache dir empty) and end-to-end (the --check
pipeline test now checks the cache dir stays empty too).

Reported by codex review of the pipeline PR.

Co-authored-by: Isaac
Address two correctness nits from review of the pipeline PR (#5851). Since
that PR was already queued to merge, the fixes land here in the follow-up.

- mergeDatabricksConnect only ever *replaced* an existing databricks-connect
  element, so a default-mode sync of an existing project that didn't already
  pin databricks-connect wrote the file back with no pin; uv installed nothing
  and validate failed with E_VALIDATE. It now *inserts* the pin — into the dev
  array (single- or multi-line), creating the dev key and the
  [dependency-groups] table when absent — mirroring RenderFreshPyproject.
  Constraints-only (empty value) stays a no-op; the insert path is idempotent.

- Greenfield rendered name = filepath.Base(ProjectDir), which is "." when run
  from the project's own directory (and "/" at root) — not a valid PEP 621
  name, so uv sync rejected the file. projectName() now resolves via
  filepath.Abs and sanitizes to a valid PEP 508 identifier, falling back to a
  default when nothing usable remains.

Co-authored-by: Isaac
@rugpanov rugpanov force-pushed the dbconnect/05c-check-nocache branch from b09b9ce to ad1b317 Compare July 13, 2026 14:42
@rugpanov rugpanov temporarily deployed to test-trigger-is July 13, 2026 14:43 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 13, 2026 14:43 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 13, 2026 14:43 — with GitHub Actions Inactive
@rugpanov rugpanov temporarily deployed to test-trigger-is July 13, 2026 14:43 — with GitHub Actions Inactive
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.

3 participants