Skip to content

Implement dry-run-first transactional patches and semantic diffs #5

Description

@zoeyrose

Outcome

Give CLI/editor/automation one safe mutation engine with revision preconditions, minimal lossless edits, multi-file atomicity, and reviewable diffs.

Scope and invariants

  • Define JSON/Rust command schemas with target stable IDs/spans, source/project revisions, semantic intent, affected files, and idempotency where useful.
  • Plan/validate without writing by default; show semantic and text diffs plus diagnostics and exact precondition failures.
  • Apply grouped multi-file changes through temporary files, permission preservation, fsync/rename, rollback/recovery, and explicit destination allowlists.
  • Generate inverse/undo metadata where safe and bound command count, files, bytes, diagnostics, diff output, and execution time.
  • CLI, editor, and optional MCP adapter call this engine rather than reimplementing writes.

Acceptance criteria

  • Fault injection at every stage leaves files wholly old or wholly validated new.
  • Unknown fields/comments/order/untouched bytes survive; repeated idempotent application is stable or fails with a clear revision mismatch.
  • Tests cover stale revisions, external edits, symlinks/path traversal, permission/disk failures, conflicting commands, huge diffs, cancellation, and recovery.
  • Dry run performs no source write and exits with machine-readable status.
  • Semantic diff is deterministic and references diagnostic/source IDs.

Dependencies and parallelization

Depends on #3/#4. Editor command history and automation adapter can develop concurrently against versioned plans/results.

Licensing

Toolkit code is MIT. Original past contributions by a person listed in the merged approved MIT provenance-grantor registry in atrinik/atrinik#275 may be copied, migrated, translated, or relicensed under MIT only after a complete, non-shallow Git-history audit, including renames and moves, proves the selected material is that grantor's solely authored original work and contains no embedded third-party or conflicting-licensed material. Record the exact evidence, applicable grantor, and destination. Mixed authored data and fixtures retain their actual licenses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions