Skip to content

feat(workload): run ephemeral checks on Kind#6045

Draft
devantler wants to merge 12 commits into
mainfrom
claude/ephemeral-kind-backend-6044
Draft

feat(workload): run ephemeral checks on Kind#6045
devantler wants to merge 12 commits into
mainfrom
claude/ephemeral-kind-backend-6044

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Daily AI Engineer

Summary

  • replace the experimental workload validate/scan --ephemeral KWOK lifecycle with a controller-capable Kind backend
  • give every run a unique cluster name and isolated temporary kubeconfig, leaving the user's shared kubeconfig untouched
  • preserve cancellation-resistant cluster deletion, local workspace cleanup, lifecycle ordering, and joined error reporting
  • make Kind creation honor its configured kubeconfig path and regenerate the CLI help, snapshots, reference docs, and embedded chat docs

Why

KWOK can register CRDs but only simulates pod state; it never executes operator controllers. That made it impossible for the next Phase 3b slice to apply operator CRs and inspect the native children they reconcile. Kind supplies a real control plane and workload runtime while keeping --ephemeral opt-in and default-off.

Validation

  • go build -o /tmp/ksail-maint-6044 .
  • go test ./pkg/cli/cmd/workload ./pkg/svc/provisioner/cluster/kind ./pkg/svc/provisioner/cluster -count=1
  • golangci-lint run --timeout 5m ./pkg/cli/cmd/workload ./pkg/svc/provisioner/cluster/kind ./pkg/svc/provisioner/cluster (0 issues)
  • npm run build in docs/ (193 pages, internal links valid)
  • live local E2E: workload validate <empty-dir> --ephemeral provisioned ksail-ephemeral-1783748957305085000, reached readiness through kind-ksail-ephemeral-1783748957305085000, and deleted its node successfully
  • post-E2E verification found no matching Docker container and no temporary kubeconfig/workspace under the dedicated TMPDIR
  • broad env -u HCLOUD_TOKEN go test -p 4 ./... passed every package except the existing load-sensitive Copilot fixture-process timing test; that package passed immediately in isolation with go test ./pkg/cli/cmd/open/chat -count=1

Follow-up

The next #5919 slice can apply rendered manifests, wait for real operator reconciliation, inventory generated children, and validate/scan them with per-layer attribution.

Fixes #6044
Part of #5919 and #5344

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The ephemeral validate and scan paths now provision isolated Kind clusters instead of KWOK clusters. Kind provisioning forwards dedicated expanded kubeconfig paths, while the ephemeral backend manages temporary workspace cleanup and bounded teardown across success, cancellation, and failure paths. Tests cover backend selection, kubeconfig isolation, lifecycle ordering, error joining, and CLI wording. Documentation and help text now describe Kind execution and operator-rendered child processing as the next off-by-default slice.

Possibly related issues

  • Issue 5919: Advances the ephemeral validate/scan lifecycle with Kind provisioning, chart installation, and guaranteed teardown.

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Docstring Coverage ❌ Error Docstring coverage is 72.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: running ephemeral workload checks on Kind.
Description check ✅ Passed The description is directly related to the Kind backend, cleanup, tests, and docs changes in the PR.
Linked Issues check ✅ Passed The PR matches #6044 by replacing KWOK with an isolated Kind backend, preserving teardown/error handling, adding tests, and updating docs.
Out of Scope Changes check ✅ Passed The changes stay focused on the Kind backend, cleanup semantics, tests, and documentation required by the linked issue.

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

@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

✅ Linters with no issues

actionlint, bash-exec, git_diff, hadolint, jscpd, jsonlint, lychee, markdown-table-formatter, markdownlint, prettier, prettier, shellcheck, shfmt, stylelint, syft, trivy-sbom, trufflehog, v8r, v8r, yamllint

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

