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 the run-lane catalog for an empty MCP server list

Alfredo Lopez5aaa9f33ef43
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 6292a22bc..7ed9095c8 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.431",
+ "version": "0.1.432",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.431",
+ "version": "0.1.432",
"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 3e428c63d..8ce678ea1 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.431",
+ "version": "0.1.432",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts b/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts
index 9271a3071..8e846bc1e 100644
--- a/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts
+++ b/workflow-recipes/src/workflow/networkPolicyFactory.gfs.test.ts
@@ -189,4 +189,26 @@ describe('workflow GFS NetworkPolicy', () => {
expect(catalog.has('daily-report-mcp-host-to-grok-proxy')).toBe(true)
expect(catalog.has('daily-report-coordinator-to-gfs')).toBe(false)
})
+
+ it('an empty server list keeps mcp-host-to-servers prunable and no per-server ingress name', () => {
+ const serverEgress = 'daily-report-mcp-host-to-servers'
+ const perServerIngress = 'daily-report-wf-mcp-ingress-web-search'
+ const desired = new Set(
+ buildWorkflowNetworkPolicies(baseConfig, [])
+ .map(policy => policy.metadata?.name)
+ .filter((name): name is string => Boolean(name))
+ )
+ const emptyCatalog = buildRunLaneNetworkPolicyCatalog(baseConfig, [])
+ // The server egress lane is not desired but stays in the prune universe,
+ // so its leftover is deleted once the recipe lists no MCP server.
+ expect(desired.has(serverEgress)).toBe(false)
+ expect(emptyCatalog.has(serverEgress)).toBe(true)
+ // A server's ingress policy is named after the server, so the catalog
+ // cannot name one the spec no longer lists: that leftover is not pruned.
+ expect(emptyCatalog.has(perServerIngress)).toBe(false)
+ // Liveness witness: the same name is in the catalog while the server is listed.
+ expect(buildRunLaneNetworkPolicyCatalog(baseConfig, ['web-search']).has(perServerIngress)).toBe(
+ true
+ )
+ })
})
diff --git a/workflow-recipes/src/workflow/networkPolicyFactory.ts b/workflow-recipes/src/workflow/networkPolicyFactory.ts
index 91840fe9d..2c96b39fd 100644
--- a/workflow-recipes/src/workflow/networkPolicyFactory.ts
+++ b/workflow-recipes/src/workflow/networkPolicyFactory.ts
@@ -1081,6 +1081,16 @@ const RUN_LANE_CATALOG_PLACEHOLDER_SERVER = '_catalog'
* pass config alone makes catalog == desired and prune never deletes a leftover.
* Awaiting-trigger already tears down the mcp-host pod unless eager SDK; pruning
* those NPs is the same "mcp-host is not live" decision, not an accidental retire.
+ *
+ * An empty server list is replaced by the `_catalog` placeholder so
+ * `${recipe}-mcp-host-to-servers`, which the factory emits only for a
+ * non-empty list, stays in the universe and its leftover is pruned. The
+ * per-server `${recipe}-wf-mcp-ingress-<server>` names come only from the
+ * servers passed in, so the ingress policy of a server the spec no longer
+ * lists is never in the catalog; it lives in the mcp-server namespace, which
+ * the prune does not list either, and stays until the finalizer's label sweep
+ * there. The mcp-host egress side is exact: `-mcp-host-to-servers` selects
+ * only the listed servers.
*/
export function buildRunLaneNetworkPolicyCatalog(
applyConfig: NetworkPolicyConfig,