Skip to content

refactor(e2e): share detached cleanup context helper - #1685

Merged
skevetter merged 1 commit into
mainfrom
refactor/e2e-describe-table-fixtures
Oct 24, 2026
Merged

skevetter merged 1 commit into
mainfrom
refactor/e2e-describe-table-fixtures

Conversation

@skevetter

@skevetter skevetter commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds framework.DetachedCleanupContext(parent, timeout), wrapping context.WithTimeout(context.WithoutCancel(parent), timeout).
  • Migrates microsandbox cleanup sites in the touched files and uses the helper in CleanupWorkspace.
  • Preserves the cleanup parents, timeouts (1 min, 30s, 20s, 10s), and cleanup order.

Why

The bounded, detached cleanup context pattern was repeated about 20 times across e2e/tests/up, with its rationale documented only once. The helper centralizes that intent and prevents Ginkgo cleanup from inheriting an expired spec context and silently skipping cleanup.

Validation

  • mise run cli:format: clean.
  • mise run cli:lint:ci: 0 issues.
  • go vet ./e2e/...: pass.
  • go test ./e2e/framework/...: pass.
  • ginkgo --dry-run ./e2e/tests/up/: passed.
  • PR CI on head 61174960d: all 110 checks passed; the affected up-provider-microsandbox, -images, -ephemeral, -storage, -managed-recreate, -resources, -logs-cancel, and -prebuilds jobs passed on ubuntu-latest.

CodeRabbit

  • CLI review completed with 0 findings across 10 files.
  • GitHub status: Review completed; no actionable comments.

Auto-merge

  • Eligible: yes. The diff touches only e2e/, changes no coverage, and has 16 changed non-test source lines across 10 files (54 changed test lines; 43 weighted lines under the E2E half-weight rule).

Next

  • Remaining sites outside this PR's 12-file cap: tests/up/provider_kubernetes_ssh_agent.go (7 sites), tests/up/provider_kubernetes_dockerless_path.go:109, tests/up/fixture_command.go:58, tests/up/provider_microsandbox_logs_cancel.go (cleanup-like bounds, not migrated).

@skevetter skevetter added the e2e-refactor e2e refactor label Oct 24, 2026
@netlify

netlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

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

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f13a10ea-48d2-46af-8efd-235a8e936913
Commits

Reviewing files that changed from the base of the PR and between df78ff3 and 6117496.

Files selected for processing: 10
  • e2e/framework/command.go
  • e2e/tests/up/microsandbox_session.go
  • e2e/tests/up/provider_microsandbox_compatibility.go
  • e2e/tests/up/provider_microsandbox_consumer_linux.go
  • e2e/tests/up/provider_microsandbox_egress.go
  • e2e/tests/up/provider_microsandbox_ephemeral.go
  • e2e/tests/up/provider_microsandbox_migration.go
  • e2e/tests/up/provider_microsandbox_mounts.go
  • e2e/tests/up/provider_microsandbox_recreate.go
  • e2e/tests/up/provider_microsandbox_remote_agent_linux.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 change adds an exported helper for creating detached timeout contexts. CleanupWorkspace and microsandbox test cleanup callbacks now use it with their existing timeout values.

Changes: Detached cleanup contexts

Layer / File(s) Summary
Add shared cleanup context helper
e2e/framework/command.go
Adds DetachedCleanupContext and uses it in CleanupWorkspace with a one-minute timeout.
Use helper in microsandbox cleanup callbacks
e2e/tests/up/microsandbox_session.go, e2e/tests/up/provider_microsandbox_compatibility.go, e2e/tests/up/provider_microsandbox_consumer_linux.go, e2e/tests/up/provider_microsandbox_egress.go, e2e/tests/up/provider_microsandbox_ephemeral.go, e2e/tests/up/provider_microsandbox_migration.go, e2e/tests/up/provider_microsandbox_mounts.go, e2e/tests/up/provider_microsandbox_recreate.go, e2e/tests/up/provider_microsandbox_remote_agent_linux.go
Replaces inline detached timeout construction with the helper. Cleanup operations and their timeout values remain unchanged.

Priority: Low

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

Change: Refactor

Merge Risk: Minimal · up to 61174

The refactor centralizes cleanup-context creation without changing the reported timeouts or cleanup behavior.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "refactor(e2e): share detached cleanup context helper" follows Conventional Commits form and matches the main change: adding the exported framework.DetachedCleanupContext helper and routing …
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.
Description check Passed The description clearly explains the change, its rationale, and validation results. It omits the template’s issue reference, type-of-change and AI-assistance sections, checklist, and manual verificati…
Full details: Title check

Explanation

The title "refactor(e2e): share detached cleanup context helper" follows Conventional Commits form and matches the main change: adding the exported framework.DetachedCleanupContext helper and routing the microsandbox e2e cleanup sites through it. It is short, specific, and accurately names the refactor type and scope.

Full details: Description check

Explanation

The description clearly explains the change, its rationale, and validation results. It omits the template’s issue reference, type-of-change and AI-assistance sections, checklist, and manual verification details, but the main information is complete.

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.

@netlify

netlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

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

@skevetter
skevetter marked this pull request as ready for review October 24, 2026 07:57
@mergify

mergify Bot commented Oct 24, 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
skevetter merged commit 37e41d7 into main Oct 24, 2026
114 checks passed
@skevetter
skevetter deleted the refactor/e2e-describe-table-fixtures branch October 24, 2026 08:01
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