Skip to content

All content mutations flow through pure Buffer transitions #2857

Description

@jsmestad

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

  1. Buffer content mutation is represented by pure transitions that return the new state and edit effects for insert, replace, delete, and bulk edit operations.
  2. Undo, version, dirty state, and ChangeLog updates occur through the same canonical transition.
  3. Agent LSP rename and code-action edits use Buffer.ensure_for_path and the canonical bulk edit operation for open and initially closed files.
  4. Duplicate line-list edit engines and direct filesystem mutation paths are removed.
  5. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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