Document durable session cleanup
This commit is contained in:
@@ -33,7 +33,7 @@ validator. The focused stage documents own their input/output flow;
|
||||
All formats are validated by strict source-policy rules. Configured artifact and
|
||||
extraction keys use `^[a-z][a-z0-9_]*$`; source parsers never normalize an
|
||||
unrecognized token into a valid source. Extraction sources are registered only
|
||||
from `pipeline.notarius.outputs`; the retained bundle is not a selectable
|
||||
from `pipeline.notarius.outputs`; the original bundle is not a selectable
|
||||
source.
|
||||
|
||||
Prepared stable source IDs are `narratio.input.players`,
|
||||
|
||||
@@ -15,11 +15,13 @@ sibling temporary file, validates the complete result, and passes that file to
|
||||
remote object selection, validation, conflict handling, and temporary-file
|
||||
cleanup.
|
||||
|
||||
Directory bundles are not promoted by `internal/fileops`; extraction retains
|
||||
the original bundle in its run and promotes individual validated products.
|
||||
Directory bundles are not promoted by `internal/fileops`; extraction keeps
|
||||
the original bundle in its run until cleanup and promotes individual validated
|
||||
products.
|
||||
|
||||
Managed latest-attempt links are updated and inspected by fileops. Cleanup uses
|
||||
those validated targets when retaining current diagnostics.
|
||||
Fileops updates, inspects and removes recognized managed latest-attempt links
|
||||
without following their targets, including dangling links. Unrelated entries are
|
||||
left alone and conflicting managed names are rejected.
|
||||
|
||||
## Cleanup Contract
|
||||
|
||||
|
||||
@@ -330,12 +330,11 @@ writes, or run-directory creation. Excluded prefix records are not passed to
|
||||
resume validators. Records after the selected end are not prerequisites and
|
||||
may be made stale by selected work without being scheduled.
|
||||
|
||||
After a publish commits remotely, any configured local cleanup is first recorded
|
||||
as a session-manifest obligation before deletion begins. Each target becomes
|
||||
complete only after its confined deletion (or safe absence check) and a
|
||||
successful manifest save. An incomplete obligation is retried when publish
|
||||
executes again and retains the committed run and remote identity that authorized
|
||||
it; an invocation that does not execute publish does not perform cleanup.
|
||||
Cleanup is an ordinary selected stage. It validates recorded successful
|
||||
publication evidence before deleting local run history, saves its normal stage
|
||||
transition, and retries incomplete work on a later selected invocation without
|
||||
republishing. Historical run-local paths in records are provenance, not a
|
||||
requirement that those files remain present. See [cleanup](stage-cleanup.md).
|
||||
|
||||
Each invocation derives campaign, session, run, local-path, and remote-prefix
|
||||
metadata from the validated resolved configuration as one projection. A persisted
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -17,12 +17,14 @@ successful native completion report for the expected pipeline and confined outpu
|
||||
directory. The stage reads each configured lane JSON, validates its safe path and
|
||||
content, then promotes all required products to flat artifact paths before
|
||||
recording success. The original bundle and optional domain auxiliaries stay in
|
||||
the producing run. Positive native fallback counts are recorded and reported.
|
||||
the producing run until authorized cleanup removes run history. Positive native
|
||||
fallback counts are recorded and reported.
|
||||
|
||||
## Resume Validation
|
||||
|
||||
Resume checks the direct transcript identity, configured pipeline and lane
|
||||
selection, reference identities, and manifest-backed output checksums and sizes.
|
||||
It does not reopen the original bundle or completion report.
|
||||
Cache and debug selection, executable version and private downstream config are
|
||||
not blanket invalidators. Force invokes extraction with cache refresh. A failed
|
||||
replacement is not represented as a current successful extraction.
|
||||
|
||||
@@ -64,7 +64,8 @@ supports remote loading when no authored session override is available. The
|
||||
- includes the four manifest-backed prepared glossary documents with their
|
||||
declared input identities for restore;
|
||||
- publishes extraction lanes only through explicit configured output rules;
|
||||
neither run-local nor durable Notarius bundles are scanned or uploaded wholesale.
|
||||
original Notarius bundles are not scanned or uploaded wholesale. Historical
|
||||
run-local references are not required for later publication.
|
||||
- selected artifact filter applies to configured artifact sources only.
|
||||
- plans every configured output into exactly one source-sorted outcome:
|
||||
`published`, `carried_locked`, `locked_unpublished`, `optional_missing`, or
|
||||
|
||||
@@ -35,14 +35,14 @@ into run-local output space.
|
||||
Polish and extraction write to actual run-local output, log, and debug paths.
|
||||
Each attempt advances managed relative `logs/<stage>` and `debug/<stage>` links;
|
||||
skips do not rotate them. Restore has its own diagnostic attempt. Extraction
|
||||
promotes validated lanes to flat artifacts and retains the original bundle in
|
||||
the producing run. See [Operations](../operations.md#local-state-layout).
|
||||
promotes validated lanes to flat artifacts; the original bundle remains in
|
||||
the producing run until cleanup. See [Operations](../operations.md#local-state-layout).
|
||||
|
||||
Prepared references delivered to Notarius use session-durable paths owned by
|
||||
`internal/artifacts` beneath
|
||||
`inputs/references/<sha256>/<prepared-basename>`. These verified
|
||||
content-addressed snapshots are outside run-local layout, survive ordinary
|
||||
published-run cleanup, and are excluded from publish and restore enumeration.
|
||||
session run-history cleanup, and are excluded from publish and restore enumeration.
|
||||
|
||||
## Locking
|
||||
|
||||
@@ -53,8 +53,8 @@ not evidence that a lock is active. Command and restore flows wait for this
|
||||
lock only while their context remains active, and report a release failure.
|
||||
|
||||
The runner assigns every invocation a run-workspace identity but creates the
|
||||
physical directory only before an executing stage that requires it. Fully
|
||||
reused invocations and cleanup-only invocations therefore do not accumulate
|
||||
physical run directory and its `runs/` parent only when an executing stage
|
||||
requires them. Fully reused invocations and cleanup-only invocations therefore do not accumulate
|
||||
empty run directories.
|
||||
|
||||
## Cleanup Semantics
|
||||
@@ -66,6 +66,7 @@ The canonical cleanup stage:
|
||||
ID, remote commit key, and current commit-pointer key;
|
||||
- consumes the resolved cleanup policy described in
|
||||
[Configuration](../config.md);
|
||||
- removes the entire session run history and recognized managed diagnostic views;
|
||||
- refuses unsafe deletes (root delete, traversal, and out-of-root targets);
|
||||
- treats missing targets as successful, idempotent deletion; and
|
||||
- uses its ordinary failed/succeeded manifest stage record for retry. A later
|
||||
|
||||
Reference in New Issue
Block a user