Skip to content

fix(drive): absolutize --backup-dir at resolution time - #1719

Merged
newhoggy merged 2 commits into
mainfrom
issue-1692-backup-dir-absolutize
Sep 17, 2026
Merged

newhoggy merged 2 commits into
mainfrom
issue-1692-backup-dir-absolutize

Conversation

@newhoggy

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • cargo build
  • cargo test --lib drive::lease::settings:: (23 passed)
  • cargo clippy --all-targets -- -D warnings

A relative --backup-dir (or OMNI_DEV_DRIVE_LEASE_BACKUP_DIR, or
settings.json's lease.backup_dir) was stored relative in the lease
ledger. A later `drive lease prune` run from a different cwd would
resolve the path against its own cwd, get NotFound, treat the backup
as already gone, and drop the ledger row while the real backup file
stayed on disk untracked; `drive lease restore` would fail outright.

resolve_backup_dir now routes every non-default source through
std::path::absolute, so the ledger always stores an absolute path
regardless of the caller's cwd.

Closes #1692
The prior commit fixed relative --backup-dir being stored relative in
the lease ledger; add the CHANGELOG entry every other fix in this
project already gets.
@github-actions

Copy link
Copy Markdown

Coverage

Total: 97.27% ⚪ 0 pp vs main

Comparing 5573c1a..3cbfa35 (merge-base → PR head)

File Before After Δ
src/drive/lease/settings.rs 98.45% 96.86% 🔴 -1.58 pp
🔇 5 ignored region(s), 0 tolerated region(s)

ignore removes the lines from both reports; tolerate keeps them in the reported percentage but scores them against the baseline, so a cross-run flip cannot move a delta. Regions are read from each revision's own source.

File Kind Lines Rev Reason
src/cli/drive/lease.rs ignore 408-412 both a sheet restore's fresh backup is always a DriveCopy — restore.rs's own recheck refuses unless the target is still a spreadsheet, and acquire() only ever takes a Bytes backup of a non-native target; this arm exists solely for exhaustiveness over the shared LeaseBackup enum
src/cli/drive/lease.rs ignore 928-931 both guards this test helper against misuse; every call site below passes an acquire subcommand
src/cli/drive/lease.rs ignore 942-945 both guards this test helper against misuse; every call site below passes a prune subcommand
src/drive/lease/ledger.rs ignore 812-816 both mutate_locked refuses before ever calling the closure, so its body never runs — a hit here is a regression, not a coverage gap
src/drive/lease/restore.rs ignore 1137-1141 both every test using this double refuses before authenticating; a hit here is a regression, not a coverage gap

Patch coverage

Patch: 87.88% (29/33 new lines covered)

File Patch Uncovered new lines
src/drive/lease/settings.rs 87.88% (29/33) 141, 143, 145, 362
Uncovered new lines (4)
  • src/drive/lease/settings.rs:141
  • src/drive/lease/settings.rs:143
  • src/drive/lease/settings.rs:145
  • src/drive/lease/settings.rs:362

📦 Full per-file coverage summary · run summary

@newhoggy
newhoggy merged commit 87d2112 into main Sep 17, 2026
17 checks passed
@newhoggy
newhoggy deleted the issue-1692-backup-dir-absolutize branch September 17, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(drive): relative --backup-dir is stored relative in the lease ledger; prune drops the row from another cwd

1 participant