Skip to content

feat(deduplication): add occurrence counter to duplicate comments - #49

Merged
Naoray merged 1 commit into
mainfrom
feat/occurrence-counter
Feb 8, 2026
Merged

feat(deduplication): add occurrence counter to duplicate comments#49
Naoray merged 1 commit into
mainfrom
feat/occurrence-counter

Conversation

@Naoray

@Naoray Naoray commented Feb 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds occurrence counter tracking to the deduplication system so each comment on a duplicate issue shows how many times the error has been seen (e.g., **Occurrence:** #5)
  • The counter uses a separate cache key ({prefix}count:{signature}) from the deduplication signature, increments on every encounter (even deduplicated ones), and refreshes its TTL on each increment
  • New config option deduplication.track_occurrences (default: true) allows disabling the feature

Changes

  • CacheManager -- Added incrementOccurrenceCount() and getOccurrenceCount() methods with a dedicated count cache key segment
  • DeduplicationHandler -- Tracks occurrences via new trackOccurrences constructor parameter; passes count through extra['github_occurrence_count']
  • TemplateRenderer -- Added {occurrence_count} replacement (defaults to 1 when not present); filters github_occurrence_count from the Extra Data section
  • comment.md -- Added **Occurrence:** #{occurrence_count} to the comment header
  • GithubIssueHandlerFactory -- Passes track_occurrences config to DeduplicationHandler
  • config/github-monolog.php -- Added deduplication.track_occurrences option

Test plan

  • CacheManager: occurrence count increments correctly across calls
  • CacheManager: occurrence count uses separate cache key from dedup signature
  • CacheManager: different signatures tracked independently
  • DeduplicationHandler: first occurrence shows count #1
  • DeduplicationHandler: count increments for deduplicated records within TTL
  • DeduplicationHandler: count resets after TTL expires
  • DeduplicationHandler: count not added when trackOccurrences is false
  • TemplateRenderer: occurrence count renders in comment template
  • TemplateRenderer: defaults to #1 when no count in extra
  • TemplateRenderer: count not leaked into Extra Data section
  • Factory: enables tracking by default, respects config override
  • All 291 tests pass, PHPStan clean, Pint clean

Closes #40

🤖 Generated with Claude Code

Closes #40

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Naoray
Naoray merged commit d20747b into main Feb 8, 2026
11 checks passed
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.

Add occurrence counter summary to duplicate issue comments

1 participant