-
Notifications
You must be signed in to change notification settings - Fork 0
fix: bound duplicate workflow failure feedback #197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
12
commits into
main
Choose a base branch
from
fix/duplicates-error-privacy-v1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b1e19b6
test: require bounded duplicate failure feedback
seonghobae 3414ffb
fix: bound duplicate workflow failure feedback
seonghobae 6703149
test: bound duplicate per-result failures
seonghobae d1fa8db
fix: bound partial duplicate cleanup errors
seonghobae c686f08
test: require fresh actionable duplicate-file evidence
seonghobae d166105
fix: clear stale duplicate evidence and guide recovery
seonghobae 8811014
Merge branch 'main' into fix/duplicates-error-privacy-v1
opencode-agent[bot] 16296f6
merge main: preserve bounded duplicate feedback
seonghobae 45bc3cb
test: reject stale duplicate verdict writes
seonghobae 73e92d2
fix: reject stale duplicate verdict writes
seonghobae 857bc98
Merge remote-tracking branch 'origin/main' into pr197
seonghobae fd8d37e
fix(ui): bind duplicate actions to current scan
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| import { readFileSync } from "node:fs"; | ||
| import { dirname, resolve } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| const repositoryRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../.."); | ||
|
|
||
| function readSource(path: string): string { | ||
| return readFileSync(resolve(repositoryRoot, path), "utf8"); | ||
| } | ||
|
|
||
| describe("Duplicates privacy-safe failure feedback", () => { | ||
| it("never renders arbitrary thrown backend exception text", () => { | ||
| const source = readSource("src/lib/Duplicates.svelte"); | ||
|
|
||
| expect(source).not.toContain("String(e)"); | ||
| expect(source).not.toContain("catch (e)"); | ||
| expect(source).not.toContain("{r.error}"); | ||
| expect(source).toContain( | ||
| "중복 파일 검색에 실패했습니다. 스캔 대상 폴더의 접근 권한을 확인하고 스캔을 다시 실행한 뒤 중복 찾기를 다시 누르세요.", | ||
| ); | ||
| expect(source).toContain( | ||
| "선택한 중복 파일을 휴지통으로 보내지 못했습니다. 파일이 열려 있는지와 휴지통 접근 권한을 확인한 뒤 중복 찾기부터 다시 실행하세요.", | ||
| ); | ||
| expect(source).toContain( | ||
| "파일이 사용 중인지와 접근 권한을 확인한 뒤 중복 찾기부터 다시 실행하세요.", | ||
| ); | ||
| }); | ||
|
|
||
| it("clears stale duplicate and verdict evidence before replacement discovery", () => { | ||
| const source = readSource("src/lib/Duplicates.svelte"); | ||
| const scanStart = source.indexOf("async function scan()"); | ||
| const duplicateCall = source.indexOf("const nextGroups = await api.findDuplicateFiles(root)", scanStart); | ||
| const scanPrefix = source.slice(scanStart, duplicateCall); | ||
|
|
||
| expect(scanStart).toBeGreaterThanOrEqual(0); | ||
| expect(duplicateCall).toBeGreaterThan(scanStart); | ||
| expect(scanPrefix).toContain("groups = []"); | ||
| expect(scanPrefix).toContain("toDelete = new Set()"); | ||
| expect(scanPrefix).toContain("verdicts = {}"); | ||
| expect(scanPrefix).toContain("results = []"); | ||
| }); | ||
|
|
||
| it("prevents a verdict response from an older scan replacing current evidence", () => { | ||
| const source = readSource("src/lib/Duplicates.svelte"); | ||
| const verdictStart = source.indexOf("async function loadVerdicts"); | ||
| const scanStart = source.indexOf("async function scan()"); | ||
| const verdictBody = source.slice(verdictStart, scanStart); | ||
|
|
||
| expect(source).toContain("let scanGeneration = $state(0)"); | ||
| expect(verdictBody).toContain("generation: number"); | ||
| expect(verdictBody).toContain("if (generation !== scanGeneration) return"); | ||
| expect(source).toContain("const generation = ++scanGeneration"); | ||
| expect(source).toContain("loadVerdicts(groups.flatMap((g) => g.paths), generation)"); | ||
| expect(source).toContain("if (generation !== scanGeneration || root !== scannedRoot) return"); | ||
| expect(source).toContain("if (generation === scanGeneration && root === scannedRoot) busy = false"); | ||
| }); | ||
|
|
||
| it("invalidates old-root evidence and serializes destructive confirmation", () => { | ||
| const source = readSource("src/lib/Duplicates.svelte"); | ||
|
|
||
| expect(source).toContain("if (root === observedRoot) return;"); | ||
| expect(source).toContain("++scanGeneration;"); | ||
| expect(source).toContain("if (busy || confirming) return;"); | ||
| expect(source).toContain("if (!okay || generation !== scanGeneration || root !== scannedRoot) return;"); | ||
| expect(source).toContain("disabled={busy || confirming || toDelete.size === 0}"); | ||
| expect(source).toContain("휴지통 이동 확인 창을 열지 못했습니다. 다른 확인 창을 닫은 뒤 다시 시도하세요."); | ||
| }); | ||
|
|
||
| it("uses the accessible failure region for an invalid all-selected group", () => { | ||
| const source = readSource("src/lib/Duplicates.svelte"); | ||
|
|
||
| expect(source).not.toContain("alert("); | ||
| expect(source).toContain( | ||
| "중복 그룹 전체가 삭제 대상으로 선택됐습니다. 각 그룹에서 최소 1개는 보존하도록 선택을 해제한 뒤 다시 시도하세요.", | ||
| ); | ||
| expect(source).toContain('role="alert"'); | ||
| }); | ||
|
|
||
| it("keeps customer-selected paths but makes result copy actionable", () => { | ||
| const source = readSource("src/lib/Duplicates.svelte"); | ||
|
|
||
| expect(source).toContain("<li title={r.path}>⚠ {r.path} —"); | ||
| expect(source).toContain("복원이 필요하면 휴지통에서 되돌리세요."); | ||
| expect(source).toContain("api.findDuplicateFiles(root)"); | ||
| expect(source).toContain("api.cleanPaths(paths)"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Stale cleanup corrupts new-root state
When the root changes during cleanup, stale completion updates
results,loadError, andbusy. Old outcomes appear, and active cleanup can become clickable again.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.