mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
refactor(permission-system): simplify policy and autoreview flow
This commit is contained in:
@@ -223,34 +223,6 @@ describe("handleToolCall decision events — confirmation_unavailable", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// ── infrastructure_auto_allowed path ──────────────────────────────────────
|
||||
|
||||
describe("handleToolCall decision events — infrastructure_auto_allowed", () => {
|
||||
it("emits allow with infrastructure_auto_allowed for Pi infra reads", async () => {
|
||||
const infraDir = "/test/agent";
|
||||
const { handler, events } = makeHandler({
|
||||
session: {
|
||||
checkPermission: vi.fn().mockReturnValue(makeCheckResult()),
|
||||
getInfrastructureReadDirs: vi.fn().mockReturnValue([infraDir]),
|
||||
},
|
||||
});
|
||||
|
||||
const event = makeToolCallEvent("read", {
|
||||
input: { path: `${infraDir}/some-file.json` },
|
||||
});
|
||||
await handler.handleToolCall(event, makeCtx());
|
||||
|
||||
const decisions = getDecisionEvents(events);
|
||||
const infraEvents = decisions.filter(
|
||||
(e) => e.resolution === "infrastructure_auto_allowed",
|
||||
);
|
||||
expect(infraEvents).toHaveLength(1);
|
||||
expect(infraEvents[0]).toMatchObject({
|
||||
result: "allow",
|
||||
resolution: "infrastructure_auto_allowed",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// ── auto_approved path (yolo mode) ───────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user