Skip to content

Atomic pre-validation: check all changes before executing any #6

@soumyaray

Description

@soumyaray

Feature request

Currently, Changes#execute_all applies changes sequentially. If change 3 of 5 fails, changes 1-2 are already applied — leading to a partial state.

Proposed behavior

Before executing any changes, run a validation pass that checks all changes are feasible:

  • Target paths exist for renames
  • Directories are empty for non-force deletes
  • No conflicting renames (two files renamed to the same target)
  • Any other foreseeable issues

If any change would fail, report all issues and make no changes at all.

Current state

  • Reen#request (dry run) already analyzes changes without executing — this is useful for --review but doesn't pre-validate feasibility
  • Individual Change objects reject non-empty dir deletes, but other changes still execute
  • No rollback mechanism exists

Considerations

  • Could be an opt-in flag (--safe or --atomic) or the default behavior
  • Rollback (undo applied changes on failure) is an alternative but more complex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions