Parent Epic: #2813
Type: Chore
Related work: #393, #1246
What
Buffer.Process calculates document edits, undo changes, dirty state, versions, and ChangeLog publication inline, while agent LSP rename and code-action tools maintain duplicate file and line-list mutation paths.
Why
The Buffer process should remain the single writer and effect owner, but one pure content transition should define how every batch edit changes document, undo, version, dirty state, and change publication.
Acceptance Criteria
- Buffer content mutation is represented by pure transitions that return the new state and edit effects for insert, replace, delete, and bulk edit operations.
- Undo, version, dirty state, and ChangeLog updates occur through the same canonical transition.
- Agent LSP rename and code-action edits use Buffer.ensure_for_path and the canonical bulk edit operation for open and initially closed files.
- Duplicate line-list edit engines and direct filesystem mutation paths are removed.
- Property and contract tests prove equivalent edit sequences produce identical content, undo, version, dirty, and change-log state.
Developer Notes
Approach: Extract content calculations from Buffer.Process into Buffer.State or a focused content-transition module. Keep GenServer callbacks responsible for request decoding and effects. Parse workspace edits once and route every file through Buffer authority.
Files/areas: lib/minga/buffer/process.ex, lib/minga/buffer/state.ex, lib/minga_agent/tools/lsp_rename.ex, lib/minga_agent/tools/lsp_code_actions.ex, lib/minga/lsp/workspace_edit.ex
Testing: Run Buffer edit and undo property suites plus common open-file, closed-file, multiline, multifile rename and code-action contracts.
Parent Epic: #2813
Type: Chore
Related work: #393, #1246
What
Buffer.Process calculates document edits, undo changes, dirty state, versions, and ChangeLog publication inline, while agent LSP rename and code-action tools maintain duplicate file and line-list mutation paths.
Why
The Buffer process should remain the single writer and effect owner, but one pure content transition should define how every batch edit changes document, undo, version, dirty state, and change publication.
Acceptance Criteria
Developer Notes
Approach: Extract content calculations from Buffer.Process into Buffer.State or a focused content-transition module. Keep GenServer callbacks responsible for request decoding and effects. Parse workspace edits once and route every file through Buffer authority.
Files/areas:
lib/minga/buffer/process.ex,lib/minga/buffer/state.ex,lib/minga_agent/tools/lsp_rename.ex,lib/minga_agent/tools/lsp_code_actions.ex,lib/minga/lsp/workspace_edit.exTesting: Run Buffer edit and undo property suites plus common open-file, closed-file, multiline, multifile rename and code-action contracts.