Skip to content

Remove unused Locker.Write and Locker.Read - #8116

Open
denik wants to merge 1 commit into
mainfrom
remove-locker-write-read
Open

denik wants to merge 1 commit into
mainfrom
remove-locker-write-read

Conversation

@denik

@denik denik commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Delete Locker.Write and Locker.Read from libs/locker. They wrote and read an arbitrary file under the lock's directory, only while the lock was held. The deploy lock never used them: bundle commands only call CreateLocker, Lock, Unlock and Active, and the lock file itself goes through the locker's own filer.
  • Delete the part of the TestLock integration test in integration/libs/locker that only checked these two methods (an inactive locker can't write or read, an active one round-trips foo.json), plus its two now-unused imports. The rest of TestLock is unchanged.

Why

Code with no production callers can go along with the tests that only check it. This is part of replacing integration/ with acceptance tests (integration/README.md): these asserts tested code the CLI never runs, so there is nothing to port. It is kept separate from #8059 (the deploy-lock acceptance test) for easier review.

Evidence that nothing else calls them

  • rg -n '\b[Ll]ocker\.(Write|Read)\(' --glob '*.go' --glob '!*_test.go' at main: no matches. In tests, the only callers were the four calls in integration/libs/locker/locker_test.go this PR deletes.
  • The error texts failed to put file. deploy lock not held and failed to get file. deploy lock not held appear nowhere else in the repo (code, goldens, docs).
  • deadcode (the tool behind task deadcode): CI runs it with -test, and TestLock was what kept both methods live there. Without -test, deadcode -whylive reports both as "reachable only through reflection". The only reflective method lookups in the repo are libs/calladapt (resource adapters' Do* methods) and bundle/internal/validation/enum.go (Values); neither is handed a Locker. *Locker is never stored in an interface.
  • After the change, go build ./..., go vet, task lint-go-root and tools/check_deadcode.py pass, and the trimmed TestLock passes on AWS.

Tests

  • TestLock (integration, AWS): --- PASS: TestLock (3.19s) after the change.
  • go test ./libs/locker: pass.

Judgment calls

  • TestLock keeps two checks that the CLI calls but never reaches in the tested state: five lockers racing in one process, and Unlock on a locker that never acquired. Those are a separate question and stay in place.
  • This PR and #8059 both edit the import block of integration/libs/locker/locker_test.go on adjacent lines, so whichever merges second needs a trivial rebase.

This PR was created by the integration-deprecation loop.

🤖 AI agent (opus5.5, isaac_claude)

This pull request and its description were written by Isaac.

Nothing outside tests calls them: the deploy lock only writes and reads
deploy.lock itself, through Lock, Unlock and GetActiveLockState. Drop the
part of the TestLock integration test that only checked them.

Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 30bbf96

Run: 45997123361

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 176 17 4:16
💚​ aws-windows-latest-4core-16gb 1 176 17 3:22
💚​ azure linux-2core-8gb 1 175 17 4:38
💚​ azure-windows-latest-4core-16gb 1 175 17 3:30
💚​ gcp linux-2core-8gb 1 176 17 4:27
💚​ gcp-windows-latest-4core-16gb 1 176 17 3:21
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:02 gcp linux-2core-8gb TestAccept
3:30 aws linux-2core-8gb TestAccept
3:28 azure linux-2core-8gb TestAccept
3:27 azure-windows-latest-4core-16gb TestAccept
3:20 aws-windows-latest-4core-16gb TestAccept
3:18 gcp-windows-latest-4core-16gb TestAccept

@denik
denik marked this pull request as ready for review November 27, 2026 12:35
@denik
denik requested review from a team as code owners November 27, 2026 12:35
@denik
denik requested review from Sankalp-Mittal, andrewnester and mihaimitrea-db and removed request for mihaimitrea-db November 27, 2026 12:35

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at 30bbf96. Each finding was verified against the code.

No blocking issues found.

This PR deletes the unused Locker.Write and Locker.Read methods from libs/locker, along with the part of the TestLock integration test that only exercised them. I found no remaining callers. Every import in locker.go is still used (bytes, io and errors all have other uses), and the trimmed test still covers which lockers are active, Unlock failing on inactive lockers, and the unlock/re-acquire round-trip. I have no defects to report; this looks good to merge.

@andrewnester andrewnester 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.

No blocking findings from a full pass; I'll take a manual look at the locker changes before approving.

This branch has not been deployed

No deployments
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.

3 participants