mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 18:55:22 +00:00
refactor(permission-system): simplify policy and autoreview flow
This commit is contained in:
@@ -26,10 +26,6 @@ function payloadOf(
|
||||
};
|
||||
}
|
||||
|
||||
/** An `external path` evidence entry, as the bash external-directory gate emits it. */
|
||||
function externalPath(path: string, resolved: string | null): PromptEvidence {
|
||||
return { label: "external path", text: path, detail: resolved };
|
||||
}
|
||||
|
||||
describe("flaggedElements", () => {
|
||||
it("flags the decision-relevant value for a single-value ask", () => {
|
||||
@@ -44,17 +40,6 @@ describe("flaggedElements", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("flags the escaping paths rather than the command for a bash external-directory ask", () => {
|
||||
expect(
|
||||
flaggedElements(
|
||||
payloadOf("bash_external_directory", "diff /etc/hosts ~/.ssh/config", [
|
||||
{ label: "working directory", text: "/repo", detail: null },
|
||||
externalPath("/etc/hosts", null),
|
||||
externalPath("~/.ssh/config", "/home/me/.ssh/config"),
|
||||
]),
|
||||
),
|
||||
).toEqual(["/etc/hosts", "~/.ssh/config"]);
|
||||
});
|
||||
|
||||
it("flags nothing when the value is empty", () => {
|
||||
expect(flaggedElements(payloadOf("tool", ""))).toEqual([]);
|
||||
@@ -64,11 +49,9 @@ describe("flaggedElements", () => {
|
||||
describe("valueLabel", () => {
|
||||
it.each([
|
||||
["bash", "command"],
|
||||
["bash_external_directory", "command"],
|
||||
["mcp", "target"],
|
||||
["tool", "tool"],
|
||||
["path", "path"],
|
||||
["external_directory", "path"],
|
||||
["skill", "skill"],
|
||||
["skill_read", "skill"],
|
||||
] as const)("labels a %s ask's value %s", (kind, label) => {
|
||||
@@ -88,11 +71,6 @@ describe("valueLabel", () => {
|
||||
});
|
||||
|
||||
describe("flaggedElementLabel", () => {
|
||||
it("labels the escaping paths a bash external-directory ask flags", () => {
|
||||
expect(
|
||||
flaggedElementLabel(payloadOf("bash_external_directory", "cmd")),
|
||||
).toBe("path");
|
||||
});
|
||||
|
||||
it.each([
|
||||
"bash",
|
||||
|
||||
Reference in New Issue
Block a user