2026-05-19 22:32:55 -05:00
|
|
|
# Internal: Command Restore
|
|
|
|
|
|
|
|
|
|
## Purpose
|
2026-05-23 14:07:11 +00:00
|
|
|
|
2026-12-02 16:49:46 +00:00
|
|
|
Restore imports products declared by the selected publication inventory into a
|
|
|
|
|
local session. The [CLI](../cli.md#session-restore) describes invocation and
|
|
|
|
|
[Operations](../operations.md#restore-workflow) describes operator recovery.
|
|
|
|
|
The session progress manifest stays local; publication is not a checkpoint backup.
|
|
|
|
|
|
|
|
|
|
## Discovery and planning
|
|
|
|
|
|
|
|
|
|
`internal/artifacts` validates the current pointer and its immutable commit,
|
|
|
|
|
including campaign, session, run, checksum, size, generation, and namespace.
|
|
|
|
|
Discovery binds the plan to that inventory. Obsolete execution-snapshot
|
|
|
|
|
declarations are ignored without reading their bodies. Authored session YAML
|
|
|
|
|
remains a separate configuration input.
|
|
|
|
|
|
|
|
|
|
The planner maps each recognized published source through the built-in product
|
|
|
|
|
registry or current concrete configured definitions. Local products use flat
|
|
|
|
|
canonical paths regardless of remote destination names. Exact immutable keys,
|
|
|
|
|
checksums, sizes, and generations remain attached to actions, including products
|
|
|
|
|
carried from earlier publications by locks. Supported prepared documents and,
|
|
|
|
|
with `--include-audio`, audio retain their input paths. Prepared glossary inputs
|
|
|
|
|
include the four individual envelopes and the combined glossary. Previous-session
|
|
|
|
|
requirements use the shared prerequisite-inclusive collector and exact
|
|
|
|
|
published-output declarations; execution diagnostics and remote progress
|
|
|
|
|
snapshots are not imported.
|
|
|
|
|
|
|
|
|
|
Each target is classified as `download`, `skip_same`, or `conflict` beneath the
|
|
|
|
|
session root. Symlinked or non-regular ancestors and leaves remain conflicts;
|
|
|
|
|
`--force` authorizes replacement of differing regular files only. Duplicate
|
|
|
|
|
local destinations fail planning. Dry runs perform no durable session writes and
|
|
|
|
|
report imports plus projected work using the normal read-only assessment for
|
|
|
|
|
preserved local progress. Product coverage is conditional on successful
|
|
|
|
|
verification of planned downloads; unavailable local assessment is conservative.
|
|
|
|
|
|
|
|
|
|
## Installation and local baseline
|
|
|
|
|
|
|
|
|
|
A non-dry run acquires the same workspace lock used by runners before loading
|
|
|
|
|
local state and classifying files. It writes an incomplete-restore marker before
|
|
|
|
|
installation. Transfers use confined sibling temporary files and verify the
|
|
|
|
|
inventory's content and object identity before replacement. Installed products
|
|
|
|
|
are checked against their canonical paths, content rules, sizes, and checksums.
|
|
|
|
|
|
|
|
|
|
Restore merges accepted products into a clone of local state and saves the local
|
|
|
|
|
manifest last. Identical content with valid local generation evidence keeps that
|
|
|
|
|
authority. Other accepted products receive typed supplied records. Changed
|
|
|
|
|
products invalidate dependent local work using the existing stage relations;
|
|
|
|
|
unrelated checkpoints and locally recorded diagnostics remain. Co-published
|
|
|
|
|
products need no shared generation history. The resulting coverage satisfies
|
|
|
|
|
work without inventing intermediate files or successful publish, notify, or
|
|
|
|
|
cleanup execution.
|
|
|
|
|
|
|
|
|
|
Failure leaves the marker and any already-installed files. A retry reclassifies
|
|
|
|
|
those files, verifies them, and saves the merged baseline; the marker is removed
|
|
|
|
|
after that save succeeds. This is not a whole-workspace rollback guarantee.
|
|
|
|
|
|
|
|
|
|
## Reporting and ownership
|
|
|
|
|
|
|
|
|
|
Reports identify publication identity, actions, counts, and failures. Actual
|
|
|
|
|
attempts persist under the restore run's logs. `restore --force` governs file
|
|
|
|
|
replacement and is independent of pipeline force.
|
|
|
|
|
|
|
|
|
|
Discovery is in `internal/app/restore_discovery.go`, planning and coverage in
|
|
|
|
|
`internal/app/restore_plan.go`, transfers in `internal/app/restore_execute.go`,
|
|
|
|
|
local baseline installation in `internal/app/restore_manifest_paths.go`, and
|
|
|
|
|
command coordination/reporting in `internal/app/restore_command.go` and
|
|
|
|
|
`internal/app/restore_report.go`. The restore, import-workflow, artifact, and
|
|
|
|
|
recovery tests cover source mapping, identity, conflicts, preservation, retry,
|
|
|
|
|
and carried products.
|