From 65e14a2c4feda104f3aaf76f7aa899497abaf032 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Tue, 6 Oct 2026 00:50:37 +0200 Subject: [PATCH] fix(findings): a group's issue is found by its fingerprint only (#464) 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 Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB --- .../src/pipeline/issue_creation.rs | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/compliance-agent/src/pipeline/issue_creation.rs b/compliance-agent/src/pipeline/issue_creation.rs index 070a903..5bbcf1d 100644 --- a/compliance-agent/src/pipeline/issue_creation.rs +++ b/compliance-agent/src/pipeline/issue_creation.rs @@ -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]