Skip to content

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

TypeScript

fix(wrc): stop announcing an ownership veto as a read failure

Alfredo Lopez80218fc4128e
diff --git a/docs/deploy/workflow-recipes-guide.md b/docs/deploy/workflow-recipes-guide.md
index 0e6a3e717..dca6e5897 100644
--- a/docs/deploy/workflow-recipes-guide.md
+++ b/docs/deploy/workflow-recipes-guide.md
@@ -337,8 +337,11 @@ and a downstream HCC NetworkPolicy no-op write storm).
- **For a NetworkPolicy it is not visible by any path.** There is no replica health to
degrade: the recipe stays `active` while the enforcement object diverges from the
desired one, and nothing sweeps for it — `pruneStaleInternalDependencyPolicies`
- compares names, not content, and `deploy/scripts/verify-networkpolicies.sh` only checks
- that the overlay's policies exist. An edit that preserves the `clerum.io/spec-hash`
+ compares names, not content, and `deploy/scripts/verify-networkpolicies.sh` **does**
+ detect content drift but only over policies an overlay renders. Recipe-derived
+ policies (`ui-ingress-*`, `wl-ingress-*`, `wr-intdep-*`, the gateway trio) are authored
+ by the reconciler and live in no overlay, so the script never evaluates them at all —
+ neither their existence nor their content. An edit that preserves the `clerum.io/spec-hash`
annotation while changing the `spec` (widening `ingress`/`egress`, emptying
`podSelector`, dropping a `policyTypes` entry) is **permanent and silent**. Treat any
`kubectl edit` on a `ui-ingress-*`, `wl-ingress-*`, `wr-intdep-*` or gateway policy as
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.json
index 8549a3f01..50a6bcac6 100644
--- a/workflow-recipes/package-lock.json
+++ b/workflow-recipes/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.341",
+ "version": "0.1.342",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "workload-recipes-controller",
- "version": "0.1.341",
+ "version": "0.1.342",
"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 0e09abecd..03ba8569f 100644
--- a/workflow-recipes/package.json
+++ b/workflow-recipes/package.json
@@ -1,6 +1,6 @@
{
"name": "workload-recipes-controller",
- "version": "0.1.341",
+ "version": "0.1.342",
"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 83ca946a9..cefa28266 100644
--- a/workflow-recipes/src/reconciler/reconciler.test.ts
+++ b/workflow-recipes/src/reconciler/reconciler.test.ts
@@ -922,6 +922,7 @@ describe('WorkflowRecipeReconciler', () => {
},
})
+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
const rejection = await apply(desired).then(
() => {
throw new Error('expected the ownership assertion to reject')
@@ -943,6 +944,19 @@ describe('WorkflowRecipeReconciler', () => {
// in the replace path: there, a matching hash would make the gate skip and
// this call would resolve instead of rejecting.
expect(mockNetworkingApi.readNamespacedNetworkPolicy).toHaveBeenCalledTimes(2)
+
+ // Review of #580, R1-L1. A veto is not a read failure, and `applyIsNoop`
+ // must not announce it as one: the read SUCCEEDED and the caller's
+ // assertion on the result is what threw. The accurate message arrives a
+ // moment later from `replaceFn`, so a "pre-read failed" line here would only
+ // precede the truth with a wrong diagnosis.
+ //
+ // Scoped to that one line rather than asserting console.warn was never
+ // called: other warnings on this path are legitimate, and a blanket
+ // assertion would break on any of them for reasons unrelated to the veto.
+ const warned = warnSpy.mock.calls.flat().join(' ')
+ expect(warned).not.toContain('idempotency pre-read failed')
+ warnSpy.mockRestore()
})
it('T4b lets an internal-dependency policy WRC already owns through the gate', async () => {
diff --git a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
index dbb541400..0bc37f1cf 100644
--- a/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
+++ b/workflow-recipes/src/reconciler/workflowRecipeReconciler.ts
@@ -3772,16 +3772,25 @@ export class WorkflowRecipeReconciler {
const existing = await idempotency.readExisting()
return specHashUnchanged(idempotency.manifest, existing ?? null)
} catch (error) {
- // Falling through to the replace is correct — never skip an update we cannot
- // prove unnecessary — but discarding the error left no trace of WHY: revoked
- // RBAC or a persistently failing apiserver looked exactly like a healthy
- // cache miss, and the gate silently stopped saving anything. The write still
- // happens, so this is a diagnostic line, not a failure path; a genuine veto
- // reaches the caller through `replaceFn`, loud.
- console.warn(
- `[WR-Reconciler] ${label}: idempotency pre-read failed, falling through to update:`,
- error
- )
+ // An ownership veto is NOT a read failure, and saying so here would be
+ // actively misleading: the read succeeded, and what threw was the caller's
+ // assertion on what it read. Stay quiet — `replaceFn` re-reads, re-asserts
+ // and raises the conflict with its own message a moment later, so the
+ // accurate line follows immediately and this one would only precede it with
+ // a wrong diagnosis. Nothing is swallowed; the veto still reaches the
+ // caller, loud (T4).
+ if (!(error instanceof NetworkPolicyOwnershipConflictError)) {
+ // Everything else IS a read failure. Falling through to the replace is
+ // correct — never skip an update we cannot prove unnecessary — but
+ // discarding the error left no trace of WHY: revoked RBAC or a
+ // persistently failing apiserver looked exactly like a healthy cache
+ // miss, and the gate silently stopped saving anything. The write still
+ // happens, so this is a diagnostic line, not a failure path.
+ console.warn(
+ `[WR-Reconciler] ${label}: idempotency pre-read failed, falling through to update:`,
+ error
+ )
+ }
return false
}
}