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 failedPrunePass stub to the reconcile writer (nit-3)

Alfredo Lopezf01510f4a7d2
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 029c0e5ff..78f6e0d43 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.442",
+ "version": "0.1.443",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.442",
+ "version": "0.1.443",
"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 8115445e9..549c90249 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.442",
+ "version": "0.1.443",
"description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface",
"main": "dist/main.js",
"engines": {
diff --git a/workflow-recipes/src/reconciler/reconciler.test.ts b/workflow-recipes/src/reconciler/reconciler.test.ts
index a6c585a54..a822ff9c2 100644
--- a/workflow-recipes/src/reconciler/reconciler.test.ts
+++ b/workflow-recipes/src/reconciler/reconciler.test.ts
@@ -17,12 +17,12 @@ import {
import { INHERITED_PARENT_RESOURCES_ANNOTATION } from '../workflow/childRecipeFactory'
import type { CodexExecutionProjection } from '../workflow/codexExecutionProjection'
import { buildCoordinatorGfsNetworkPolicy } from '../workflow/networkPolicyFactory'
-import type { WorkflowNetworkPolicyApplySummary } from '../workflow/pluginWorkloadSdkProvisioner'
+import type { NetworkPolicyPassSummary } from '../workflow/pluginWorkloadSdkProvisioner'
import { deriveWorkflowRuntimePlan } from '../workflow/runtimePlan'
import {
WorkflowReconciler,
buildNetworkPolicyConvergedCondition,
- translateNetworkPolicyPassSummary,
+ networkPolicyMarkerConditions,
} from '../workflow/workflowReconciler'
import { captureLogger, captureLoggerLevels } from './__tests__/captureLogger'
import { defaultFqdnLookup } from './fqdnResolver'
@@ -16506,8 +16506,10 @@ describe('WorkflowRecipeReconciler', () => {
// The WRC first-deploy pass with the real inner apply and prune. The
// leftover is live under the recipe's labels and its DELETE answers 403.
// The inner reconcile() is reduced to the NetworkPolicy step: the real
- // apply-and-prune, translated against the published conditions exactly as
- // reconcile() does.
+ // apply-and-prune, published through the production `reconcile` marker
+ // writer. The inner suite pins that reconcile() publishes exactly that
+ // writer's conditions for its own pass summary (nit-3), so this stub
+ // cannot drift from the translation it stands in for.
async function failedPrunePass(inner: WorkflowReconciler) {
mockNetworkingApi.listNamespacedNetworkPolicy.mockResolvedValue({
items: [{ metadata: { name: LEFTOVER, namespace: 'sandbox-recipes', labels: WRC_LABELS } }],
@@ -16520,9 +16522,7 @@ describe('WorkflowRecipeReconciler', () => {
)
const apply = (
inner as unknown as {
- applyWorkflowNetworkPolicies: (
- ...args: unknown[]
- ) => Promise<WorkflowNetworkPolicyApplySummary>
+ applyWorkflowNetworkPolicies: (...args: unknown[]) => Promise<NetworkPolicyPassSummary>
}
).applyWorkflowNetworkPolicies.bind(inner)
vi.spyOn(inner, 'reconcile').mockImplementation(
@@ -16546,12 +16546,14 @@ describe('WorkflowRecipeReconciler', () => {
requiresGrokProxyEgress: false,
}
)
+ // No retry flag is owed: the pass has nothing pending but the prune.
+ expect(summary.retryPending).toBe(false)
return {
phase: 'active',
message: 'Workflow running',
workflowPhase: 'running',
- ...translateNetworkPolicyPassSummary(
- summary,
+ networkPolicyOwnershipConditions: networkPolicyMarkerConditions(
+ { kind: 'reconcile', summary },
currentStatus?.conditions,
new Date().toISOString()
),
diff --git a/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts b/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts
index 218b62ac6..e1705a836 100644
--- a/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts
+++ b/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts
@@ -5424,6 +5424,49 @@ describe('WorkflowReconciler — reconcile loop', () => {
})
}
+ // nit-3: the WRC suite stubs reconcile() with the real apply and the
+ // `reconcile` marker writer; this pins that the real reconcile()
+ // publishes exactly that writer's conditions for its own summary.
+ it('nit-3: publishes exactly the reconcile marker writer conditions for its own pass summary', async () => {
+ const { apiserver, reconciler } = await convergedRunLane()
+ seedLeftover(apiserver)
+ apiserver.api.deleteNamespacedNetworkPolicy.mockRejectedValueOnce({
+ code: 403,
+ message: 'forbidden',
+ })
+ const apply = vi.spyOn(
+ reconciler as unknown as {
+ applyWorkflowNetworkPolicies: (
+ ...args: unknown[]
+ ) => Promise<NetworkPolicyPassSummary>
+ },
+ 'applyWorkflowNetworkPolicies'
+ )
+
+ const failed = await reconciler.reconcile('test-wf', 'uid-123', 'sandbox-recipes', spec())
+
+ // Liveness witness: the pass ran the run-lane apply once, and its
+ // prune could not delete the leftover.
+ expect(apply).toHaveBeenCalledTimes(1)
+ const summary = await apply.mock.results[0]!.value
+ expect(summary).toEqual({
+ conflicts: [],
+ retryPending: false,
+ prune: 'pending',
+ legacy: 'removed',
+ })
+ const published = failed.networkPolicyOwnershipConditions ?? []
+ expect(published).toHaveLength(1)
+ expect(published).toEqual(
+ networkPolicyMarkerConditions(
+ { kind: 'reconcile', summary },
+ undefined,
+ published[0]!.lastTransitionTime!
+ )
+ )
+ expect(failed.networkPolicyRetryPending).toBeUndefined()
+ })
+
it('keeps it and its PrunePending marker through the retry, and prunes it on the next reconcile()', async () => {
const { apiserver, reconciler } = await convergedRunLane()
seedLeftover(apiserver)