Fresh full review requested after the adaptive review-limit window reopened.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh full review of the PR now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/cli/cmd/workload/ephemeral.go`:
- Around line 162-171: In the Create failure branch of the ephemeral cluster
workflow, update cleanup handling so deleteEphemeralCluster’s ErrClusterNotFound
is suppressed while preserving any real cleanup errors and the original Create
error. Use the existing createErr handling and deleteEphemeralCluster symbols to
apply this only when provisioner.Create fails.

In `@pkg/svc/chat/docs_generated.go`:
- Line 7: Raw commas in jsonschema description tags under the chat documentation
sources are being interpreted as tag separators, truncating generated Markdown
table cells. Search the source files in pkg/svc/chat for comma-containing
jsonschema description tags, then remove or escape those commas while preserving
the intended wording; specifically verify descriptions corresponding to
distributionConfig, NodeAutoscalerConfig.enabled, and expander. Regenerate docs
with go generate ./pkg/svc/chat/... and do not edit generatedDocumentation
directly.

In `@pkg/svc/provisioner/cluster/kind/provisioner_test.go`:
- Around line 89-106: Add a complementary test next to
TestCreateIncludesExpandedKubeconfigFlag that leaves kubeConfig empty, invokes
provisioner.Create, and asserts success plus absence of the "--kubeconfig"
argument in runner.lastArgs, covering the empty-path branch in Create.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b9d481bf-bcfe-4428-8e3b-ddb16849bc52

📥 Commits

Reviewing files that changed from the base of the PR and between 19e99aa and 6afb526.

⛔ Files ignored due to path filters (1)
  • pkg/cli/cmd/workload/__snapshots__/workload_test.snap is excluded by !**/*.snap
📒 Files selected for processing (14)
  • docs/src/content/docs/cli-flags/workload/workload-scan.mdx
  • docs/src/content/docs/cli-flags/workload/workload-validate.mdx
  • pkg/cli/cmd/workload/ephemeral.go
  • pkg/cli/cmd/workload/ephemeral_install.go
  • pkg/cli/cmd/workload/ephemeral_install_test.go
  • pkg/cli/cmd/workload/ephemeral_test.go
  • pkg/cli/cmd/workload/export_test.go
  • pkg/cli/cmd/workload/scan.go
  • pkg/cli/cmd/workload/validate.go
  • pkg/svc/chat/docs_generated.go
  • pkg/svc/provisioner/cluster/kind/provisioner.go
  • pkg/svc/provisioner/cluster/kind/provisioner_test.go
  • pkg/svc/provisioner/cluster/multi.go
  • pkg/svc/provisioner/cluster/multi_test.go
📜 Review details
⏰ Context from checks skipped due to timeout. (10)
  • GitHub Check: CodeRabbit
  • GitHub Check: 🔥 Warm Mirror Cache
  • GitHub Check: 📝 Generate Schema, CRD & Docs
  • GitHub Check: 🔥 Warm Helm Cache
  • GitHub Check: 🏠 Home Isolation Guard
  • GitHub Check: 🧪 Test
  • GitHub Check: 📊 Code Coverage
  • GitHub Check: 🧹 Lint - golangci-lint
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
🧰 Additional context used
📓 Path-based instructions (3)
pkg/svc/chat/docs_generated.go

📄 CodeRabbit inference engine (AGENTS.md)

Do not hand-edit pkg/svc/chat/docs_generated.go; regenerate it with go generate ./pkg/svc/chat/... after the docs generation step.

Files:

  • pkg/svc/chat/docs_generated.go
docs/src/content/docs/{cli-flags/**,configuration/declarative-configuration.mdx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not hand-edit the generated CLI reference docs under docs/src/content/docs/cli-flags/ or docs/src/content/docs/configuration/declarative-configuration.mdx; regenerate them with go generate ./docs/....

Files:

  • docs/src/content/docs/cli-flags/workload/workload-validate.mdx
  • docs/src/content/docs/cli-flags/workload/workload-scan.mdx
pkg/cli/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

pkg/cli/**/*.go: Canonicalize all user-supplied file path arguments in CLI commands with fsutil.EvalCanonicalPath before using them.
For output paths that may not already exist, create the parent directory with os.MkdirAll(filepath.Dir(outputPath), <mode>) before calling fsutil.EvalCanonicalPath.
Use fsutil.ReadFileSafe for constrained reads instead of reimplementing path-containment checks.

Files:

  • pkg/cli/cmd/workload/ephemeral_install_test.go
  • pkg/cli/cmd/workload/ephemeral_install.go
  • pkg/cli/cmd/workload/validate.go
  • pkg/cli/cmd/workload/scan.go
  • pkg/cli/cmd/workload/ephemeral.go
  • pkg/cli/cmd/workload/export_test.go
  • pkg/cli/cmd/workload/ephemeral_test.go
🧠 Learnings (1)
📚 Learning: 2026-07-10T20:56:28.132Z
Learnt from: devantler
Repo: devantler-tech/ksail PR: 6031
File: pkg/svc/chat/docs_generated.go:7-7
Timestamp: 2026-07-10T20:56:28.132Z
Learning: When reviewing code in `pkg/svc/chat/**` that uses `jsonschema:"description=..."` struct tags feeding the `go generate ./pkg/svc/chat/...` docs generator, avoid unescaped/raw commas inside the `description=` value. Struct tag options are comma-separated, so a raw comma will truncate the generated Markdown/MDX table cell text (often right before a `|`). The generator’s `mdxTableCell` correctly escapes literal `|` characters, so truncated output is usually from commas—not pipes. Fix by rewording the description to remove commas (or escaping them according to the tag parser’s rules), then regenerate the docs and ensure the related source-scan regression test passes.

Applied to files:

  • pkg/svc/chat/docs_generated.go
🔇 Additional comments (12)
pkg/cli/cmd/workload/ephemeral_install.go (1)

39-42: LGTM!

pkg/cli/cmd/workload/ephemeral_install_test.go (1)

104-104: LGTM!

Also applies to: 118-118

pkg/cli/cmd/workload/scan.go (1)

144-147: LGTM!

Also applies to: 150-151

pkg/cli/cmd/workload/validate.go (1)

160-163: LGTM!

Also applies to: 167-168

docs/src/content/docs/cli-flags/workload/workload-scan.mdx (1)

46-46: LGTM!

docs/src/content/docs/cli-flags/workload/workload-validate.mdx (1)

42-42: LGTM!

pkg/svc/provisioner/cluster/multi.go (1)

188-188: LGTM!

Also applies to: 207-216

pkg/svc/provisioner/cluster/multi_test.go (1)

5-12: LGTM!

Also applies to: 67-114

pkg/svc/provisioner/cluster/kind/provisioner.go (1)

228-236: LGTM!

pkg/cli/cmd/workload/ephemeral.go (1)

61-121: LGTM!

Also applies to: 132-133

pkg/cli/cmd/workload/export_test.go (1)

464-512: LGTM!

pkg/cli/cmd/workload/ephemeral_test.go (1)

7-12: LGTM!

Also applies to: 21-53, 75-100, 111-146, 167-251, 283-353, 377-441, 462-475

Comment thread pkg/cli/cmd/workload/ephemeral.go
Comment thread pkg/svc/chat/docs_generated.go Outdated
Comment thread pkg/svc/provisioner/cluster/kind/provisioner_test.go
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to 🏃🏻‍♂️ In Progress in 🌊 Project Board Jul 11, 2026
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai run pre-merge checks

Review fixes are pushed in 07bdcf13 and all three threads are resolved. Docstring coverage now has exact leading GoDoc for every new helper and test declaration.

Snapshot verification for the Linked Issues check: UPDATE_SNAPS=true go test ./pkg/cli/cmd/workload -count=1 passed, and the committed pkg/cli/cmd/workload/__snapshots__/workload_test.snap contains the regenerated Kind/next-slice help at lines 199, 244, 3261, and 3311. Its absence from the review was only the !**/*.snap reviewer path filter; the artifact is present in this PR.

The generated chat-doc truncation noted in review predates this PR and is already fixed separately by promoted #6036, so duplicating its schema-source edits here would create conflicting scope.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/svc/provisioner/cluster/multi_test.go (1)

67-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer public test seams over reflection in pkg/svc/provisioner/cluster/multi_test.go

  • Use KubeConfigForTest() for the kubeconfig assertion instead of reading kindprovisioner.Provisioner.kubeConfig via reflect.
  • For kindConfig, prefer an observable Create() assertion with a command-runner double (or a small exported test helper) rather than accessing the private field directly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/svc/provisioner/cluster/multi_test.go` around lines 67 - 118, Replace
reflection-based inspection in
TestCreateMinimalProvisioner_VanillaForwardsKubeconfigPath with the public
KubeConfigForTest() accessor. Rewrite
TestCreateMinimalProvisioner_VanillaBuildsValidKindConfig to verify the
generated configuration through Create() using a command-runner double, or add
and use a small exported test helper, instead of reading the private kindConfig
field via reflect.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/svc/provisioner/cluster/multi_test.go`:
- Around line 67-118: Replace reflection-based inspection in
TestCreateMinimalProvisioner_VanillaForwardsKubeconfigPath with the public
KubeConfigForTest() accessor. Rewrite
TestCreateMinimalProvisioner_VanillaBuildsValidKindConfig to verify the
generated configuration through Create() using a command-runner double, or add
and use a small exported test helper, instead of reading the private kindConfig
field via reflect.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 597ede78-f2f3-4c67-a779-188e0f9f52d2

