Document durable session cleanup

This commit is contained in:
2026-11-30 14:08:28 +00:00
parent e9d74a7de0
commit 719a6839d1
14 changed files with 84 additions and 60 deletions

View File

@@ -1,25 +1,28 @@
# Stage: cleanup
## Purpose
## Purpose And Authorization
Remove eligible run data only after a successful publish, according to the
workspace cleanup policy. Explicit session cleanup is a separate operator action.
## Authorization And Targets
`workspace.cleanup_after_publish` enables automatic cleanup. It requires a
succeeded upload and matching published run, commit, and pointer evidence.
Cleanup confines deletion to that run and protects managed latest log/debug
view targets and the original session-durable Notarius bundle. Subprocess state
and caches are outside its scope.
The final selected cleanup stage removes local run history after successful
publication when `workspace.cleanup_after_publish` is enabled. It validates the
published run, commit and pointer evidence and configured campaign/session
identity. Explicit whole-session cleanup is a separate operator action.
## Execution And Resume
Cleanup is idempotent and retries failed deletion without republishing. Retained
protected files are intentional and do not trigger endless cleanup. Bounded
runs ending before cleanup do not execute it. See [operations](../operations.md#cleanup).
Cleanup removes recognized managed stage and restore log/debug links without
following them, then deletes the selected session's entire `runs/` directory
through a confined workspace root. Missing runs and links are successful;
unsafe paths and managed-name conflicts fail. Subprocess state, caches, durable
session products and remote objects are outside its scope.
Resume inspects both the runs directory and managed views without mutation. An
empty runs directory, a new attempt, or a dangling managed view requires cleanup
again. Deletion is not transactional: a failure can leave partial progress and
is recorded as a failed stage. A later selected cleanup retries without another
publish. See [operations](../operations.md#cleanup).
## Implementation And Tests
`internal/stage/cleanup_plan.go`, `cleanup.go`, `internal/fileops/cleanup.go`
and their tests own authorization, protected targets, and confined deletion.
`internal/stage/cleanup_plan.go`, `cleanup.go`, `internal/fileops/cleanup.go`,
`attempt_views.go`, and their tests own authorization, inspection, managed view
removal and confined deletion.