Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(wrc): close the false-skip class with a property, not another example
Alfredo Lopezfbcd9c53a595
diff --git a/workflow-recipes/package-lock.json b/workflow-recipes/package-lock.jsonindex 01e3c4c04..8767fa8e4 100644--- a/workflow-recipes/package-lock.json+++ b/workflow-recipes/package-lock.json@@ -1,12 +1,12 @@{"name": "workload-recipes-controller",- "version": "0.1.343",+ "version": "0.1.344","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "workload-recipes-controller",- "version": "0.1.343",+ "version": "0.1.344","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 5919cba14..b43cdb1bb 100644--- a/workflow-recipes/package.json+++ b/workflow-recipes/package.json@@ -1,6 +1,6 @@{"name": "workload-recipes-controller",- "version": "0.1.343",+ "version": "0.1.344","description": "Workload Recipes Controller (WRC) - WorkloadRecipe lifecycle management and MCP server interface","main": "dist/main.js","engines": {diff --git a/workflow-recipes/src/reconciler/mcpDelegation.ts b/workflow-recipes/src/reconciler/mcpDelegation.tsindex 16e6b0e4e..3888fc2fd 100644--- a/workflow-recipes/src/reconciler/mcpDelegation.ts+++ b/workflow-recipes/src/reconciler/mcpDelegation.ts@@ -228,6 +228,28 @@ function ownerReferenceKey(ref: ContextOwnerReference): string {].join('\0')}+/**+ * Same length + set membership — the shape that, in `sameMcpServerSet`, let a+ * duplicate hide a real change: `([A,A], [A,B])` passes the length check, and+ * every member of `{A}` is in `{A,B}`. There it needed a second guard on the+ * SET sizes. Here it does not, and the reason is an invariant of the only+ * caller rather than of this function:+ *+ * `right` is always `desiredOwnerReferences(left, …)` — `left` filtered by+ * `!isThisRecipeOwner`, plus at most one appended `recipeOwner`.+ *+ * So `right` is a filtered submultiset of `left` plus one known element, and+ * filter-plus-append cannot both drop a duplicate and introduce a distinct new+ * ref at equal length: if the duplicate matches the recipe, BOTH copies are+ * filtered and the lengths differ; if it does not, both survive into `right`+ * and the multisets agree.+ *+ * A defensive size guard is deliberately NOT added, for the same reason+ * `hasExpectedPolicyOwnership` was left out of the egress fault verdict in+ * #567: an unreachable branch pretending to be a guard reads as protection that+ * is not there. The invariant is stated here instead, so a refactor that breaks+ * it has something to break (#568 review, @claude audit).+ */function sameOwnerReferences(left: readonly ContextOwnerReference[],right: readonly ContextOwnerReference[]diff --git a/workflow-recipes/src/reconciler/planContextReplacement.property.test.ts b/workflow-recipes/src/reconciler/planContextReplacement.property.test.tsindex 1dd02d8ed..c0247cfa6 100644--- a/workflow-recipes/src/reconciler/planContextReplacement.property.test.ts+++ b/workflow-recipes/src/reconciler/planContextReplacement.property.test.ts@@ -116,6 +116,38 @@ describe('planContextReplacement invariants', () => {)})+ it('no false skip: whenever the written set would differ, the plan is NOT null', () => {+ // The property the other four could not have: they all assert the+ // CONVERGENCE direction — "after applying a plan the next pass is null", so+ // no infinite writes. The `sameMcpServerSet` defect lives in the opposite+ // direction: a FALSE SKIP, where the plan is null while a real change is+ // due. Every other property bails on `plan === null`, which is exactly the+ // state that bug produces, so they passed vacuously on it. (@claude audit of+ // #568; the instance is pinned by an example test in mcpDelegation.test.ts,+ // this closes the class.)+ //+ // The oracle MUST NOT reuse `sameMcpServerSet`, or it inherits the same+ // dup-collapsing blind spot and masks the defect identically — the trap that+ // made the other four vacuous in the first place. So it is structural:+ // a duplicate in the live list, or a different unique set, means a write is+ // owed. One direction only — this says nothing about when a plan is ALLOWED+ // to be null, which is what the convergence property covers.+ const sortedUnique = (names: readonly string[]): string => [...new Set(names)].sort().join(',')++ fc.assert(+ fc.property(fc.boolean(), serverList, serverList, (explicit, existing, desired) => {+ const expected = explicit ? sortedUnique([...existing, ...desired]) : sortedUnique(desired)+ const liveHasDuplicate = existing.length !== new Set(existing).size+ const writeIsOwed = liveHasDuplicate || sortedUnique(existing) !== expected+ if (!writeIsOwed) return++ const plan = planContextReplacement(liveContext(existing), planArgs(explicit, desired))+ expect(plan).not.toBeNull()+ expect(sortedUnique(plan!.mergedServers)).toBe(expected)+ })+ )+ })+it('a non-empty legacy contextId is preserved verbatim; an empty one is repaired once', () => {fc.assert(fc.property(