F1: settings.set refuses quoted, padded and control-character paths

Path settings get Kind::Path, checked by check_path in the engine: the one
validator for settings.set from agents, the CLI and the dialog. settings.list
marks them with path: true; the dialog uses that flag for Browse and shows
the engine's reason (userMessage drops the invalid-params prefix).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-02 19:02:08 +01:00
parent 750ecf5e51
commit 8a05f508c8
8 changed files with 150 additions and 51 deletions

View file

@ -7,7 +7,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
const invoke = vi.hoisted(() => vi.fn());
vi.mock("@tauri-apps/api/core", () => ({ invoke }));
import { listCommands, run, runWaiting, toEngineError } from "../src/ipc";
import { listCommands, run, runWaiting, toEngineError, userMessage } from "../src/ipc";
describe("run", () => {
beforeEach(() => {
@ -66,3 +66,13 @@ describe("toEngineError", () => {
expect(toEngineError({ code: 1, message: "x" }).code).toBe("ipc");
});
});
describe("userMessage", () => {
it("drops the engine's invalid params prefix and keeps other messages", () => {
expect(userMessage({ code: "invalid_params", message: "invalid params for search.find: unclosed group" })).toBe(
"unclosed group",
);
expect(userMessage({ code: "failed", message: "invalid params for x.y: z" })).toBe("invalid params for x.y: z");
expect(userMessage({ code: "invalid_params", message: "missing path" })).toBe("missing path");
});
});