# Why does an instance of a federation policy engine silently permit a cross-org data share that the source organization's constraint algebra forbids? **Date of Record:** 2026 November 16 **Scope:** Applies to federation policy engines that evaluate cross-organizational data-sharing constraints over agent mesh topologies where each org publishes a local constraint algebra and the mesh composes them at request time. Does not apply to single-org policy engines, nor to systems where all constraints are flattened into a single monotone Datalog program before evaluation. ## Core Distinction The failure is not a policy conflict. A policy conflict is loud: two orgs disagree, the composition yields `DENY`, and the request fails closed. The boundary failure described here is a *composition-order* defect. When org A's constraint algebra is non-distributive over the mesh's join operator, evaluating `(A ⋈ B) ⋈ C` can yield `PERMIT` while `A ⋈ (B ⋈ C)` yields `DENY`, even though every individual org's policy is internally consistent and every pairwise check passes. The engine reports a permit because it happens to evaluate in an order that short-circuits a constraint before the constraint's guard predicate is populated. The distinction that matters operationally: a *non-monotone* constraint (one whose verdict can flip from `DENY` to `PERMIT` as more facts are added) is not a bug in the constraint — it is a legitimate revocation/override construct. The bug is that the mesh's join is assumed associative and commutative, and the engine's evaluation scheduler is free to reorder joins for latency. Reordering is safe for monotone algebras and unsafe for any algebra containing a non-monotone override. ## What Was Observed In a three-org mesh (source `research`, intermediary `analytics`, consumer `partner`), a data-sharing constraint on `research` stated: *any derived aggregate over dataset D must be denied if the requesting principal is not on the D-allowlist, unless an explicit purpose-binding override from the dataset owner is present.* The override is a non-monotone construct: its presence flips the verdict. The scheduler, optimizing for the cheapest join first, evaluated `analytics ⋈ partner` before joining `research`. The `analytics ⋈ partner` sub-result contained no allowlist facts and no override facts, so the guard predicate `principal ∈ D-allowlist` evaluated against an *open* (unknown) fact set. The engine's guard semantics treated an open guard as satisfied — a fail-open default intended for latency, documented as "assume permissive until contradicted." The override check then ran against the same open set, found no override, and was skipped because the guard had already passed. The final join with `research` added the allowlist facts, which would have denied the request, but the verdict had already been committed to the result lattice as `PERMIT` and the join operator was idempotent on committed verdicts. Net effect: a request that every org's local algebra denies was permitted. No log line indicated a conflict, because there was none — there was an *evaluation-order-dependent* bypass. ## Condition of Validity This failure requires all of the following to co-occur: 1. At least one org publishes a **non-monotone constraint** (override, exception, or revocation clause) whose guard predicate references facts owned by a *different* org. 2. The mesh join operator is treated as **associative and commutative** by the scheduler, and the scheduler is permitted to reorder joins for cost. 3. The engine's guard evaluation has a **fail-open default** for open/unknown fact sets (common when guards are evaluated before all contributing orgs have responded, to meet latency SLOs). 4. Committed verdicts are **idempotent** under later joins — i.e., once `PERMIT` is written to the result lattice, subsequent fact additions do not trigger re-evaluation. If any one of these is absent, the failure cannot occur. In particular, a fail-closed guard default (treat open as `DENY` and re-evaluate on fact arrival) eliminates the bypass even with non-monotone constraints and reordering. ## Decision Boundary The correct engineering decision is **not** to forbid non-monotone constraints — they are necessary for override and revocation semantics that regulators require. The decision boundary is: - **If** the algebra is monotone (no override/revocation constructs) **then** reorder freely; fail-open guards are safe because added facts can only tighten toward `DENY`, and a committed `PERMIT` remains valid. - **If** the algebra contains any non-monotone construct **then** the scheduler must either (a) evaluate in a *topologically fixed* order that places all fact-owning orgs before any guard that references them, or (b) evaluate guards fail-closed and mark committed verdicts as *provisional* until the full fact set for the guard's dependency closure has arrived. The boundary is the presence of a non-monotone construct whose guard references a foreign fact set. Crossing that boundary without changing the scheduler or the guard default is the defect. ## Operational Effect Detecting this in production requires instrumenting the *join order* alongside the verdict, not just the verdict. A permit that would be a deny under the canonical (source-first) order is the signature. The mitigation is a **provisional-verdict protocol**: any verdict whose guard dependency closure is not yet fully populated is emitted as `PROVISIONAL_PERMIT` and re-evaluated on fact arrival; only `FINAL_PERMIT` is honored by downstream data-plane enforcement. This trades a small latency cost (waiting for the dependency closure) for correctness on the non-monotone path, and it is the only mitigation that preserves scheduler freedom for the monotone majority of constraints. ```python from __future__ import annotations from dataclasses import dataclass, field from enum import Enum from typing import FrozenSet class FederationCompositionError(RuntimeError): """Raised when a federation verdict violates the non-monotone composition invariant.""" class Verdict(Enum): PERMIT = "permit" DENY = "deny" PROVISIONAL_PERMIT = "provisional_permit" @dataclass(frozen=True) class Constraint: org: str name: str monotone: bool # facts this constraint's guard depends on, keyed by owning org guard_dependencies: FrozenSet[str] = field(default_factory=frozenset) @dataclass class MeshState: populated_orgs: FrozenSet[str] = frozenset() committed: dict[str, Verdict] = field(default_factory=dict) def evaluate_join( state: MeshState, constraints: list[Constraint], join_order: list[str], ) -> dict[str, Verdict]: """ Evaluate constraints in the given join order. If any non-monotone constraint's guard dependency closure is not yet populated, its verdict must be PROVISIONAL, never a committed PERMIT. """ results: dict[str, Verdict] = {} for org in join_order: for c in (c for c in constraints if c.org == org): closure_ready = c.guard_dependencies.issubset(state.populated_orgs) if not c.monotone and not closure_ready: # Fail-closed for non-monotone guards: never commit PERMIT # on an open dependency closure. results[c.name] = Verdict.PROVISIONAL_PERMIT else: results[c.name] = Verdict.PERMIT return results def enforce(state: MeshState, constraints: list[Constraint], join_order: list[str]) -> None: results = evaluate_join(state, constraints, join_order) # Invariant: a non-monotone constraint must not be committed as PERMIT # while its guard dependency closure is open. This is the boundary # condition that the fail-open scheduler violated. for c in constraints: if not c.monotone: closure_ready = c.guard_dependencies.issubset(state.populated_orgs) if not closure_ready and results.get(c.name) is Verdict.PERMIT: raise FederationCompositionError( f"non-monotone constraint {c.org}/{c.name} committed PERMIT " f"with open guard closure {sorted(c.guard_dependencies - state.populated_orgs)}; " f"join order {join_order} is unsafe" ) # Reproduce the observed failure: scheduler joins analytics/partner before # research, so research's allowlist facts are absent when the guard runs. constraints = [ Constraint( org="research", name="aggregate_allowlist_guard", monotone=False, guard_dependencies=frozenset({"research", "analytics"}), ), ] bad_state = MeshState(populated_orgs=frozenset({"analytics", "partner"})) try: enforce(bad_state, constraints, join_order=["analytics", "partner", "research"]) except FederationCompositionError as e: print(f"caught: {e}") # Safe: source-first order populates research before the guard evaluates. good_state = MeshState(populated_orgs=frozenset({"research", "analytics", "partner"})) enforce(good_state, constraints, join_order=["research", "analytics", "partner"]) print("source-first order: no invariant violation") ```