docs(plan): the policy dry-run rule must match the route
The route treats the string true as a dry run, so the policy must too, otherwise a dry run still raises an approval card for a write that never happens.
This commit is contained in:
parent
38cd015e28
commit
9121eb451e
1 changed files with 17 additions and 5 deletions
|
|
@ -1458,6 +1458,16 @@ describe("stock_items.set_quantities", () => {
|
|||
}).cls,
|
||||
).toBe("read");
|
||||
});
|
||||
|
||||
it("is a read when dry_run is the string true, matching the route", () => {
|
||||
expect(
|
||||
classifyToolCall("stock_items.set_quantities", {
|
||||
mode: "set",
|
||||
lines: [],
|
||||
dry_run: "true",
|
||||
}).cls,
|
||||
).toBe("read");
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
|
|
@ -1487,11 +1497,13 @@ In `src/lib/server/giellie-tool-policy.ts`, inside `classifyToolCall`, add this
|
|||
|
||||
```ts
|
||||
// A dry run writes nothing, so it must not raise an approval card.
|
||||
if (
|
||||
name === "stock_items.set_quantities" &&
|
||||
(input as { dry_run?: unknown } | null)?.dry_run === true
|
||||
) {
|
||||
return { cls: "read" };
|
||||
// The route treats the string "true" as a dry run too, so the policy
|
||||
// must agree with it — otherwise a dry run would still ask.
|
||||
if (name === "stock_items.set_quantities") {
|
||||
const dryRun = (input as { dry_run?: unknown } | null)?.dry_run;
|
||||
if (dryRun === true || dryRun === "true") {
|
||||
return { cls: "read" };
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue