mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-09 16:02:36 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - A project stores its work in Core/local storage or in a storage plugin > - Today, Core finds the installed default each time it reads a project > - So installing a default storage plugin moves existing projects, without a saved change > - Agents that cannot reach the new storage then lose access to new workspaces > - This pull request makes Core apply the default once, when it creates a project > - The benefit is that a project stays on its storage until a person moves it ## Linked Issues or Issue Description No issue exists. This describes the problem. I searched open pull requests for related work and found no duplicate. **What existing behavior does this improve?** How Core chooses the storage for a project when a plugin claims `defaultForProjects`. **Current behavior** Installing such a plugin changes the storage of every existing project with no explicit choice. Disabling the plugin changes it back. Nothing is saved, so the project has no fixed owner. Execution environments and storage are separate contracts, so an agent can lose access to new workspaces on a project that it used before. **Proposed behavior** Core saves the storage choice on the project when it creates the project. A project with no saved choice uses Core/local storage. A plugin-backed project stays attached to its plugin. A Core/local project can move to a plugin. **Reason and benefit** A project stays on its storage until a person moves it, so installing or disabling a plugin does not change where work goes. **Alternatives considered** - Keep the default at read time and add a process that saves a choice on existing projects when a plugin arrives. This adds a background step and a race with new projects. - Add a new database column. The existing policy field already holds the choice, so a migration is not necessary. ## What Changed - `resolveProjectWorkspaceProvider` reads only the saved choice. It no longer applies an installed default. - `withDefaultProjectStorage` applies the default when Core creates a project, including a personal private project. With more than one default, a project with no explicit choice is refused. This is the existing conflict rule, now applied at creation. - `projectService.update` refuses a change of storage on a plugin-backed project. An update that omits the field keeps the attachment. - Plugin lifecycle delivery sends project events to a storage provider only for projects attached to it, and for deleted projects. Core acknowledges the other events for that provider. Other plugins continue to receive all project events. - The project settings control has no "Inherit" option. It is locked on a plugin-backed project. - `ProjectWorkspaceProviderConfiguration.source` no longer has the `"default"` value. - A project with no repository or folder ignores its saved storage choice when a task runs. A storage plugin cannot manage this type of project, so its tasks use a plain task directory. Without this change, the second run of a task reset the agent session, and remote agents could not use an empty task directory. - The plugin SDK README and the plugin authoring guide describe the new rules. ## Verification - `npx vitest run server/src/__tests__/project-workspace-provider.integration.test.ts server/src/__tests__/plugin-lifecycle-delivery.test.ts server/src/__tests__/plugin-workspaces.integration.test.ts packages/plugins/sdk/tests/workspace-provider.test.ts`: 93 tests pass. - `npx vitest run src/components/ProjectProperties.concurrency.test.tsx` in `ui/`: 9 tests pass. - `pnpm --filter @paperclipai/server typecheck` and `pnpm --filter @paperclipai/ui typecheck` pass. - `npx vitest run` on `heartbeat-session-preparation`, `workspace-preparation`, `remote-workspace-source`, `project-workspace-provider.integration`, and `plugin-workspaces.integration` in `server/`: 231 tests pass. - I did not run the full test suite locally. CI runs it. - I did not test this change on a running instance. ## Risks - **Behavior change at upgrade:** an existing project that uses a plugin only through the installed default, with no saved choice, moves to Core/local storage after upgrade. Its plugin files stay in place, but new work does not use them until an operator sets `storageProviderPluginId` on the project. This pull request has no automatic backfill. - **Missed lifecycle events:** a provider does not receive events for a Core/local project. If the project moves to that provider later, the update event starts its reconcile. - **One-way move:** a person cannot move a plugin-backed project back through the API or the UI. This is intended. If a plugin is disabled, the project fails closed, as it does today for an explicit choice. - This pull request does not stop a person from assigning an agent to a project with storage that the agent cannot reach. That is follow-up work. - This changes core plugin behavior, and I did not discuss it in `#dev` first. Maintainers can tell me if they want a discussion before review. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), through Claude Code, with tool use and code execution. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
250 lines
18 KiB
TypeScript
250 lines
18 KiB
TypeScript
import { randomUUID } from "node:crypto";
|
|
import express from "express";
|
|
import request from "supertest";
|
|
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
import { eq, sql } from "drizzle-orm";
|
|
import { companies, createDb, executionWorkspaces, heartbeatRuns, issues, pluginCompanySettings, plugins, projects } from "@paperclipai/db";
|
|
import { createPluginWorkspaceFixture } from "./helpers/plugin-workspaces.js";
|
|
import { getEmbeddedPostgresTestSupport, startEmbeddedPostgresTestDatabase } from "./helpers/embedded-postgres.js";
|
|
import { effectiveProjectWorkspacePolicy, listProjectWorkspaceProviders, resolveProjectWorkspaceProvider, sourcelessProjectWorkspacePolicy } from "../services/project-workspace-provider.js";
|
|
import { preparePluginWorkspace } from "../services/plugin-workspaces.js";
|
|
import { executionWorkspaceService } from "../services/execution-workspaces.js";
|
|
import { issueService } from "../services/issues.js";
|
|
import { instanceSettingsService } from "../services/instance-settings.js";
|
|
import { buildExecutionWorkspaceAdapterConfig, parseIssueExecutionWorkspaceSettings, resolveEffectiveWorkspaceStrategyType, resolveExecutionWorkspaceMode } from "../services/execution-workspace-policy.js";
|
|
import { ensurePersonalPrivateProject, projectService } from "../services/projects.js";
|
|
import { projectRoutes } from "../routes/projects.js";
|
|
import { errorHandler } from "../middleware/index.js";
|
|
|
|
const support = await getEmbeddedPostgresTestSupport();
|
|
describe.skipIf(!support.supported)("installed project workspace defaults", () => {
|
|
let database: Awaited<ReturnType<typeof startEmbeddedPostgresTestDatabase>>;
|
|
let db: ReturnType<typeof createDb>;
|
|
beforeAll(async () => {
|
|
database = await startEmbeddedPostgresTestDatabase("project-provider-defaults");
|
|
db = createDb(database.connectionString);
|
|
}, 120_000);
|
|
afterAll(async () => { await db?.$client.end(); await database?.cleanup(); });
|
|
beforeEach(async () => { await db.execute(sql`truncate companies, plugins cascade`); });
|
|
|
|
async function fixture() {
|
|
const f = await createPluginWorkspaceFixture(db);
|
|
const [plugin] = await db.select().from(plugins).where(eq(plugins.id, f.pluginId));
|
|
await db.update(plugins).set({ manifestJson: { ...plugin.manifestJson, workspaceProvider: {
|
|
...plugin.manifestJson.workspaceProvider!, defaultForProjects: { mode: "isolated_workspace", strategy: "git_worktree" },
|
|
} } }).where(eq(plugins.id, f.pluginId));
|
|
return f;
|
|
}
|
|
|
|
it("attaches a new project to the installed default and leaves existing projects where they are", async () => {
|
|
const f = await fixture();
|
|
await db.update(projects).set({ executionWorkspacePolicy: null }).where(eq(projects.id, f.input.projectId));
|
|
const svc = projectService(db);
|
|
const created = await svc.create(f.companyId, { name: "New project" });
|
|
expect(created.executionWorkspacePolicy).toMatchObject({ enabled: true, storageProviderPluginId: f.pluginId });
|
|
expect(created.workspaceProvider).toMatchObject({ source: "project", pluginId: f.pluginId });
|
|
const existing = await svc.getById(f.input.projectId);
|
|
expect(existing!.executionWorkspacePolicy).toBeNull();
|
|
expect(existing!.workspaceProvider).toMatchObject({ source: "core", pluginId: null });
|
|
expect(await effectiveProjectWorkspacePolicy(db, f.companyId, null, true)).toBeNull();
|
|
expect(await preparePluginWorkspace(db, f.workers, { ...f.input, selectedProviderPluginId: null })).toBeNull();
|
|
expect(f.calls).toHaveLength(0);
|
|
});
|
|
|
|
it("creates a project on Core storage when no default is installed, and keeps it there after one arrives", async () => {
|
|
const f = await createPluginWorkspaceFixture(db);
|
|
const svc = projectService(db);
|
|
const created = await svc.create(f.companyId, { name: "Before the provider" });
|
|
expect(created.executionWorkspacePolicy).toBeNull();
|
|
const [plugin] = await db.select().from(plugins).where(eq(plugins.id, f.pluginId));
|
|
await db.update(plugins).set({ manifestJson: { ...plugin.manifestJson, workspaceProvider: {
|
|
...plugin.manifestJson.workspaceProvider!, defaultForProjects: { mode: "isolated_workspace", strategy: "git_worktree" },
|
|
} } }).where(eq(plugins.id, f.pluginId));
|
|
expect((await svc.getById(created.id))!.workspaceProvider).toMatchObject({ source: "core", pluginId: null });
|
|
});
|
|
|
|
it("keeps an explicit creation choice", async () => {
|
|
const f = await fixture();
|
|
const other = await createPluginWorkspaceFixture(db, f.companyId);
|
|
const svc = projectService(db);
|
|
expect((await svc.create(f.companyId, { name: "Local", executionWorkspacePolicy: { enabled: true, storageProviderPluginId: null } })).workspaceProvider)
|
|
.toMatchObject({ source: "project", pluginId: null });
|
|
expect((await svc.create(f.companyId, { name: "Other", executionWorkspacePolicy: { enabled: true, storageProviderPluginId: other.pluginId } })).workspaceProvider)
|
|
.toMatchObject({ source: "project", pluginId: other.pluginId });
|
|
});
|
|
|
|
it("keeps a personal project on the installed default", async () => {
|
|
const f = await fixture();
|
|
const project = await ensurePersonalPrivateProject(db, f.companyId, "user-one");
|
|
expect(project.executionWorkspacePolicy).toMatchObject({ storageProviderPluginId: f.pluginId });
|
|
});
|
|
|
|
it.each(["create", "import"] as const)("%s leaves an unspecified task mode inherited from the effective provider", async method => {
|
|
const f = await fixture();
|
|
await instanceSettingsService(db).updateExperimental({ enableIsolatedWorkspaces: true });
|
|
let issueId: string;
|
|
if (method === "create") {
|
|
const created = await issueService(db).create(f.companyId, { title: "Use inherited storage", projectId: f.input.projectId, assigneeAgentId: f.input.agentId });
|
|
issueId = created.id;
|
|
} else {
|
|
issueId = randomUUID();
|
|
await issueService(db).importIssues(f.companyId, [{ id: issueId, ref: "inherited", title: "Import inherited storage", projectId: f.input.projectId,
|
|
projectWorkspaceId: null, description: null, assigneeAgentId: f.input.agentId, status: "todo", priority: "medium", billingCode: null,
|
|
assigneeAdapterOverrides: null, executionWorkspaceSettings: null, labelIds: [], monitorNotes: null, monitorScheduledBy: null }]);
|
|
}
|
|
const [task] = await db.select().from(issues).where(eq(issues.id, issueId));
|
|
expect(task.executionWorkspaceSettings?.mode).toBeUndefined();
|
|
const policy = await effectiveProjectWorkspacePolicy(db, f.companyId, { enabled: true, storageProviderPluginId: f.pluginId }, true);
|
|
const settings = parseIssueExecutionWorkspaceSettings(task.executionWorkspaceSettings);
|
|
const mode = resolveExecutionWorkspaceMode({ projectPolicy: policy, issueSettings: settings, legacyUseProjectWorkspace: null });
|
|
const config = buildExecutionWorkspaceAdapterConfig({ agentConfig: {}, projectPolicy: policy, issueSettings: settings, mode, legacyUseProjectWorkspace: null });
|
|
const [run] = await db.insert(heartbeatRuns).values({ companyId: f.companyId, agentId: f.input.agentId,
|
|
issueId, scopeKind: "issue", status: "running", runtimeMode: "legacy" }).returning();
|
|
await preparePluginWorkspace(db, f.workers, { ...f.input, runId: run.id, issueId, mode, strategy: resolveEffectiveWorkspaceStrategyType(mode, config) });
|
|
expect(f.calls[0].operation).toMatchObject({ mode: "isolated_workspace", strategy: "git_worktree" });
|
|
});
|
|
|
|
it("keeps a plugin-backed project attached through every policy update", async () => {
|
|
const f = await fixture();
|
|
const other = await createPluginWorkspaceFixture(db, f.companyId);
|
|
const workspace = await preparePluginWorkspace(db, f.workers, f.input);
|
|
const svc = projectService(db);
|
|
const kept = await svc.update(f.input.projectId, { executionWorkspacePolicy: { enabled: true, sharedWorkspaceConcurrency: "serialize" } });
|
|
expect(kept!.executionWorkspacePolicy).toMatchObject({ storageProviderPluginId: f.pluginId, sharedWorkspaceConcurrency: "serialize" });
|
|
expect((await svc.update(f.input.projectId, { executionWorkspacePolicy: null }))!.workspaceProvider).toMatchObject({ source: "project", pluginId: f.pluginId });
|
|
for (const storageProviderPluginId of [null, other.pluginId]) {
|
|
await expect(svc.update(f.input.projectId, { executionWorkspacePolicy: { enabled: true, storageProviderPluginId } }))
|
|
.rejects.toThrow("stays attached");
|
|
}
|
|
expect((await db.select().from(executionWorkspaces).where(eq(executionWorkspaces.id, workspace!.id)))[0]).toEqual(workspace);
|
|
});
|
|
|
|
it("lets a Core project move to a storage plugin, and then keeps it there", async () => {
|
|
const f = await fixture();
|
|
await db.update(projects).set({ executionWorkspacePolicy: null }).where(eq(projects.id, f.input.projectId));
|
|
const svc = projectService(db);
|
|
expect((await svc.update(f.input.projectId, { executionWorkspacePolicy: { enabled: true, storageProviderPluginId: f.pluginId } }))!.workspaceProvider)
|
|
.toMatchObject({ source: "project", pluginId: f.pluginId });
|
|
await expect(svc.update(f.input.projectId, { executionWorkspacePolicy: { enabled: true, storageProviderPluginId: null } })).rejects.toThrow("stays attached");
|
|
});
|
|
|
|
it("preserves explicit alternatives and the explicit Core/local choice", async () => {
|
|
const f = await fixture(), other = await createPluginWorkspaceFixture(db, f.companyId);
|
|
const providers = await listProjectWorkspaceProviders(db, f.companyId);
|
|
expect(resolveProjectWorkspaceProvider({ enabled: true, storageProviderPluginId: other.pluginId }, providers, true))
|
|
.toMatchObject({ source: "project", pluginId: other.pluginId });
|
|
const local = { enabled: true, storageProviderPluginId: null };
|
|
await db.update(projects).set({ executionWorkspacePolicy: local }).where(eq(projects.id, f.input.projectId));
|
|
expect((await projectService(db).getById(f.input.projectId))!.executionWorkspacePolicy).toEqual(local);
|
|
expect(await preparePluginWorkspace(db, f.workers, { ...f.input, selectedProviderPluginId: null })).toBeNull();
|
|
expect(f.calls).toHaveLength(0);
|
|
});
|
|
|
|
it.each(["disabled", "uninstalled"] as const)("does not attach a new project to an instance %s provider", async status => {
|
|
const f = await fixture();
|
|
await db.update(plugins).set({ status }).where(eq(plugins.id, f.pluginId));
|
|
expect((await projectService(db).create(f.companyId, { name: "New project" })).executionWorkspacePolicy).toBeNull();
|
|
});
|
|
|
|
it("scopes company enablement and does not borrow another company's override", async () => {
|
|
const f = await fixture();
|
|
const [other] = await db.insert(companies).values({ name: "Other", issuePrefix: "OTH" }).returning();
|
|
await db.insert(pluginCompanySettings).values({ companyId: f.companyId, pluginId: f.pluginId, enabled: false });
|
|
await db.insert(pluginCompanySettings).values({ companyId: other.id, pluginId: f.pluginId, enabled: true });
|
|
const svc = projectService(db);
|
|
expect((await svc.create(f.companyId, { name: "Disabled here" })).executionWorkspacePolicy).toBeNull();
|
|
expect((await svc.create(other.id, { name: "Enabled here" })).executionWorkspacePolicy).toMatchObject({ storageProviderPluginId: f.pluginId });
|
|
await expect(effectiveProjectWorkspacePolicy(db, f.companyId, { enabled: true, storageProviderPluginId: f.pluginId }, true))
|
|
.rejects.toThrow("unavailable");
|
|
});
|
|
|
|
it.each(["error", "installed", "upgrade_pending", "ready"] as const)("retains the selected %s provider when its worker is unavailable", async status => {
|
|
const f = await fixture();
|
|
await db.update(plugins).set({ status }).where(eq(plugins.id, f.pluginId));
|
|
expect(await effectiveProjectWorkspacePolicy(db, f.companyId, { enabled: true, storageProviderPluginId: f.pluginId }, true)).toMatchObject({ storageProviderPluginId: f.pluginId });
|
|
await expect(preparePluginWorkspace(db, undefined, f.input)).rejects.toThrow("unavailable");
|
|
expect(await db.select().from(executionWorkspaces)).toHaveLength(0);
|
|
});
|
|
|
|
it("never falls back when the attached provider is disabled during preparation", async () => {
|
|
const f = await fixture();
|
|
const policy = await effectiveProjectWorkspacePolicy(db, f.companyId, { enabled: true, storageProviderPluginId: f.pluginId }, true);
|
|
await db.insert(pluginCompanySettings).values({ companyId: f.companyId, pluginId: f.pluginId, enabled: false });
|
|
await expect(preparePluginWorkspace(db, f.workers, { ...f.input, selectedProviderPluginId: policy!.storageProviderPluginId }))
|
|
.rejects.toThrow("unavailable");
|
|
expect(await db.select().from(executionWorkspaces)).toHaveLength(0);
|
|
});
|
|
|
|
it("asks for a choice when creating a project with conflicting defaults, and leaves existing projects working", async () => {
|
|
const f = await fixture();
|
|
const other = await createPluginWorkspaceFixture(db, f.companyId);
|
|
const [plugin] = await db.select().from(plugins).where(eq(plugins.id, f.pluginId));
|
|
await db.update(plugins).set({ manifestJson: { ...plugin.manifestJson, id: `test.${other.pluginId}` } }).where(eq(plugins.id, other.pluginId));
|
|
const svc = projectService(db);
|
|
await expect(svc.create(f.companyId, { name: "Ambiguous" })).rejects.toThrow("Multiple workspace storage plugins");
|
|
expect((await svc.create(f.companyId, { name: "Chosen", executionWorkspacePolicy: { enabled: true, storageProviderPluginId: f.pluginId } })).workspaceProvider)
|
|
.toMatchObject({ pluginId: f.pluginId, error: null });
|
|
expect((await svc.getById(f.input.projectId))!.workspaceProvider).toMatchObject({ pluginId: f.pluginId, error: null });
|
|
});
|
|
|
|
it.each([
|
|
{ enabled: false },
|
|
{ enabled: true, defaultMode: "shared_workspace" },
|
|
{ enabled: true, workspaceStrategy: { type: "project_primary" } },
|
|
])("rejects incompatible explicit settings: %j", async policy => {
|
|
const f = await fixture();
|
|
await expect(effectiveProjectWorkspacePolicy(db, f.companyId, { ...policy, storageProviderPluginId: f.pluginId }, true)).rejects.toThrow("explicit project workspace settings");
|
|
});
|
|
|
|
it("ignores saved storage for a project with no source", () => {
|
|
const pluginId = randomUUID();
|
|
expect(sourcelessProjectWorkspacePolicy(null)).toBeNull();
|
|
expect(sourcelessProjectWorkspacePolicy({ enabled: true, storageProviderPluginId: pluginId })).toBeNull();
|
|
expect(sourcelessProjectWorkspacePolicy({ enabled: false, storageProviderPluginId: null })).toBeNull();
|
|
expect(sourcelessProjectWorkspacePolicy({ enabled: true })).toEqual({ enabled: true });
|
|
expect(sourcelessProjectWorkspacePolicy({ enabled: true, defaultMode: "isolated_workspace", storageProviderPluginId: pluginId }))
|
|
.toEqual({ enabled: true, defaultMode: "isolated_workspace" });
|
|
});
|
|
|
|
it("preserves compatible explicit fields while supplying only missing defaults", async () => {
|
|
const f = await fixture();
|
|
const policy = { enabled: true, defaultMode: "operator_branch", storageProviderPluginId: f.pluginId, workspaceStrategy: { type: "git_worktree", baseRef: "release", branchTemplate: "kept" } };
|
|
expect(await effectiveProjectWorkspacePolicy(db, f.companyId, policy, true)).toEqual(policy);
|
|
expect(await effectiveProjectWorkspacePolicy(db, f.companyId, { enabled: true, storageProviderPluginId: f.pluginId }, false)).toEqual({ enabled: true, storageProviderPluginId: f.pluginId });
|
|
});
|
|
|
|
it("retains both plugin and local workspace ownership when defaults change", async () => {
|
|
const f = await fixture();
|
|
const workspace = await preparePluginWorkspace(db, f.workers, f.input);
|
|
await db.update(projects).set({ executionWorkspacePolicy: { enabled: true, storageProviderPluginId: null } }).where(eq(projects.id, f.input.projectId));
|
|
expect(await preparePluginWorkspace(db, f.workers, { ...f.input, existingWorkspaceId: workspace!.id })).toMatchObject({ id: workspace!.id });
|
|
await db.update(plugins).set({ status: "error" }).where(eq(plugins.id, f.pluginId));
|
|
await expect(preparePluginWorkspace(db, f.workers, { ...f.input, existingWorkspaceId: workspace!.id })).rejects.toThrow("unavailable");
|
|
const [local] = await db.insert(executionWorkspaces).values({ companyId: f.companyId, projectId: f.input.projectId,
|
|
projectWorkspaceId: f.input.projectWorkspaceId, mode: "shared_workspace", strategyType: "project_primary", name: "Retained local", providerType: "local_fs", cwd: "/fixture/kept" }).returning();
|
|
await db.update(projects).set({ executionWorkspacePolicy: null }).where(eq(projects.id, f.input.projectId));
|
|
expect(await preparePluginWorkspace(db, f.workers, { ...f.input, existingWorkspaceId: local.id })).toBeNull();
|
|
expect((await db.select().from(executionWorkspaces).where(eq(executionWorkspaces.id, local.id)))[0]).toEqual(local);
|
|
});
|
|
|
|
it("exposes attachment through the normal API with company access checks", async () => {
|
|
const f = await fixture();
|
|
const app = express();
|
|
app.use(express.json());
|
|
app.use((req, _res, next) => { req.actor = { type: "board", source: "local_implicit", isInstanceAdmin: true }; next(); });
|
|
app.use("/api", projectRoutes(db));
|
|
app.use(errorHandler);
|
|
const url = `/api/projects/${f.input.projectId}`;
|
|
expect((await request(app).get(url)).body.workspaceProvider).toMatchObject({ source: "project", pluginId: f.pluginId });
|
|
const patch = await request(app).patch(url).send({ executionWorkspacePolicy: { enabled: true, storageProviderPluginId: null } });
|
|
expect(patch.status).toBe(409);
|
|
const kept = await request(app).patch(url).send({ executionWorkspacePolicy: { enabled: true } });
|
|
expect(kept.status).toBe(200);
|
|
expect(kept.body.executionWorkspacePolicy).toMatchObject({ storageProviderPluginId: f.pluginId });
|
|
const denied = express();
|
|
denied.use((req, _res, next) => { req.actor = { type: "agent", agentId: f.input.agentId, companyId: "00000000-0000-4000-8000-000000000099" }; next(); });
|
|
denied.use("/api", projectRoutes(db)); denied.use(errorHandler);
|
|
expect((await request(denied).get(url)).status).toBe(404);
|
|
});
|
|
});
|