refactor: move hunk actionability decoration out of list building #148

Closed
opened 2026-09-21 18:12:32 +00:00 by barrettruth · 0 comments
Owner

Original issue: barrettruth/diffs.nvim#343
Original author: barrettruth
Original date: 2026-05-13T17:34:13Z

Tracked By

Context

Generated buffers and review lists attach mutation semantics to parsed hunks so maps like dp and do can make the right staged/unstaged decision. That policy is currently partly owned by list construction.

Problem

lua/diffs/lists.lua mutates parsed hunks with fields such as:

  • diff_spec
  • can_put
  • can_obtain
  • actionable
  • mutation_target

Actual mutation semantics live in lua/diffs/actions.lua and lua/diffs/behavior.lua. The list module should project hunks into quickfix/loclist items, not own mutation policy.

Scope

Add a small actionability helper, likely in diffs.actions or diffs.hunks, that decorates hunks from a DiffSpec. Let lists.lua call that helper or receive pre-decorated hunks.

Acceptance Criteria

  • review sections still get section-specific hunk actionability
  • dp and do behavior is unchanged
  • warning text is unchanged
  • quickfix/loclist item text is unchanged
  • user_data.diffs stays compatible
  • lists.lua no longer computes can_put / can_obtain directly

Suggested Readiness

> Original issue: barrettruth/diffs.nvim#343 > Original author: `barrettruth` > Original date: 2026-05-13T17:34:13Z ## Tracked By - #315 ## Context Generated buffers and review lists attach mutation semantics to parsed hunks so maps like `dp` and `do` can make the right staged/unstaged decision. That policy is currently partly owned by list construction. ## Problem `lua/diffs/lists.lua` mutates parsed hunks with fields such as: - `diff_spec` - `can_put` - `can_obtain` - `actionable` - `mutation_target` Actual mutation semantics live in `lua/diffs/actions.lua` and `lua/diffs/behavior.lua`. The list module should project hunks into quickfix/loclist items, not own mutation policy. ## Scope Add a small actionability helper, likely in `diffs.actions` or `diffs.hunks`, that decorates hunks from a `DiffSpec`. Let `lists.lua` call that helper or receive pre-decorated hunks. ## Acceptance Criteria - review sections still get section-specific hunk actionability - `dp` and `do` behavior is unchanged - warning text is unchanged - quickfix/loclist item text is unchanged - `user_data.diffs` stays compatible - `lists.lua` no longer computes `can_put` / `can_obtain` directly ## Suggested Readiness ```sh ```
barrettruth 2026-09-21 18:12:32 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
barrettruth/diffs.nvim#148
No description provided.