Skip to content

refactor(workspace): name delete lifecycle stages - #1601

Merged
skevetter merged 1 commit into
mainfrom
refactor/workspace-delete-stages
Oct 20, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/workspace-delete-stages

Conversation

@skevetter

@skevetter skevetter commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Split Delete in pkg/workspace/delete.go into named private stages: loadDeleteClient, removeImportedLocalWorkspace, removeWorkspaceResources, cleanupDeletedWorkspaceFiles.
  • Delete now reads as the lifecycle: load client, quiesce, imported-folder branch, pre-delete check, lock, re-quiesce, stop, remove resources, cleanup.
  • Only pkg/workspace/delete.go changed. No new comments added.

Why

Delete held four inline progress.RunStep closures interleaved with lifecycle ordering, making each stage hard to locate and review. Behavior is unchanged: same progress messages and phase, same lock and defer timing, both quiesce calls kept, cleanup runs only after resource removal succeeds, and the returned id is preserved on cleanup failure.

Validation

  • mise run cli:format: exit 0.
  • CI-parity lint (golangci-lint config verify plus golangci-lint run --new-from-patch=<merge-base diff> --new=false ./...): 0 issues. Run with --allow-parallel-runners because the shared golangci-lint lock blocked the mise run cli:lint:ci wrapper.
  • golangci-lint run --allow-parallel-runners --new-from-rev=origin/main ./pkg/workspace/...: 0 issues.
  • go test ./pkg/workspace/... -count=1: ok.
  • Delete, sweep, and quiesce tests run verbose: pass.

CodeRabbit CLI

Completed on head d280e987: 0 findings, exit 0. Earlier attempts failed with WebSocket closed.

Auto-merge

Eligible: yes. Non-test changed lines: 107 (69 added, 38 removed). Files: 1. No tests removed, no lint disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Workspace deletion now more reliably removes associated resources and cleans up orphaned workspace data.
    • Progress reporting and error handling remain available during workspace loading and imported-workspace removal.

Split Delete into private stage helpers (client load, imported-folder removal, resource removal, local file cleanup). Control flow, progress messages, lock boundaries, and returned values are unchanged.
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

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

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 27cdd8e4-34f4-4738-a7fe-183703d2d007
📥 Commits

Reviewing files that changed from the base of the PR and between 2a0a202 and d280e98.

📒 Files selected for processing: 1
  • pkg/workspace/delete.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The workspace deletion flow delegates client loading, imported-workspace removal, resource deletion, and local-file cleanup to dedicated helpers. Cleanup runs after successful resource deletion and sweeps orphan workspace and content directories.

Changes: Workspace deletion

Layer / File(s) Summary
Load client and handle imported workspace
pkg/workspace/delete.go
Dedicated helpers handle client loading and imported-workspace removal. They retain the existing progress reporting and error handling.
Delete resources and clean up local files
pkg/workspace/delete.go
A dedicated helper handles resource deletion. After it succeeds, another helper cleans up orphan workspace and content directories.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to d280e

No actionable merge-blocking issue remains; the workspace deletion refactor is ready for normal merge checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description clearly explains the refactor, preserved behavior, and validation results. It does not follow the repository template because it omits the required Type of change, AI assistance, Check… Update the description to include the applicable template sections. Mark Refactor, document AI usage and required confirmations, record the relevant test coverage and manual verification, complete the checklist, and state Fixes #N, `Refs …
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: naming the workspace deletion lifecycle stages. It follows the repository’s Conventional Commits format.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the refactor, preserved behavior, and validation results. It does not follow the repository template because it omits the required Type of change, AI assistance, Checklist, and Notes for reviewers sections, and it does not state an issue reference such as none.

Resolution

Update the description to include the applicable template sections. Mark Refactor, document AI usage and required confirmations, record the relevant test coverage and manual verification, complete the checklist, and state Fixes #N, Refs #N, or none.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@skevetter skevetter added the auto-refactor Automated refactor PR label Oct 19, 2026
@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

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

@skevetter
skevetter marked this pull request as ready for review October 20, 2026 02:01
@mergify

mergify Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@skevetter

Copy link
Copy Markdown
Contributor Author

Final gate check on d280e98: 101 checks successful, 3 conditional skips, 7 neutral; CodeRabbit GitHub Review completed with no actionable comments; CLI completed with 0 findings; no unresolved threads; signed and verified. Greptile did not review. Advisory description/docstring warnings need no code change: this PR follows the auto-refactor skill body format, and the private helper names express their purpose under its self-documenting-code rule. Auto-merge policy holds: one Engine file, 107 non-test changed lines, behavior preserved.

@skevetter
skevetter merged commit 1686a8b into main Oct 20, 2026
111 checks passed
@skevetter
skevetter deleted the refactor/workspace-delete-stages branch October 20, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-refactor Automated refactor PR size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant