Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/lib/BrewCleanup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
reset();
try {
judgment = await api.judgeBrewCleanup();
} catch (e) {
error = String(e);
} catch {
error = "Homebrew 정리 계획을 만들지 못했습니다.";
} finally {
planning = false;
}
Expand Down Expand Up @@ -72,8 +72,8 @@
confirmationPhrase.trim(),
rationale.trim(),
);
} catch (e) {
error = String(e);
} catch {
error = "Homebrew 정리를 실행하지 못했습니다.";
} finally {
judgment = null;
confirmationPhrase = "";
Expand Down
30 changes: 30 additions & 0 deletions src/lib/brewCleanupErrorPrivacyContract.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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("BrewCleanup privacy-safe failure feedback", () => {
it("never renders arbitrary backend exception text", () => {
const source = readSource("src/lib/BrewCleanup.svelte");

expect(source).not.toContain("String(e)");
expect(source).toContain("Homebrew 정리 계획을 만들지 못했습니다.");
expect(source).toContain("Homebrew 정리를 실행하지 못했습니다.");
expect(source).toContain('role="alert"');
});

it("preserves the existing judgment and execution authority calls", () => {
const source = readSource("src/lib/BrewCleanup.svelte");

expect(source).toContain("api.judgeBrewCleanup()");
expect(source).toContain("api.executeBrewCleanup(");
expect(source).toContain("submittedJudgment.plan_fingerprint");
expect(source).toContain("submittedJudgment.judgment_id");
});
});
Loading