feat(findings): add one-click cleanup for historical findings

- Add DB `DeleteFindings` bulk deletion inside `WithEvidenceTx`, locking affected tasks/findings, cascading retests/cases, and removing originating `exploration_nodes` (kind='finding').
- Add `DELETE /api/exploration/findings` endpoint supporting `scope` (`all`, `filtered`, `selected`) via JSON body or query params with strict validation and 409 on archive-state conflicts.
- Add `api.cleanupFindings`, mock handler support, bilingual `findingsCleanup.*` i18n keys, and a one-click cleanup button + confirmation dialog on the Findings page refreshing all four views.
- Add Go DB/server tests (`TestDeleteFindings`, `TestDeleteFindingsValidation`, `TestDeleteFindingsEndpoint`).

Fixes #157
This commit is contained in:
ji ruo committed 2026-11-23 18:20:33 +08:00
1 parent 7b196bf683
commit e196a06aa9
9 files changed
+755 -3

No files matched your search

+5 -3
View File
@@ -448,6 +448,7 @@ export function FindingCaseList({
contextTask,
readOnly = false,
onTotal,
refreshKey = 0,
}: {
query: Omit<FindingQuery, "page" | "pageSize">;
selectedIds?: Set<string>;
@@ -455,6 +456,7 @@ export function FindingCaseList({
contextTask?: string;
readOnly?: boolean;
onTotal?: (total: number) => void;
refreshKey?: number;
}) {
const { ui } = useUITranslation();
@@ -464,10 +466,10 @@ export function FindingCaseList({
const [error, setError] = React.useState("");
const [refresh, setRefresh] = React.useState(0);
const key = JSON.stringify(query);
// biome-ignore lint/correctness/useExhaustiveDependencies: reset pagination when the filter fingerprint changes.
// biome-ignore lint/correctness/useExhaustiveDependencies: reset pagination when the filter fingerprint or external refresh changes.
React.useEffect(() => {
setPage(1);
}, [key]);
}, [key, refreshKey]);
// biome-ignore lint/correctness/useExhaustiveDependencies: refresh is an explicit reload requested after grouping/retry.
React.useEffect(() => {
let active = true;
@@ -490,7 +492,7 @@ export function FindingCaseList({
active = false;
clearTimeout(timer);
};
}, [key, page, pageSize, refresh]);
}, [key, page, pageSize, refresh, refreshKey]);
React.useEffect(() => {
if (data) onTotal?.(data.total);
}, [data, onTotal]);