Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(workflow-recipes): read the marker facts from the reason alone (R4-L5)
Alfredo Lopez69c047fca9ea
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.jsonindex 32bf2efa6..c59904993 100644--- a/workflow-recipes/package-lock.json+++ b/workflow-recipes/package-lock.json@@ -1,12 +1,12 @@{"name": "workload-recipes-controller",- "version": "0.1.436",+ "version": "0.1.437","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "workload-recipes-controller",- "version": "0.1.436",+ "version": "0.1.437","license": "SEE LICENSE IN LICENSE","dependencies": {"@aws-sdk/client-s3": "^3.1009.0",diff --git a/workflow-recipes/package.json b/workflow-recipes/package.jsonindex e5d71c39f..1aedf9965 100644--- a/workflow-recipes/package.json+++ b/workflow-recipes/package.json@@ -1,6 +1,6 @@{"name": "workload-recipes-controller",- "version": "0.1.436",+ "version": "0.1.437","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.tsindex 6c445fea8..315f82bd3 100644--- a/workflow-recipes/src/reconciler/reconciler.test.ts+++ b/workflow-recipes/src/reconciler/reconciler.test.ts@@ -21,6 +21,7 @@ import type { WorkflowNetworkPolicyApplySummary } from '../workflow/pluginWorkloimport { deriveWorkflowRuntimePlan } from '../workflow/runtimePlan'import {WorkflowReconciler,+ buildNetworkPolicyConvergedCondition,translateNetworkPolicyApplySummary,} from '../workflow/workflowReconciler'import { captureLogger, captureLoggerLevels } from './__tests__/captureLogger'@@ -9982,12 +9983,16 @@ describe('WorkflowRecipeReconciler', () => {})// A marker naming both facts: the retry still owes an apply, and a- // reconcile() prune still owes a DELETE.- const retryAndPruneMarker = {- ...retryMarker,- message:- 'One or more run-lane NetworkPolicies are pending a retry (terminating or contended), and one or more the spec no longer wants are pending a delete',- }+ // reconcile() prune still owes a DELETE. Built by the production builder,+ // so the fixture cannot drift from what a pass publishes.+ const retryAndPruneMarker = buildNetworkPolicyConvergedCondition(+ { applyPending: true, prunePending: true },+ retryMarker.lastTransitionTime+ )!++ it('R4-L5: the marker naming both facts carries its own reason', () => {+ expect(retryAndPruneMarker.reason).toBe('RetryAndPrunePending')+ })it('reapplies from the active short-circuit for a marker that names both facts, and keeps the prune fact', async () => {const retry = vi.fn().mockResolvedValue({ conflicts: [], retryPending: false })diff --git a/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts b/workflow-recipes/tests/unit/workflow/workflowReconciler.test.tsindex f08d8dc5f..6a07da654 100644--- a/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts+++ b/workflow-recipes/tests/unit/workflow/workflowReconciler.test.ts@@ -38,8 +38,10 @@ import {type WorkflowRecipeSpec,WorkflowReconciler,type WorkflowReconcilerDeps,+ buildNetworkPolicyConvergedCondition,buildNetworkPolicyOwnershipConditions,networkPolicyConditionsChanged,+ networkPolicyMarkerFacts,translateNetworkPolicyApplySummary,} from '../../../src/workflow/workflowReconciler'import { asApiserverNetworkPolicy } from './asApiserverNetworkPolicy'@@ -9205,7 +9207,7 @@ describe('translateNetworkPolicyApplySummary', () => {).toStrictEqual({ networkPolicyOwnershipConditions: [] })})- it('reports a pending retry and a carried prune in one RetryPending marker', () => {+ it('reports a pending retry and a carried prune in one RetryAndPrunePending marker', () => {const result = translateNetworkPolicyApplySummary({ conflicts: [], retryPending: true },[publishedPruneMarker],@@ -9217,7 +9219,7 @@ describe('translateNetworkPolicyApplySummary', () => {{type: 'WorkflowNetworkPoliciesConverged',status: 'False',- reason: 'RetryPending',+ reason: 'RetryAndPrunePending',message:'One or more run-lane NetworkPolicies are pending a retry (terminating or contended), and one or more the spec no longer wants are pending a delete',lastTransitionTime: earlier,@@ -9229,6 +9231,44 @@ describe('translateNetworkPolicyApplySummary', () => {})})+// R4-L5: each combination of facts has its own reason, and the facts are read+// back from the reason alone. A reworded message must not change what a+// published marker means.+describe('networkPolicyMarkerFacts', () => {+ const now = '2026-09-23T12:00:00.000Z'+ const combinations = [+ { applyPending: true, prunePending: false },+ { applyPending: false, prunePending: true },+ { applyPending: true, prunePending: true },+ ]++ it('R4-L5: a pending apply and a pending prune publish their own reason', () => {+ const marker = buildNetworkPolicyConvergedCondition(+ { applyPending: true, prunePending: true },+ now+ )+ expect(marker?.reason).toBe('RetryAndPrunePending')+ })++ it.each(combinations)(+ 'R4-L5: reads %o back from the reason alone, whatever the message says',+ facts => {+ const marker = buildNetworkPolicyConvergedCondition(facts, now)+ // Liveness witness: the builder published a marker for these facts.+ expect(marker).toMatchObject({ type: 'WorkflowNetworkPoliciesConverged', status: 'False' })+ expect(networkPolicyMarkerFacts([marker!])).toStrictEqual(facts)+ expect(networkPolicyMarkerFacts([{ ...marker!, message: 'reworded' }])).toStrictEqual(facts)+ }+ )++ it('R4-L5: the three reasons are distinct', () => {+ const reasons = combinations.map(+ facts => buildNetworkPolicyConvergedCondition(facts, now)?.reason+ )+ expect(new Set(reasons).size).toBe(3)+ })+})+describe('networkPolicyConditionsChanged', () => {const conflict = {type: 'WorkflowNetworkPolicyOwnership',