Files
narratio/docs/internal/stage-cleanup.md

29 lines
1.3 KiB
Markdown
Raw Normal View History

# Stage: cleanup
2026-11-30 14:08:28 +00:00
## Purpose And Authorization
2026-11-30 14:08:28 +00:00
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
2026-11-30 14:08:28 +00:00
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
2026-11-30 14:08:28 +00:00
`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.