Skip to content

Conditionally clean up mount directories based on OpenDirectory configuration#115

Open
Copilot wants to merge 5 commits into
mainfrom
copilot/rewrite-backup-device-opening
Open

Conditionally clean up mount directories based on OpenDirectory configuration#115
Copilot wants to merge 5 commits into
mainfrom
copilot/rewrite-backup-device-opening

Conversation

Copilot AI commented May 30, 2026

Copy link
Copy Markdown
Contributor

open/close previously treated mount directory lifecycle inconsistently with configuration intent. This change aligns behavior so configured open paths are preserved, while temporary paths are removed after a successful close.

  • Behavioral contract

    • Preserve mount directories when OpenDirectory is configured.
    • Remove mount directories (and the empty temporary parent dir) when OpenDirectory is not configured and close succeeds.
  • CLI close-path cleanup logic

    • Added configuration-aware cleanup in close(...) via a remove_mount_dirs flag derived from parsed_config.OpenDirectory is None.
    • After successful unmount+crypt close, attempt to remove:
      • the per-device mount directory
      • then its parent directory (only if empty)
  • Test expectation updates

    • Updated roundtrip and regression assertions to reflect:
      • temp mount dirs disappear after successful close
      • configured OpenDirectory mount dirs remain present
remove_mount_dirs = parsed_config.OpenDirectory is None
...
sdm.unmount_device(map_name)
sdm.close_decrypted_device(map_name)
if remove_mount_dirs:
    with contextlib.suppress(OSError):
        mount_dir.rmdir()
    with contextlib.suppress(OSError):
        mount_dir.parent.rmdir()

Copilot AI changed the title Refactor device opening to config-driven mount root; remove open destination arg Conditionally clean up mount directories based on OpenDirectory configuration May 30, 2026
Copilot finished work on behalf of MaxG87 May 30, 2026 21:22
Copilot AI requested a review from MaxG87 May 30, 2026 21:22
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.

2 participants