7.7 KiB
spec, created, status
| spec | created | status |
|---|---|---|
| docs/specs/workspaces/requirements/improve-kandev.md | 2026-08-01 | implemented |
Implementation Plan: Improve Kandev Workspace Isolation
Overview
Improve Kandev tasks currently land in the user's active workspace, mixing
contribution work with their regular tasks. This change makes the
improve-kandev bootstrap endpoint find-or-create a dedicated, idempotently
reused workspace named Improve Kandev, scope the repository registration and
both hidden workflows to it, and return its workspace_id so the frontend
creates the task there. Backend contract first, then frontend wiring, then E2E
evidence of isolation.
Backend
internal/improvekandev/handler.go
BootstrapRequest.WorkspaceIDbecomes optional (json:"workspace_id,omitempty"). Remove thereq.WorkspaceID == ""400 validation and thecanonicalWorkspaceIDcall; deletecanonicalWorkspaceID(and its unit test). The field is accepted and ignored for backward compatibility.- Add constants
improveWorkspaceName = "Improve Kandev"andimproveWorkspaceDesc. - Add
ensureImproveWorkspace(ctx) (*taskmodels.Workspace, error), mirroring the existingensureWorkflowidempotency pattern:taskSvc.ListWorkspaces(ctx)→ match by exactName == "Improve Kandev".- Miss →
taskSvc.CreateWorkspace(ctx, &taskservice.CreateWorkspaceRequest{ Name: improveWorkspaceName, Description: improveWorkspaceDesc, BootstrapKanbanWorkflow: true }). - Create failure → re-list and match by name (concurrent-bootstrap race); still missing → return the error.
httpBootstrap:- Call
ensureImproveWorkspacefirst; use its ID everywhere the oldworkspaceIDwas used (resolveOrCloneRepo,ListWorkflows,ensureWorkflow×2). - Add
WorkspaceID string \json:"workspace_id"`toBootstrapResponse`, set to the dedicated workspace's ID.
- Call
Tests
internal/improvekandev/handler_test.go: removeTestCanonicalWorkspaceID(function deleted).internal/integration/improve_kandev_test.go:- Update
TestImproveKandevBootstrapCreatesBothHiddenWorkflowsIdempotently: drop the pre-created workspace; bootstrap with an emptyWorkspaceID; assert the responseWorkspaceIDis non-empty, a workspace namedImprove Kandevexists, both hidden workflows live in it, and a second bootstrap returns the same workspace + workflow IDs. - Add
TestImproveKandevBootstrapReusesExistingImproveWorkspace: pre-create a workspace namedImprove Kandev, bootstrap with a different requestworkspace_id, assert the response's workspace is the pre-created one.
- Update
Frontend
lib/api/domains/improve-kandev-api.ts
- Add
workspace_id: stringtoImproveKandevBootstrapResponse. Keep the requestworkspaceIdparameter (still sent; backend ignores it).
components/improve-kandev-dialog.tsx
useBootstrapKandev: after bootstrap, calllistRepositoriesandsetRepositorieswithdata.workspace_idinstead of the activeworkspaceIdso the locked-repo chip resolves a label for the dedicated workspace's repo.
components/improve-kandev-dialog-create.tsx
CreateModeView: passworkspaceId={ready ? ready.data.workspace_id : props.workspaceId}toTaskCreateDialog. Submit stays blocked until bootstrap is ready, so no task can be created in the wrong workspace. The sidebarworkspaceIdprop remains the fallback while loading and is still used byuseGitHubAuthCheckfor the fix URL.
Tests
- What: bootstrap creates the dedicated workspace on first use
(spec scenario). File:
internal/integration/improve_kandev_test.go. How: integration test through the real handler + task service. - What: bootstrap reuses the existing workspace and workflow IDs (spec scenario). File: same. How: second bootstrap call, compare IDs.
- What: a different request
workspace_idis ignored. File: same. How: pre-create the dedicated workspace, pass another ID. - What: frontend uses the bootstrap's
workspace_idfor repo listing and task creation. File:apps/web/components/*+ E2E. How: E2E test seeds a real dedicated workspace and asserts the task lands there. - What: E2E mocks stay contract-complete (
workspace_idpresent). File:apps/web/e2e/tests/improve-kandev.spec.ts,mobile-improve-kandev.spec.ts. How: update mock bodies.
E2E Tests
- Scenario: GIVEN the user's active workspace is not the dedicated
workspace, WHEN the dialog submits a task, THEN the task appears in the
dedicated workspace and not the active one.
File:
apps/web/e2e/tests/improve-kandev.spec.ts. What to verify:apiClient.listTasks(dedicatedWorkspaceId)contains the task;apiClient.listTasks(seedData.workspaceId)does not. Seed the dedicated workspace withapiClient.createWorkspace("Improve Kandev"), a workflow viacreateWorkflow(workspace.id, ...), and a repository viacreateRepository(workspace.id, <seed repo dir>); mock bootstrap to return those IDs.
Verification Results
Completed for all 7 tasks (see each task's ## Results). Summary of the final
verification run on the merged branch (68b8a57a4, PR #2347):
- Backend:
go test -tags fts5 ./internal/improvekandev/... ./internal/integration/...pass; full backend suite passes withKANDEV_*vars unset andumask 022. - Frontend:
tsc --noEmitandeslint --max-warnings 0clean on all touched files; unit tests pass (improve-kandev dialog, repository-card). - E2E:
playwright test --config e2e/playwright.config.ts improve-kandev.spec→ 14 passed (13 desktop + 1 mobile). Required rebuilding the staleapps/backend/bin/kandeve2e binary (missing upstreamagent_generated_task_titles) and seedingagent_generated_task_titles: falsein the submit-flow tests. - CI on PR #2347: all checks green (
mergeStateStatus: CLEAN); CodeRabbit threads resolved. - Demo instance on ubu4.in.fiere.fr (backend :25208, vite :58449) rebuilt with
the merged code: bootstrap with
create_workspace:truecreated workspace0dfe5db8-c82d-4c6e-803a-2eec41bcb3fcand carried the Default workspace's mock GitHub connection; 409s and read-only settings pages verified.
Artifacts: docs/specs/workspaces/requirements/improve-kandev.md (spec amendment for Phase 2),
this plan, and docs/plans/improve-kandev-workspace/task-*.md.
Cleanup/teardown: no temporary artifacts shipped; e2e DIAG probes removed before
committing.
Implementation Waves And Parallel Candidates
Wave 1 (sequential):
Wave 2 (depends on 01):
Wave 3 (depends on 02):
Phase 2 — Dedicated workspace immutability + GitHub carry-over
Follow-up requirements: the dedicated workspace is configuration-immutable (workflows and repositories read-only) and, on first creation only, inherits the GitHub workspace connection from the user's default workspace — nothing else (no other integrations, no automations).
Waves
Wave 4 (backend guards — sequential):
Wave 5 (depends on 04):
Wave 6 (depends on 04, 05):
Wave 7 (depends on 06):
The default is sequential execution in the primary conversation. No subagents unless the user explicitly asks after selecting the implementation model.
Open Questions
None.