fix: prevent duplicate issue creation across repo delete/re-add
All checks were successful
CI / Deploy Agent (push) Has been skipped
CI / Deploy Dashboard (push) Has been skipped
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Has been skipped
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 4m22s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Clippy (pull_request) Successful in 4m33s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
CI / Detect Changes (push) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
All checks were successful
CI / Deploy Agent (push) Has been skipped
CI / Deploy Dashboard (push) Has been skipped
CI / Deploy Docs (push) Has been skipped
CI / Deploy MCP (push) Has been skipped
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 4m22s
CI / Security Audit (push) Has been skipped
CI / Tests (push) Has been skipped
CI / Format (pull_request) Successful in 3s
CI / Clippy (pull_request) Successful in 4m33s
CI / Security Audit (pull_request) Has been skipped
CI / Tests (pull_request) Has been skipped
CI / Detect Changes (push) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
Search all issue states (not just open) in Gitea tracker to find existing issues. Add title-based fallback search in addition to fingerprint search, so issues are found even if body format changed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -684,30 +684,36 @@ impl PipelineOrchestrator {
|
|||||||
|
|
||||||
let mut created = 0u32;
|
let mut created = 0u32;
|
||||||
for finding in actionable {
|
for finding in actionable {
|
||||||
// Check if an issue already exists for this fingerprint
|
|
||||||
match tracker
|
|
||||||
.find_existing_issue(owner, tracker_repo_name, &finding.fingerprint)
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Ok(Some(existing)) => {
|
|
||||||
tracing::debug!(
|
|
||||||
"[{repo_id}] Issue already exists for {}: {}",
|
|
||||||
finding.fingerprint,
|
|
||||||
existing.external_url
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Ok(None) => {}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::warn!("[{repo_id}] Failed to search for existing issue: {e}");
|
|
||||||
// Continue and try to create anyway
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let title = format!(
|
let title = format!(
|
||||||
"[{}] {}: {}",
|
"[{}] {}: {}",
|
||||||
finding.severity, finding.scanner, finding.title
|
finding.severity, finding.scanner, finding.title
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Check if an issue already exists by fingerprint first, then by title
|
||||||
|
let mut found_existing = false;
|
||||||
|
for search_term in [&finding.fingerprint, &title] {
|
||||||
|
match tracker
|
||||||
|
.find_existing_issue(owner, tracker_repo_name, search_term)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(Some(existing)) => {
|
||||||
|
tracing::debug!(
|
||||||
|
"[{repo_id}] Issue already exists for '{}': {}",
|
||||||
|
search_term,
|
||||||
|
existing.external_url
|
||||||
|
);
|
||||||
|
found_existing = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Ok(None) => {}
|
||||||
|
Err(e) => {
|
||||||
|
tracing::warn!("[{repo_id}] Failed to search for existing issue: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if found_existing {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let body = format_issue_body(finding);
|
let body = format_issue_body(finding);
|
||||||
let labels = vec![
|
let labels = vec![
|
||||||
format!("severity:{}", finding.severity),
|
format!("severity:{}", finding.severity),
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ impl IssueTracker for GiteaTracker {
|
|||||||
fingerprint: &str,
|
fingerprint: &str,
|
||||||
) -> Result<Option<TrackerIssue>, CoreError> {
|
) -> Result<Option<TrackerIssue>, CoreError> {
|
||||||
let url = self.api_url(&format!(
|
let url = self.api_url(&format!(
|
||||||
"/repos/{owner}/{repo}/issues?type=issues&state=open&q={fingerprint}"
|
"/repos/{owner}/{repo}/issues?type=issues&state=all&q={fingerprint}"
|
||||||
));
|
));
|
||||||
|
|
||||||
let resp = self
|
let resp = self
|
||||||
|
|||||||
Reference in New Issue
Block a user