Address Greptile review: fix exclude path and drop dup mocks

- scripts/run-vitest-stable.mjs: use repo-root-relative paths for --exclude
  (vitest CWD is repoRoot, so server/-relative paths never matched and the
  route suites ran both in the excluded parallel phase and again serially)
- workspace-runtime-routes-authz.test.ts: drop redundant vi.doMock layer
  that duplicated the top-level vi.mock factories for the same modules

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-04-24 15:02:31 -05:00
1 parent c468ef39a2
commit 91ded61b3b
2 files changed
+2 -39

No files matched your search

@@ -56,37 +56,9 @@ vi.mock("../routes/workspace-runtime-service-authz.js", () => ({
assertCanManageExecutionWorkspaceRuntimeServices: mockAssertCanManageExecutionWorkspaceRuntimeServices,
}));
function registerWorkspaceRouteMocks() {
vi.doMock("../telemetry.js", () => ({
getTelemetryClient: mockGetTelemetryClient,
}));
vi.doMock("../services/index.js", () => ({
environmentService: () => mockEnvironmentService,
executionWorkspaceService: () => mockExecutionWorkspaceService,
logActivity: mockLogActivity,
projectService: () => mockProjectService,
secretService: () => mockSecretService,
workspaceOperationService: () => mockWorkspaceOperationService,
}));
vi.doMock("../services/workspace-runtime.js", () => ({
cleanupExecutionWorkspaceArtifacts: vi.fn(),
startRuntimeServicesForWorkspaceControl: vi.fn(),
stopRuntimeServicesForExecutionWorkspace: vi.fn(),
stopRuntimeServicesForProjectWorkspace: vi.fn(),
}));
vi.doMock("../routes/workspace-runtime-service-authz.js", () => ({
assertCanManageProjectWorkspaceRuntimeServices: mockAssertCanManageProjectWorkspaceRuntimeServices,
assertCanManageExecutionWorkspaceRuntimeServices: mockAssertCanManageExecutionWorkspaceRuntimeServices,
}));
}
let appImportCounter = 0;
async function createProjectApp(actor: Record<string, unknown>) {
registerWorkspaceRouteMocks();
appImportCounter += 1;
const routeModulePath = `../routes/projects.js?workspace-runtime-routes-authz-${appImportCounter}`;
const middlewareModulePath = `../middleware/index.js?workspace-runtime-routes-authz-${appImportCounter}`;
@@ -106,7 +78,6 @@ async function createProjectApp(actor: Record<string, unknown>) {
}
async function createExecutionWorkspaceApp(actor: Record<string, unknown>) {
registerWorkspaceRouteMocks();
appImportCounter += 1;
const routeModulePath = `../routes/execution-workspaces.js?workspace-runtime-routes-authz-${appImportCounter}`;
const middlewareModulePath = `../middleware/index.js?workspace-runtime-routes-authz-${appImportCounter}`;