Skip to content
atikulmunnaPublic

About

Explainable Rust backup and restore tool with deduplicated snapshots and repository health insights.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

72 Commits

Folders and files

Repository files navigation

TraceBack

TraceBack is an explainable backup and restore tool written in Rust. It creates deduplicated local snapshots while making backup behavior easy to inspect: what changed, why storage grew, which paths own storage, whether restore still works, and how healthy the repository is.

TraceBack TUI workflow

Scripted overview of the guided terminal workflow.

Highlights

  • Deduplicated snapshot backups using BLAKE3-addressed chunks.
  • Full snapshot restore and selected file or directory restore.
  • Guided terminal UI for backup, restore, health checks, maintenance, policies, ignore suggestions, and filesystem remote push.
  • Integrity checks, restore rehearsal, and repository doctor reports.
  • Snapshot diffs, backup explanations, and file/directory storage blame.
  • Smart .tracebackignore suggestions with reviewed application.
  • Garbage collection, snapshot pruning, interrupted-write recovery, and writer locking for safer maintenance.
  • Optional encrypted repositories and filesystem remote synchronization.
  • Human-readable output for interactive use and JSON output for automation.

Status

TraceBack is actively developed and is not yet a 1.0 format-stability release. The current repository format is versioned as format_version = 0. The project rejects unsupported repository versions explicitly instead of attempting silent best-effort reads.

Installation

TraceBack currently builds from source.

cargo install --path crates/traceback-cli

For local development, run it through Cargo:

cargo run -p traceback-cli -- --help

Quickstart

Create a repository, back up a directory, verify the repository, inspect snapshots, and restore one snapshot into a test directory:

traceback init ./my-backups
traceback backup ./documents --repo ./my-backups
traceback check --repo ./my-backups
traceback snapshots --repo ./my-backups
traceback restore <snapshot-id> --repo ./my-backups --target ./restore-test

Open the guided terminal UI:

traceback tui --repo ./my-backups

Prefill a source path when starting the TUI:

traceback tui --repo ./my-backups --source ./documents

Guided TUI

The TUI is the easiest way to use TraceBack without memorizing commands. It opens to a main menu and keeps destructive or mutating operations behind a review step and explicit confirmation.

Available TUI workflows include:

  • Initialize or change the active repository.
  • Create a backup from a selected source path.
  • Browse snapshots and files in a three-panel view.
  • Preview restore commands and confirm restore with y.
  • Rehearse restore without writing to a user-selected destination.
  • Run repository health checks and doctor reports.
  • Compare snapshots and explain backup growth.
  • Inspect storage blame by path.
  • Recover interrupted writes.
  • Dry-run and confirm garbage collection.
  • Dry-run and confirm snapshot pruning.
  • Generate and apply reviewed ignore suggestions.
  • Preview and run a versioned backup policy file.
  • Preview and push durable repository objects to a filesystem remote.

Useful TUI keys:

Up/Down, j/k    move through menu items or focused lists
Enter           select, preview, scan, or run the current screen action
Tab             switch focus between snapshots and files
Home/End        jump to the first or last item
Space           toggle selected ignore suggestions
y               confirm restore, maintenance, policy, or remote push actions
n               cancel a pending confirmation
e               edit source, target, policy, ignore source, or remote paths
t               enter a custom restore target from the browser
r               preview restore for the selected snapshot or path
/               filter files in the browser
c               clear the file filter
Backspace       return to the main menu
? or F1         show or hide help
q               quit

CLI Commands

TraceBack exposes these commands:

init
backup
snapshots
restore
rehearse
check
recover
diff
explain
blame-size
doctor
ignore suggest
ignore apply
gc
prune
run
remote push
tui

Common examples:

traceback backup ./documents --repo ./my-backups
traceback restore <snapshot-id> --repo ./my-backups --target ./restore-test
traceback diff snap_old snap_new --repo ./my-backups
traceback explain latest --repo ./my-backups
traceback blame-size latest --repo ./my-backups
traceback doctor --repo ./my-backups

