Skip to content

symfonic.kernel.contracts.plan

plan

InvocationPlan — everything one invocation may do, decided once (IPL).

The plan is the answer to "what composes behavior here?". Not inheritance, not a flag matrix, not a constructor with thirty keyword arguments: a frozen value compiled before dispatch and read by everything downstream.

InvocationPlan dataclass

InvocationPlan(identity: PlanIdentity, scope: RequestScope, model: ModelResolution, tool_manifest: ToolManifest, stage_program: StageProgram, bindings: ServiceBindings, effect_grants: frozenset[str], limits: PlanLimits, event_program: EventProgram, diagnostics: PlanDiagnostics)

The ten frozen field groups of INV-ADR §2.

Deep-immutable over G1–G5 and G7–G10; G6 holds live port objects whose set and identity are frozen while their internals are not (IPL-4).

allows_tool

allows_tool(name: str) -> bool

Whether name is on the single manifest (G4). Never recomputed.

Source code in src/symfonic/kernel/contracts/plan.py
def allows_tool(self, name: str) -> bool:
    """Whether ``name`` is on the single manifest (G4). Never recomputed."""
    return name in self.tool_manifest.names()

equality_key

equality_key() -> tuple[Any, ...]

The reproducibility key: everything but G1's ids and G6's objects.

Two compilations of the same normalized config with the same registered capabilities must agree on this tuple. plan_id and compiled_at are excluded because they are per-compilation by construction, and the bindings because object identity is not a property of a configuration.

Source code in src/symfonic/kernel/contracts/plan.py
def equality_key(self) -> tuple[Any, ...]:
    """The reproducibility key: everything but G1's ids and G6's objects.

    Two compilations of the same normalized config with the same registered
    capabilities must agree on this tuple. ``plan_id`` and ``compiled_at``
    are excluded because they are per-compilation by construction, and the
    bindings because object identity is not a property of a configuration.
    """
    return (
        self.identity.config_digest,
        self.identity.schema_version,
        self.scope,
        self.model,
        self.tool_manifest,
        self.stage_program,
        self.effect_grants,
        self.limits,
        self.event_program,
        self.diagnostics,
    )

grants

grants(effect: str) -> bool

Whether this invocation may exercise effect (STG-8, fail-closed).

Source code in src/symfonic/kernel/contracts/plan.py
def grants(self, effect: str) -> bool:
    """Whether this invocation may exercise ``effect`` (STG-8, fail-closed)."""
    return effect in self.effect_grants