Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(workflow-recipes): pin SDK pod and Secret deletes while the legacy policy delete is pending

Alfredo Lopez1d5e262f77a6
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 5a5e38a79..b636a711c 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.457",
+ "version": "0.1.458",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.457",
+ "version": "0.1.458",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@aws-sdk/client-s3": "^3.1009.0",
diff --git a/workflow-recipes/package.json b/workflow-recipes/package.json
index 7bc8f72a2..cb0e3b3a0 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.457",
+ "version": "0.1.458",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/workflow/workflowReconciler.test.ts b/workflow-recipes/src/workflow/workflowReconciler.test.ts
index 6ceb2de09..09577c19a 100644
--- a/workflow-recipes/src/workflow/workflowReconciler.test.ts
+++ b/workflow-recipes/src/workflow/workflowReconciler.test.ts
@@ -2205,6 +2205,61 @@ describe('WorkflowReconciler — Plugin Workload SDK eager mcp-host', () => {
}
})
+ // A-1: a pending legacy mcp-servers internet DELETE must not hold the SDK
+ // host pod and token Secrets in place. The legacy policy is unrelated to the
+ // SDK credentials, so the pod and Secret deletes run on every pass while the
+ // cleanup still fails closed with the legacy-pending error.
+ it('A-1: deletes the SDK host pod and token Secrets while the legacy policy DELETE is pending', async () => {
+ vi.useFakeTimers({ toFake: ['Date'] })
+ mockNetworkingApi.deleteNamespacedNetworkPolicy.mockImplementation(
+ async ({ name }: { name: string }) => {
+ if (name === 'sdk-only-mcp-servers-egress-internet') {
+ throw { code: 403, message: 'forbidden' }
+ }
+ return {}
+ }
+ )
+ const reconciler = new WorkflowReconciler(makeDeps())
+ const policyDeletes = (name: string) =>
+ mockNetworkingApi.deleteNamespacedNetworkPolicy.mock.calls.filter(
+ ([arg]) => arg.name === name
+ )
+
+ try {
+ const first = await reconciler
+ .cleanupPluginWorkloadSdk('sdk-only', { recipeUid: 'uid-sdk-only' })
+ .catch(error => error)
+ const second = await reconciler
+ .cleanupPluginWorkloadSdk('sdk-only', { recipeUid: 'uid-sdk-only' })
+ .catch(error => error)
+
+ expect(first).toBeInstanceOf(LegacyNetworkPolicyDeletePendingError)
+ expect(second).toBeInstanceOf(LegacyNetworkPolicyDeletePendingError)
+ // Liveness witness: both passes ran the SDK network-policy teardown.
+ expect(policyDeletes('sdk-only-workload-to-mcp-host-sdk-ingress')).toHaveLength(2)
+ // The first pass attempted the legacy DELETE; the second is inside the
+ // backoff window and sends no request.
+ expect(policyDeletes('sdk-only-mcp-servers-egress-internet')).toHaveLength(1)
+ expect(mockCoreApi.deleteNamespacedPod).toHaveBeenCalledTimes(2)
+ expect(mockCoreApi.deleteNamespacedPod).toHaveBeenCalledWith({
+ name: 'sdk-only-mcp-host',
+ namespace: sandboxNamespace,
+ propagationPolicy: 'Background',
+ })
+ expect(mockCoreApi.deleteNamespacedSecret).toHaveBeenCalledTimes(4)
+ expect(mockCoreApi.deleteNamespacedSecret).toHaveBeenCalledWith({
+ name: 'wf-sdk-only-plugin-workload-sdk-token',
+ namespace: sandboxNamespace,
+ })
+ expect(mockCoreApi.deleteNamespacedSecret).toHaveBeenCalledWith({
+ name: 'wf-sdk-only-mcp-host-runtime-tokens',
+ namespace: sandboxNamespace,
+ })
+ } finally {
+ vi.useRealTimers()
+ }
+ })
+
it('R4-L3: keeps the legacy internet policy in a hybrid teardown, which preserves the workflow runtime', async () => {
const reconciler = new WorkflowReconciler(makeDeps())