mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 22:03:52 +00:00
wip
This commit is contained in:
parent
aa332307e5
commit
b372383cfd
47 changed files with 1845 additions and 1212 deletions
|
|
@ -4,18 +4,14 @@ export function organizationKey(organizationId: string): ActorKey {
|
|||
return ["org", organizationId];
|
||||
}
|
||||
|
||||
export function repositoryKey(organizationId: string, repoId: string): ActorKey {
|
||||
return ["org", organizationId, "repository", repoId];
|
||||
}
|
||||
|
||||
export function taskKey(organizationId: string, repoId: string, taskId: string): ActorKey {
|
||||
return ["org", organizationId, "repository", repoId, "task", taskId];
|
||||
return ["org", organizationId, "task", repoId, taskId];
|
||||
}
|
||||
|
||||
export function taskSandboxKey(organizationId: string, sandboxId: string): ActorKey {
|
||||
return ["org", organizationId, "sandbox", sandboxId];
|
||||
}
|
||||
|
||||
export function auditLogKey(organizationId: string, repoId: string): ActorKey {
|
||||
return ["org", organizationId, "repository", repoId, "audit-log"];
|
||||
export function auditLogKey(organizationId: string): ActorKey {
|
||||
return ["org", organizationId, "audit-log"];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -308,6 +308,7 @@ export function createMockBackendClient(defaultOrganizationId = "default"): Back
|
|||
task: task.title,
|
||||
sandboxProviderId: "local",
|
||||
status: toTaskStatus(archived ? "archived" : "running", archived),
|
||||
pullRequest: null,
|
||||
activeSandboxId: task.id,
|
||||
sandboxes: [
|
||||
{
|
||||
|
|
@ -453,6 +454,7 @@ export function createMockBackendClient(defaultOrganizationId = "default"): Back
|
|||
branchName: task.branch,
|
||||
title: task.title,
|
||||
status: task.status === "archived" ? "archived" : "running",
|
||||
pullRequest: null,
|
||||
updatedAt: task.updatedAtMs,
|
||||
}));
|
||||
},
|
||||
|
|
@ -633,11 +635,7 @@ export function createMockBackendClient(defaultOrganizationId = "default"): Back
|
|||
return { endpoint: "mock://terminal-unavailable" };
|
||||
},
|
||||
|
||||
async getSandboxWorkspaceModelGroups(
|
||||
_organizationId: string,
|
||||
_sandboxProviderId: SandboxProviderId,
|
||||
_sandboxId: string,
|
||||
): Promise<WorkspaceModelGroup[]> {
|
||||
async getSandboxWorkspaceModelGroups(_organizationId: string, _sandboxProviderId: SandboxProviderId, _sandboxId: string): Promise<WorkspaceModelGroup[]> {
|
||||
return DEFAULT_WORKSPACE_MODEL_GROUPS;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,9 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { auditLogKey, organizationKey, repositoryKey, taskKey, taskSandboxKey } from "../src/keys.js";
|
||||
import { auditLogKey, organizationKey, taskKey, taskSandboxKey } from "../src/keys.js";
|
||||
|
||||
describe("actor keys", () => {
|
||||
it("prefixes every key with organization namespace", () => {
|
||||
const keys = [
|
||||
organizationKey("default"),
|
||||
repositoryKey("default", "repo"),
|
||||
taskKey("default", "repo", "task"),
|
||||
taskSandboxKey("default", "sbx"),
|
||||
auditLogKey("default", "repo"),
|
||||
];
|
||||
const keys = [organizationKey("default"), taskKey("default", "repo", "task"), taskSandboxKey("default", "sbx"), auditLogKey("default")];
|
||||
|
||||
for (const key of keys) {
|
||||
expect(key[0]).toBe("org");
|
||||
|
|
|
|||
|
|
@ -164,6 +164,9 @@ describe("RemoteSubscriptionManager", () => {
|
|||
},
|
||||
} satisfies OrganizationEvent);
|
||||
|
||||
// applyEvent chains onto an internal promise — flush the microtask queue
|
||||
await flushAsyncWork();
|
||||
|
||||
expect(manager.getSnapshot("organization", params)?.taskSummaries[0]?.title).toBe("Updated task");
|
||||
expect(listenerA).toHaveBeenCalled();
|
||||
expect(listenerB).toHaveBeenCalled();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue