Skip to content

feat: stale decision commit warnings#53

Merged
Koukyosyumei merged 2 commits into
h5i-dev:mainfrom
jonathanj502:feat/stale-decision-commit-warnings
Jun 24, 2026
Merged

feat: stale decision commit warnings#53
Koukyosyumei merged 2 commits into
h5i-dev:mainfrom
jonathanj502:feat/stale-decision-commit-warnings

Conversation

@jonathanj502

@jonathanj502 jonathanj502 commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Directly extends decisions --stale feature. When h5i commit runs, check whether the staged diff touches a line near a previously recorded stale decision. If so, print an inline warning before the commit completes:

⚠ Commit touches src/repository.rs:88 near a stale decision from abc123: "chose JSON over binary"
reason was: reduces parse overhead at startup
Has this reasoning changed? Run h5i decisions --stale for details.

Design

  • Line-level matching, not file-level. Uses diff hunk ranges from git2::Patch against the decision's recorded file:line location (±CONTEXT_LINES proximity). File-level matching produces too many false positives on large files.
  • Stale-only signal. Modified and Fresh entries are dropped. Only decisions with similarity < 0.5 produce a warning.
  • Non-blocking. Errors from the staleness check are swallowed so a bug here never breaks the commit path.

Testing

Two unit tests added:

  • fires_when_line_touched — hunk spanning the decision line triggers the warning
  • silent_when_far — hunk far from the decision line produces no warning

@jonathanj502 jonathanj502 changed the title Feat/stale decision commit warnings feat: stale decision commit warnings Apr 3, 2026
@Koukyosyumei Koukyosyumei force-pushed the feat/stale-decision-commit-warnings branch from d227459 to c6d3a21 Compare June 24, 2026 18:21
@Koukyosyumei

Copy link
Copy Markdown
Collaborator

Thanks for the proposal and implementation! Right now, improving the other commands is a higher priority, but I’ll record this in the roadmap and merge it.

@Koukyosyumei Koukyosyumei merged commit 69def2e into h5i-dev:main Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants