fix: centralize environment delete active statuses

Share the active custom image setup status list between the environment service and delete route so the route guard cannot drift from the blast-radius query. Keep the route test mock aligned with the new service export.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Harold KimandPaperclip committed 2026-07-09 09:22:35 +00:00
1 parent 750ad9dcc6
commit a562d5403e
3 files changed
+7 -3

No files matched your search

@@ -100,6 +100,7 @@ vi.mock("../services/secrets.js", () => ({
}));
vi.mock("../services/environments.js", () => ({
ACTIVE_CUSTOM_IMAGE_SETUP_STATUSES: ["starting", "waiting_for_user", "capturing"],
environmentService: () => mockEnvironmentService,
}));
+5 -2
View File
@@ -44,11 +44,14 @@ import { listReadyPluginEnvironmentDrivers } from "../services/plugin-environmen
import { getConfiguredSecretProvider } from "../secrets/configured-provider.js";
import { assertBoardOrgAccess, getActorInfo } from "./authz.js";
import type { PluginWorkerManager } from "../services/plugin-worker-manager.js";
import { environmentService } from "../services/environments.js";
import {
ACTIVE_CUSTOM_IMAGE_SETUP_STATUSES,
environmentService,
} from "../services/environments.js";
import { environmentRuntimeService } from "../services/environment-runtime.js";
const ACTIVE_CUSTOM_IMAGE_SETUP_STATUSES_FOR_DELETE: ReadonlySet<string> =
new Set(["starting", "waiting_for_user", "capturing"]);
new Set(ACTIVE_CUSTOM_IMAGE_SETUP_STATUSES);
export function environmentRoutes(
db: Db,
+1 -1
View File
@@ -44,7 +44,7 @@ const DEFAULT_KUBERNETES_ENVIRONMENT_DESCRIPTION =
const KUBERNETES_PROVIDER_KEY = "kubernetes";
/** Metadata marker for the company's managed-by-config Kubernetes sandbox environment. */
const KUBERNETES_MANAGED_MARKER = "managedKubernetesSandbox";
const ACTIVE_CUSTOM_IMAGE_SETUP_STATUSES = ["starting", "waiting_for_user", "capturing"] as const;
export const ACTIVE_CUSTOM_IMAGE_SETUP_STATUSES = ["starting", "waiting_for_user", "capturing"] as const;
/**
* Configuration accepted by `ensureKubernetesEnvironment`. Mirrors the keys of