This commit is contained in:
+28
-2
@@ -46,8 +46,14 @@ async function host(
|
||||
const registration = { async dispose() {} };
|
||||
let transform!: (editor: AgentEditor) => void;
|
||||
let reloaded = Promise.withResolvers<void>();
|
||||
let events!: ReadableStreamDefaultController<{ type: string }>;
|
||||
const stream = new ReadableStream<{ type: string }>({
|
||||
let events!: ReadableStreamDefaultController<{
|
||||
type: string;
|
||||
location?: { directory: string; workspaceID?: string };
|
||||
}>;
|
||||
const stream = new ReadableStream<{
|
||||
type: string;
|
||||
location?: { directory: string; workspaceID?: string };
|
||||
}>({
|
||||
start(controller) {
|
||||
events = controller;
|
||||
},
|
||||
@@ -101,6 +107,7 @@ async function host(
|
||||
// SAFETY: This test host implements the native APIs used by setup; unrelated context
|
||||
// services are deliberately absent so unexpected new dependencies fail the test.
|
||||
const context = {
|
||||
location: { directory: "/test" },
|
||||
options,
|
||||
catalog: {
|
||||
model: {
|
||||
@@ -227,6 +234,10 @@ async function host(
|
||||
events.enqueue({ type: "agent.updated" });
|
||||
await reloaded.promise;
|
||||
},
|
||||
changeBuildPermissionsElsewhere(permissions: Agent.Info["permissions"]) {
|
||||
build.permissions = [...permissions];
|
||||
events.enqueue({ type: "agent.updated", location: { directory: "/other" } });
|
||||
},
|
||||
async changeCodegraph(
|
||||
server:
|
||||
| { type: "local"; command: string[]; codemode?: boolean; disabled?: boolean }
|
||||
@@ -477,6 +488,21 @@ test("late build permission overrides remain effective for workers and coordinat
|
||||
).toBe("deny");
|
||||
});
|
||||
|
||||
test("events from another location do not reload this location's agents", async () => {
|
||||
const result = await host();
|
||||
result.changeBuildPermissionsElsewhere([
|
||||
...result.build.permissions,
|
||||
{ action: "read", resource: "*.env", effect: "deny" },
|
||||
]);
|
||||
await result.refresh(allModels);
|
||||
expect(
|
||||
result.agents
|
||||
.get("coordinate")
|
||||
?.permissions.filter((rule) => rule.action === "read" && rule.resource === "*.env")
|
||||
.at(-1)?.effect,
|
||||
).toBe("ask");
|
||||
});
|
||||
|
||||
test("todo lists persist within one session without leaking to another", async () => {
|
||||
const result = await host();
|
||||
const todos = [{ id: "1", content: "Implement", status: "in_progress", priority: "high" }];
|
||||
|
||||
Reference in New Issue
Block a user