📥 Commits

Reviewing files that changed from the base of the PR and between 6afb526 and 07bdcf1.

📒 Files selected for processing (5)
  • pkg/cli/cmd/workload/ephemeral.go
  • pkg/cli/cmd/workload/ephemeral_test.go
  • pkg/svc/provisioner/cluster/kind/provisioner.go
  • pkg/svc/provisioner/cluster/kind/provisioner_test.go
  • pkg/svc/provisioner/cluster/multi_test.go
📜 Review details
⏰ Context from checks skipped due to timeout. (13)
  • GitHub Check: 🏗️ Build KSail Binary
  • GitHub Check: 🏠 Home Isolation Guard
  • GitHub Check: 🧪 Test
  • GitHub Check: 🧹 Lint - golangci-lint
  • GitHub Check: 📊 Code Coverage
  • GitHub Check: 🧹 Lint - mega-linter
  • GitHub Check: 🏗️ Build
  • GitHub Check: 🔍 Dead Code Analysis
  • GitHub Check: 🛡️ Vulnerability Scan
  • GitHub Check: 📦 Tidy
  • GitHub Check: CodeRabbit
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
🧰 Additional context used
📓 Path-based instructions (1)
pkg/cli/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

pkg/cli/**/*.go: Canonicalize all user-supplied file path arguments in CLI commands with fsutil.EvalCanonicalPath before using them.
For output paths that may not already exist, create the parent directory with os.MkdirAll(filepath.Dir(outputPath), <mode>) before calling fsutil.EvalCanonicalPath.
Use fsutil.ReadFileSafe for constrained reads instead of reimplementing path-containment checks.

Files:

  • pkg/cli/cmd/workload/ephemeral.go
  • pkg/cli/cmd/workload/ephemeral_test.go
🔇 Additional comments (6)
pkg/svc/provisioner/cluster/kind/provisioner.go (1)

228-236: LGTM!

pkg/svc/provisioner/cluster/kind/provisioner_test.go (1)

89-122: LGTM!

Also applies to: 489-534

pkg/cli/cmd/workload/ephemeral.go (1)

135-211: LGTM!

pkg/cli/cmd/workload/ephemeral_test.go (3)

168-252: LGTM!

Also applies to: 357-381


404-477: 🩺 Stability & Availability

Cancellation teardown is already covered. The cancellation case already asserts one provisioner.Delete call, one backend cleanup, and removal of the workspace directory.


112-146: 🎯 Functional Correctness

Cleanup path is sound.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

The five changed declarations behind the 72.22% docstring result now have exact leading comments in c44870b, bringing the identified set to 18 of 18. The branch also includes current main at 0c59cfd.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh review now, taking into account the docstring fixes in c44870b and the rebase onto main at 0c59cfd.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai run pre-merge checks

The five previously missing declaration comments are now present in c44870b, focused tests pass, exact-package lint reports zero issues, and the branch includes current main at 0c59cfd.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Outside-diff multi_test.go reflection finding: assessed and deferred to #6049. The suggested KubeConfigForTest accessor cannot be called from cluster_test: it exists only in kind/export_test.go, and Go does not compile dependency _test.go files into an imported package. Exporting a production accessor solely for this test would widen the API.

The maintainability concern is real, so #6049 captures a private factory-injection refactor that can remove both reflection assertions without changing public behavior. This PR remains focused on the ephemeral Kind workflow. Focused tests across the workload, cluster, and Kind packages pass (748 tests), and the historical docstring failure is stale: the current head documents all 21 relevant functions.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

Cooldown-bound retry for head 15c6399. The five changed declarations behind the prior 13-of-18 score now each have exact leading comments in c44870b; focused tests and exact-package lint are green.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh review now for head 15c6399, taking into account the docstring fixes in c44870b.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/cli/cmd/workload/ephemeral_test.go (1)

118-152: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Return/parameterize the fake waiter for symmetry with the backend.

installEphemeralProvisioner unconditionally installs a fresh default fakeEphemeralWaiter{} but only returns the backend fake. Any test needing a custom wait error must know to call ExportSetEphemeralClusterWaiter again afterward to override it — an implicit, undocumented ordering dependency. Consider accepting an optional waiter or returning the installed waiter alongside the backend.

