fix: harden PTY events and configured roots
This commit is contained in:
@@ -34,12 +34,16 @@ const fixture = async (parent: string, name: string): Promise<string> => {
|
||||
return root;
|
||||
};
|
||||
|
||||
const importTree = (root: string, approvedRoot: string, signal?: AbortSignal) =>
|
||||
const importTree = (
|
||||
root: string,
|
||||
approvedRoot: string | readonly string[],
|
||||
signal?: AbortSignal,
|
||||
) =>
|
||||
importReferenceSource({
|
||||
root,
|
||||
caller: "reference-import-test",
|
||||
policy: {
|
||||
roots: [approvedRoot],
|
||||
roots: typeof approvedRoot === "string" ? [approvedRoot] : approvedRoot,
|
||||
secretPatterns: [".env", ".env.*"],
|
||||
...limits,
|
||||
},
|
||||
@@ -153,6 +157,20 @@ describe("reference source import", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("uses a valid reference root when another configured root is missing", async () => {
|
||||
const parent = await mkdtemp(join(tmpdir(), "rea-reference-roots-"));
|
||||
try {
|
||||
const root = await fixture(parent, "tree");
|
||||
const imported = await importTree(root, [
|
||||
join(parent, "missing"),
|
||||
parent,
|
||||
]);
|
||||
expect(imported).toMatchObject({ ok: true });
|
||||
} finally {
|
||||
await rm(parent, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it("records bounded local Git state without invoking Git", async () => {
|
||||
const parent = await mkdtemp(join(tmpdir(), "rea-reference-git-"));
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user