Backup Policies

Policy backups run from a versioned TOML file:

traceback run --config traceback.toml

Example policy:

version = 1

[backup]
sources = ["./documents", "./photos"]
repository = "./my-backups"
changing_file_policy = "retry_then_warn"

[ignore]
patterns = ["**/target", "**/.cache", "*.tmp"]

[retention]
keep_latest = 3

The TUI can preview and run the same policy file from the Run backup policy screen.

Ignore Suggestions

TraceBack can suggest common generated, dependency, cache, and temporary paths before backup:

traceback ignore suggest ./project

Apply reviewed rules explicitly:

traceback ignore apply ./project --rule "**/target" --yes

The TUI provides the same flow with selectable rules and y confirmation before writing .tracebackignore.

Maintenance

TraceBack separates planning from destructive maintenance:

traceback gc --repo ./my-backups --dry-run
traceback gc --repo ./my-backups --yes

traceback prune --repo ./my-backups --keep-latest 3 --dry-run
traceback prune --repo ./my-backups --keep-latest 3 --yes

traceback recover --repo ./my-backups

Garbage collection removes orphaned chunks only after confirmation. Snapshot pruning removes selected manifest files but leaves chunks for a later garbage collection pass.

Remote Push

Durable repository objects can be copied to a filesystem remote:

traceback remote push --repo ./my-backups --remote file:///backups/traceback

The remote push operation copies config.toml, chunk objects, and published snapshot manifests. Existing identical objects are skipped; conflicting remote objects are rejected.

Encryption

Encrypted repositories can be initialized with a passphrase supplied through an environment variable:

traceback init ./my-backups --encrypted --passphrase-env TRACEBACK_PASSPHRASE

Encrypted chunk payloads use a versioned envelope. Repository metadata remains versioned so future compatibility checks can reject unsupported formats deliberately.

JSON and Automation

Human-readable commands support global output controls:

--quiet
--verbose
--no-progress

Several reporting and maintenance commands support machine-readable output with the global --json flag:

traceback --json snapshots --repo ./my-backups
traceback --json check --repo ./my-backups
traceback --json diff snap_old snap_new --repo ./my-backups
traceback --json explain latest --repo ./my-backups
traceback --json blame-size latest --repo ./my-backups
traceback --json doctor --repo ./my-backups
traceback --json gc --repo ./my-backups --dry-run
traceback --json prune --repo ./my-backups --keep-latest 3 --dry-run
traceback --json remote push --repo ./my-backups --remote /backups/traceback

Safety Model

TraceBack is designed to make backup and restore decisions visible:

  • Backups scan metadata and stream file contents into chunk storage.
  • Snapshot manifests are staged before publication.
  • Writer locks prevent concurrent mutating operations.
  • Stale writer locks can be recovered safely.
  • Restore refuses unsafe paths and avoids overwriting existing files.
  • Symlink restore containment is checked.
  • Repository checks verify manifests and referenced chunks.
  • Restore rehearsal verifies recoverability without writing to a chosen target.
  • Maintenance screens and commands separate dry-run planning from deletion.

Repository Compatibility

TraceBack writes versioned repository metadata and validates repository configuration before mutating data. The current repository format is format_version = 0, with versioned snapshot manifests and a versioned encrypted chunk envelope when encryption is enabled.

Until 1.0, incompatible format changes may still happen. Future migrations should be implemented as deliberate, tested commands rather than silent rewrites.

Development

The project is built in small, tested increments. The core local workflow is:

init -> backup -> check -> restore

Every change should pass the same gate used by CI:

cargo fmt --all -- --check
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings

Tagged releases matching v* build Linux and Windows archives through GitHub Actions.

About

Explainable Rust backup and restore tool with deduplicated snapshots and repository health insights.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages