bitbucket: cross-tool comment deduplication can silently drop annotations in multi-runner project mode
Summary
In service/bitbucket/annotator.go, ReportAnnotator.duplicates is used to deduplicate comments in Post():
commentID := externalIDFromDiagnostic(c.Result.Diagnostic)
if _, exist := r.duplicates[commentID]; !exist {
r.comments[c.ToolName] = append(r.comments[c.ToolName], c)
r.duplicates[commentID] = struct{}{}
}externalIDFromDiagnostic (in service/bitbucket/helpers.go) hashes only the diagnostic content (path, line, message, severity, etc.) — it does not include the tool/runner name. r.duplicates is a single map for the whole ReportAnnotator lifetime and is never reset per tool or per Flush().
Problem
Since #2758 fixed the panic that previously made multi-runner Bitbucket project mode unusable (#2203), multiple runners can now actually complete a full Post/Flush cycle each. This makes the following scenario reachable:
If two different runners (tools) report diagnostics that hash identically (same path, line, message, and severity — e.g. two linters both flagging the same underlying issue on the same line), the second runner's Post() call will see the hash already present in r.duplicates and silently drop the comment. If that was the second runner's only finding, its Bitbucket report will incorrectly show "Passed" instead of "Failed", hiding a real issue from that tool's report.
Suggested fix
Scope duplicates per tool (e.g. map[string]map[string]struct{} keyed by tool name first), or clear/reset the relevant portion of r.duplicates in flushTool/Flush so dedup only applies within a single tool's own comments rather than across all tools.
Context
Raised as a follow-up from review of #2758: https://github.com/reviewdog/reviewdog/pull/2758#issuecomment-5777785772
Source: reviewdog/reviewdog