♻️ Suggested refactor
-func installEphemeralProvisioner(
+func installEphemeralProvisioner(
 	t *testing.T,
 	fake *fakeEphemeralProvisioner,
-) *fakeEphemeralBackend {
+) (*fakeEphemeralBackend, *fakeEphemeralWaiter) {
 	t.Helper()
 	...
-	installEphemeralWaiter(t, &fakeEphemeralWaiter{})
+	waiter := &fakeEphemeralWaiter{}
+	installEphemeralWaiter(t, waiter)

-	return backend
+	return backend, waiter
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/cmd/workload/ephemeral_test.go` around lines 118 - 152, Update
installEphemeralProvisioner to expose the fakeEphemeralWaiter it installs,
either by accepting an optional waiter or returning it alongside the
fakeEphemeralBackend. Ensure tests can configure custom wait errors through that
returned or supplied waiter without re-registering
ExportSetEphemeralClusterWaiter after the helper call.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/cli/cmd/workload/ephemeral_test.go`:
- Around line 118-152: Update installEphemeralProvisioner to expose the
fakeEphemeralWaiter it installs, either by accepting an optional waiter or
returning it alongside the fakeEphemeralBackend. Ensure tests can configure
custom wait errors through that returned or supplied waiter without
re-registering ExportSetEphemeralClusterWaiter after the helper call.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f2839bd5-efd9-43a1-8f1d-8f953d767077

📥 Commits

Reviewing files that changed from the base of the PR and between 07bdcf1 and 15c6399.

📒 Files selected for processing (3)
  • pkg/cli/cmd/workload/ephemeral_test.go
  • pkg/svc/provisioner/cluster/kind/provisioner_test.go
  • pkg/svc/provisioner/cluster/multi.go
📜 Review details
⏰ Context from checks skipped due to timeout. (21)
  • GitHub Check: CodeRabbit
  • GitHub Check: 🧪 System Test (Docker) (Vanilla, Docker, true, --cni Calico --csi Disabled --load-balancer Dis...
  • GitHub Check: 🧪 System Test (Docker) (VCluster, Docker, true, --name system-test-cluster --cni Cilium --csi ...
  • GitHub Check: 🧪 System Test (Docker) (VCluster, Docker, true, --gitops-engine Flux --local-registry ghcr.io/...
  • GitHub Check: 🧪 System Test (Docker) (VCluster, Docker, true, --cni Calico --csi Disabled --load-balancer Di...
  • GitHub Check: 🧪 System Test (Docker) (K3s, Docker, true, --cni Calico --csi Disabled --load-balancer Disable...
  • GitHub Check: 🧪 System Test (Docker) (Vanilla, Docker, true, --gitops-engine ArgoCD --local-registry ghcr.io...
  • GitHub Check: 🧪 System Test (Docker) (K3s, Docker, true, --gitops-engine ArgoCD --local-registry ghcr.io/dev...
  • GitHub Check: 🧪 System Test (Docker) (VCluster, Docker, true)
  • GitHub Check: 🧪 System Test (Docker) (K3s, Docker, true, --gitops-engine Flux --local-registry ghcr.io/devan...
  • GitHub Check: 🧪 System Test (Docker) (Vanilla, Docker, true, --name system-test-cluster --cni Cilium --csi E...
  • GitHub Check: 🧪 System Test (Docker) (K3s, Docker, true)
  • GitHub Check: 🧪 System Test (Docker) (K3s, Docker, true, --name system-test-cluster --cni Cilium --csi Enabl...
  • GitHub Check: 🧪 System Test (Docker) (Vanilla, Docker, true)
  • GitHub Check: 🧪 System Test (Docker) (KWOK, Docker, true, --cni Calico --csi Disabled --load-balancer Disabl...
  • GitHub Check: 🏠 Home Isolation Guard
  • GitHub Check: 📊 Code Coverage
  • GitHub Check: 🧪 Test
  • GitHub Check: 🧹 Lint - golangci-lint
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
🧰 Additional context used
📓 Path-based instructions (1)
pkg/cli/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

pkg/cli/**/*.go: Canonicalize all user-supplied file path arguments in CLI commands with fsutil.EvalCanonicalPath before using them.
For output paths that may not already exist, create the parent directory with os.MkdirAll(filepath.Dir(outputPath), <mode>) before calling fsutil.EvalCanonicalPath.
Use fsutil.ReadFileSafe for constrained reads instead of reimplementing path-containment checks.

Files:

  • pkg/cli/cmd/workload/ephemeral_test.go
🔇 Additional comments (5)
pkg/svc/provisioner/cluster/multi.go (1)

188-188: LGTM!

Also applies to: 207-218

pkg/svc/provisioner/cluster/kind/provisioner_test.go (1)

489-490: LGTM!

pkg/cli/cmd/workload/ephemeral_test.go (3)

41-42: LGTM!

Also applies to: 52-53, 86-87


197-232: LGTM!

Also applies to: 527-546


127-128: 🩺 Stability & Availability

No issue here: the factory executes synchronously The backend factory is called directly inside withEphemeralCluster before any goroutine is spawned, so require.NoError in this test closure does not violate the testing goroutine rule.

			> Likely an incorrect or invalid review comment.

@github-code-quality

github-code-quality Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: Go

Go / code-coverage/go

The overall coverage in the branch remains at 66%, unchanged from the branch.

Show a code coverage summary of the most impacted files.
File cc298ca 80b6fbd +/-
pkg/svc/provisi...etzner/token.go 77% 73% -4%
pkg/svc/provisi.../provisioner.go 91% 90% -1%
pkg/cli/cmd/wor...ad/ephemeral.go 87% 88% +1%
pkg/svc/provisi...luster/multi.go 43% 46% +3%

Updated July 11, 2026 09:40 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Resolved the latest outside-diff waiter-fixture finding in 90a08d7. installEphemeralProvisioner now accepts the readiness waiter directly (nil selects the ordinary no-op fake), and the lifecycle ordering, readiness, and wait-failure tests supply their custom waiter through that single helper call instead of depending on a later re-registration.

Validation: env -u HCLOUD_TOKEN go test ./pkg/cli/cmd/workload passed; golangci-lint run ./pkg/cli/cmd/workload reports 0 issues; git diff --check passed.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

The outside-diff waiter-fixture finding from the 07:31Z review is addressed in 90a08d7 and its focused tests/lint are green. Please review the current head.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh review now for the current head, taking into account the waiter-fixture fix in 90a08d7.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

Cooldown-bound retry for current head 90a08d7 after resolving the waiter-fixture outside-diff finding. Focused tests, exact-package lint, and diff check are green.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh review now for head 90a08d7, taking into account the waiter-fixture fix.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

The adaptive review window has reopened. Please review exact head 90a08d7a; all current source declarations are documented, CI has no failures, and the historical outside-diff reflection concern is durably tracked in #6049.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh review now for head 90a08d7a, taking into account that all current source declarations are documented and the outside-diff reflection concern is tracked in #6049.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pkg/cli/cmd/workload/ephemeral_test.go (2)

420-437: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert workspace removal even when cleanup returns an injected error.

errors.Join(os.RemoveAll(backend.workspace), backend.cleanupErr) still calls os.RemoveAll regardless of cleanupErr, so the workspace should be gone even though cleanupErr is non-nil. Adding assert.NoDirExists(t, backend.workspace) here (alongside the existing backend.cleaned check) would confirm cleanup always attempts removal even on the error-joining path, matching the coverage given to other failure-path tests in this file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/cmd/workload/ephemeral_test.go` around lines 420 - 437, Extend
TestWithEphemeralClusterJoinsFnDeleteAndCleanupErrors to assert that
backend.workspace no longer exists after the joined-error cleanup path,
alongside the existing backend.cleaned assertion. Use the test’s existing
assertion style and preserve all current error checks.

336-393: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add cleanup assertions to the NotFound-suppression test for consistency.

TestWithEphemeralClusterSkipsFnAndTearsDownWhenCreateFails (Lines 336-367) checks backend.cleaned and assert.NoDirExists(t, backend.workspace) after a create failure, but the very next test, TestWithEphemeralClusterSuppressesNotFoundCleanupAfterCreateFailure (Lines 374-393), which also drives a create failure through the same backend, drops these assertions entirely (Line 380 discards the returned backend). Since this test specifically targets the NotFound-suppression branch of the create-failure path, verifying that backend cleanup still runs there closes a gap in coverage of the guarantee the PR explicitly requires ("Remove the cluster and temporary kubeconfig after success, errors, timeouts, cancellation...").

♻️ Proposed fix
-	installEphemeralProvisioner(t, fake, nil)
+	backend := installEphemeralProvisioner(t, fake, nil)
 
 	err := workload.ExportWithEphemeralCluster(
 		cmd.Context(), cmd,
 		func(context.Context, workload.EphemeralCluster) error {
 			t.Fatal("callback must not run after create failure")
 
 			return nil
 		},
 	)
 
 	require.ErrorIs(t, err, errEphemeralCreateFailed)
 	assert.NotErrorIs(t, err, clustererr.ErrClusterNotFound)
+	assert.Equal(t, 1, backend.cleaned)
+	assert.NoDirExists(t, backend.workspace)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/cli/cmd/workload/ephemeral_test.go` around lines 336 - 393, Retain the
backend returned by installEphemeralProvisioner in
TestWithEphemeralClusterSuppressesNotFoundCleanupAfterCreateFailure, then assert
that backend.cleaned equals 1 and backend.workspace no longer exists after
ExportWithEphemeralCluster returns. Keep the existing assertions verifying the
original create error is preserved and ErrClusterNotFound is suppressed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@pkg/cli/cmd/workload/ephemeral_test.go`:
- Around line 420-437: Extend
TestWithEphemeralClusterJoinsFnDeleteAndCleanupErrors to assert that
backend.workspace no longer exists after the joined-error cleanup path,
alongside the existing backend.cleaned assertion. Use the test’s existing
assertion style and preserve all current error checks.
- Around line 336-393: Retain the backend returned by
installEphemeralProvisioner in
TestWithEphemeralClusterSuppressesNotFoundCleanupAfterCreateFailure, then assert
that backend.cleaned equals 1 and backend.workspace no longer exists after
ExportWithEphemeralCluster returns. Keep the existing assertions verifying the
original create error is preserved and ErrClusterNotFound is suppressed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 78586fa1-094a-42b1-abf4-42267ceafc79

📥 Commits

Reviewing files that changed from the base of the PR and between 15c6399 and 90a08d7.

📒 Files selected for processing (1)
  • pkg/cli/cmd/workload/ephemeral_test.go
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
pkg/cli/**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

pkg/cli/**/*.go: Canonicalize all user-supplied file path arguments in CLI commands with fsutil.EvalCanonicalPath before using them.
For output paths that may not already exist, create the parent directory with os.MkdirAll(filepath.Dir(outputPath), <mode>) before calling fsutil.EvalCanonicalPath.
Use fsutil.ReadFileSafe for constrained reads instead of reimplementing path-containment checks.

Files:

  • pkg/cli/cmd/workload/ephemeral_test.go
🔇 Additional comments (1)
pkg/cli/cmd/workload/ephemeral_test.go (1)

7-13: LGTM!

Also applies to: 22-58, 80-158, 174-218, 235-264, 271-298, 317-333, 443-461, 510-535

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

Current-head outside-diff cleanup findings: fixed in c51dc9a3. TestWithEphemeralClusterSuppressesNotFoundCleanupAfterCreateFailure now retains the backend and asserts both the cleanup call and workspace removal. TestWithEphemeralClusterJoinsFnDeleteAndCleanupErrors now also asserts workspace removal while preserving all three joined-error checks.

Validation: both focused tests pass, gofmt -d and git diff --check are clean, and the repository-pinned go tool golangci-lint reports no issues for ./pkg/cli/cmd/workload.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai run pre-merge checks

Exact head c51dc9a3 has a completed clean CodeRabbit review, zero unresolved threads/body findings, and all 21 relevant current declarations are documented. The previous 72.22% value came from five missing comments at historical head 6afb526e; those comments are present on this head. Please recompute the formal checks against the current diff.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Assistant

Current head 80b6fbdf61875bb0950be89dbac4828b49178809 adds the exact leading Go doc comment for newEphemeralTestCommand, the one changed non-Test* helper that remained undocumented after the waiter-fixture refactor. This closes the conservative current-head docstring gap without changing behavior.

Validation:

  • gofmt -d pkg/cli/cmd/workload/ephemeral_test.go — clean
  • go test ./pkg/cli/cmd/workload -count=1 — passed
  • go tool golangci-lint run --timeout 5m ./pkg/cli/cmd/workload — 0 issues
  • git diff --check — clean

The latest two outside-diff cleanup findings remain resolved in the current file: both failure paths assert workspace removal, and the NotFound path also asserts one cleanup call.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai review

Please review exact head 80b6fbd. All 20 changed non-Test Go declarations now have matching leading documentation; the historical 72.22% value came from five gaps at 6afb526, and the two outside-diff cleanup-test findings from 90a08d7 are fixed in c51dc9a. Focused workload tests, scoped golangci-lint, gofmt, and diff validation pass. Please recompute the formal pre-merge summary against this current head.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@devantler I'll run a fresh review now for head 80b6fbd, taking into account that all 20 changed non-Test Go declarations now have matching leading documentation and the two outside-diff cleanup-test findings from 90a08d7 are fixed in c51dc9a.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Daily AI Engineer

@coderabbitai run pre-merge checks

The fresh review completed on exact head 80b6fbd with no actionable comments. Please recompute the formal checks from the current diff: all 20 changed non-Test Go declarations have matching leading documentation, so the retained 72.22% value is stale against historical head 6afb526.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
✅ Actions performed

Running Pre-merge checks. Results will be posted in the summary comment once complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🏃🏻‍♂️ In Progress

Development

Successfully merging this pull request may close these issues.

Run --ephemeral on a controller-capable Kind backend

1 participant