2.4 KiB
2.4 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 01-idempotent-missing-resources | Make missing cleanup resources idempotent | done | 1 | plan.md | ../../specs/tasks/runtime-cleanup.md |
Task 01: Make Missing Cleanup Resources Idempotent
Acceptance
- Missing task-environment rows are classifiable through
ErrTaskEnvironmentNotFoundwithout relying on error text. - A
cascade_deletejob succeeds when its captured worktree or environment row is already absent. - Generic worktree and repository failures remain retryable.
Verification
cd apps/backend && go test -tags fts5 -run 'Test(DeleteTaskEnvironmentMissing|TaskResourceCleanupMissingResources|TeardownEnvironmentResources)' ./internal/task/repository/sqlite ./internal/task/service
Files likely touched
apps/backend/internal/task/repository/repoerrors/errors.goapps/backend/internal/task/repository/interface.goapps/backend/internal/task/repository/sqlite/errors.goapps/backend/internal/task/repository/sqlite/task_environment.goapps/backend/internal/task/repository/sqlite/task_environment_test.goapps/backend/internal/task/service/service_task_environments.goapps/backend/internal/task/service/service_task_environments_test.goapps/backend/internal/task/service/service_tasks.goapps/backend/internal/task/service/resource_cleanup_jobs_test.go
Dependencies
None.
Parallelism
sequential; Task 02 shares the cleanup service and its regression test file.
Inputs
- Runtime cleanup spec: idempotency requirements and missing-resource scenarios.
- Confirmed issue #2027 reproductions for missing worktree and missing task-environment row.
- Existing
runtimeStopAlreadyCompletetyped-sentinel pattern inservice_tasks.go.
Output contract
Report the RED failures, sentinel and cleanup behavior implemented, files
changed, exact verification result, residual risks, and update this task plus
plan.md status.
Result
- RED coverage reproduced both issue paths: missing worktree and missing task-environment row.
- Added typed
ErrTaskEnvironmentNotFoundclassification and made only typed not-found cleanup outcomes idempotent. - Verified with
go test -tags fts5 -run 'Test(DeleteTaskEnvironmentMissing|TaskResourceCleanupMissingResources|TeardownEnvironmentResources)' ./internal/task/repository/sqlite ./internal/task/service(6 tests passed).