Skip to content

refactor(client): lint and add tests for workspace_client#722

Merged
skevetter merged 3 commits into
mainfrom
heroic-crocodile
Jul 23, 2026
Merged

refactor(client): lint and add tests for workspace_client#722
skevetter merged 3 commits into
mainfrom
heroic-crocodile

Conversation

@skevetter

Copy link
Copy Markdown
Contributor

Summary

From-scratch redesign of pkg/client/clientimplementation/workspace_client.go:

  • Reorder methods so exported (interface) methods precede unexported helpers (funcorder).
  • Extract focused helpers to cut cyclomatic/nesting complexity in Delete, Status, agentInfo, StartWait, and DeleteWorkspaceFolder.
  • Deduplicate the repeated agent-command plumbing into agentWorkspaceCommand + runProviderCommand.
  • Centralize string literals (commandName constant, config.BoolTrue); replace os.Pipe fan-out with an agentPipes struct.
  • Wrap previously-dropped errors (%w), lowercase and shorten error/log messages, and use errors.New for static-message errors.
  • Remove inline comments; the code is self-documenting.

Also fixes a latent nil-dereference in the forced machine-delete path (the old code could call Delete on a nil machine client under --force).

Behavior-preserving otherwise; independently code-reviewed. Resolves all golangci-lint findings in the file; go build/go vet clean.

…liance

Reorganize workspace_client.go: exported methods before unexported, extract
helpers to reduce cyclomatic/nesting complexity, deduplicate agent-command
plumbing, centralize string literals, wrap dropped errors, and use errors.New
for static messages. Fixes a latent nil-deref in the forced machine-delete
path. Resolves all golangci-lint issues in the file.
@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit b853ee8
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a616831254b720008bed566

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@skevetter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: af5d9bee-bc6a-4302-bc2c-07696f74f826

📥 Commits

Reviewing files that changed from the base of the PR and between 6c3139d and b853ee8.

📒 Files selected for processing (16)
  • cmd/pro/cluster/list.go
  • cmd/pro/health.go
  • cmd/pro/project/list.go
  • cmd/pro/self.go
  • cmd/pro/template/list.go
  • cmd/pro/version.go
  • cmd/pro/workspace/create.go
  • cmd/pro/workspace/list.go
  • cmd/pro/workspace/update.go
  • cmd/pro/workspace/watch.go
  • cmd/provider/configure_shared.go
  • pkg/client/clientimplementation/machine_client.go
  • pkg/client/clientimplementation/proxy_client.go
  • pkg/client/clientimplementation/workspace_client.go
  • pkg/client/clientimplementation/workspace_client_test.go
  • pkg/workspace/list.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit b853ee8
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a61682f8000b30007cfd581

…d tests

Remove the unused CommandOptions.Name field and the execParams.name plumbing
that only fed it, along with all operation-label setters across cmd/ and
pkg/workspace. Add a separator to the container-status wrapped-error format
(%s%w -> %s: %w). Add unit tests for the redesigned helpers (handleForceError,
deleteContext, removeAll, RunCommand, logBusy, and the StartWait status
handlers).
@skevetter skevetter changed the title refactor(client): redesign workspace_client for clarity and lint compliance refactor(client): lint and add tests for workspace_client Jul 23, 2026
@skevetter
skevetter marked this pull request as ready for review July 23, 2026 02:48
@skevetter
skevetter merged commit 386ba58 into main Jul 23, 2026
64 checks passed
@skevetter
skevetter deleted the heroic-crocodile branch July 23, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant