Skip to main content

Module edit_transaction

Module edit_transaction 

Source
Expand description

Workspace edit transaction substrate.

Internal API. apply_full_write_with_evidence and WorkspaceEditTransaction::apply are the lowest-level disk-write primitives in CodeLens. They produce ApplyEvidence and an optional rollback report but do not enforce ADR-0009 role gates, write audit rows, or invalidate engine caches — those guarantees are layered on top by codelens-mcp dispatch. Direct callers from outside the workspace silently bypass the trust substrate. See the crate-level docs in lib.rs.

Provides a reusable domain object for multi-file mutations with pre-apply hash capture, post-apply hash verification, and rollback evidence. Used by LSP rename, safe_delete_apply, and future engine mutation primitives.

Rollback model: transactional best-effort with rollback evidence. In-memory backups + restore-on-error. TOCTOU re-check is a light same-function two-read window; disk-snapshot/lock guarantees are deferred to Phase 2.

Structs§

ApplyEvidence
FileHash
RollbackEntry
WorkspaceEditTransaction

Enums§

ApplyError
ApplyStatus

Functions§

apply_full_write_with_evidence
Apply a full-content rewrite to a single file with hash-based evidence and rollback on write failure. Used by single-file mutation primitives (create_text_file, delete_lines, replace_lines, etc.) that already performed an in-memory transform and need to commit the result with the same TOCTOU + rollback guarantees as WorkspaceEditTransaction.
apply_full_writes_with_evidence
G7b — multi-file full-write substrate.