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 8m20s
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 8m20s
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:
1 parent
944241392d
commit
687aed2c8c
1 file changed
+32
-1
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user