fix(findings): a group's issue is found by its fingerprint only (#464)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 9m58s

A group has the title of its rule's single findings, so the title
fallback of the issue search found one of their issues (being closed as
grouped) and no issue was opened for the group. The refreshed places of
a stored group also set updated_at.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-10-06 00:50:37 +02:00
1 parent 0451a03c8a
commit 7b65b59213
2 files changed
+33 -1

No files matched your search

@@ -232,6 +232,7 @@ impl RunFindings {
"file_path": finding.file_path.clone(),
"line_number": finding.line_number,
"code_snippet": finding.code_snippet.clone(),
"updated_at": mongodb::bson::DateTime::now(),
};
if !finding.control_refs.is_empty() {
set.insert("control_refs", finding.control_refs.clone());
@@ -139,7 +139,7 @@ impl PipelineOrchestrator {
// Check if an issue already exists by fingerprint first, then by title
let mut found_existing = false;
for search_term in [&finding.fingerprint, &title] {
for search_term in issue_search_terms(finding, &title) {
match tracker
.find_existing_issue(owner, tracker_repo_name, search_term)
.await
@@ -320,6 +320,18 @@ pub(crate) fn build_tracker(
}
}
/// What to search the tracker for to find a finding's issue: its
/// fingerprint, then its title. A group (#464) only by fingerprint: it has
/// the title of its rule's single findings, whose issues are being closed as
/// grouped, and must get one of its own.
fn issue_search_terms<'a>(finding: &'a Finding, title: &'a str) -> Vec<&'a str> {
if finding.occurrences.is_empty() {
vec![finding.fingerprint.as_str(), title]
} else {
vec![finding.fingerprint.as_str()]
}
}
/// Format a finding into a markdown issue body for the tracker.
pub(super) fn format_issue_body(finding: &Finding) -> String {
let mut body = String::new();
@@ -475,6 +487,25 @@ mod tests {
assert!(body.contains("- app/Main.java:80\n"));
assert!(body.contains("8 places, listed above; the first is `app/Main.java:10`."));
assert!(body.contains(&format!("`{}`", findings[0].fingerprint)));
// Found by its fingerprint only: an issue of one of its places has
// the same title and is not the group's.
assert_eq!(
issue_search_terms(&findings[0], "[low] mobsfscan: Logging"),
[findings[0].fingerprint.as_str()]
);
let single = Finding::new(
"r".into(),
"fp-single".into(),
"mobsfscan".into(),
ScanType::Sast,
"Logging".into(),
"The app logs.".into(),
Severity::Low,
);
assert_eq!(
issue_search_terms(&single, "[low] mobsfscan: Logging"),
["fp-single", "[low] mobsfscan: Logging"]
);
}
#[test]