ADR-0091: Placement Owns Nested Invocation Locality ​
Context ​
ADR-0004 and ADR-0086 allow a pipeline definition to invoke named nested pipelines or self and to suspend on durable Await inside those calls. Earlier compiler validation tied both capabilities to root transport: LOCAL, forcing any application with nested composition or nested Await to declare LOCAL/COMPUTE even when it is packaged and deployed as a REST/FUNCTION worker under QUEUE_ASYNC coordination.
At the same time, ADR-0011 separates deployment transport (GRPC, REST, LOCAL), platform (COMPUTE, FUNCTION), runtime layout (modular, pipeline-runtime, monolith), and build topology. Inventing a new execution-segment layout or relabeling a LOCAL contract as REST/FUNCTION would blur those boundaries further.
Decision ​
Compiled physical placement — not root transport: LOCAL — owns whether a step call, nested pipeline invocation, or pipeline: self invocation executes locally within an execution segment (LOCAL_IN_SEGMENT) or crosses a deployed boundary (REMOTE_BOUNDARY).
- Truthful deployment contract: Root
platform.json,pipeline-contract.json, and generated orchestrator adapters continue to declare the configured deploymentplatformandtransport(for exampleREST/FUNCTION). Local in-segment implementation never relabels a deployment contract toLOCAL/COMPUTE. - Existing layouts only:
PipelineRuntimeMapping.Layoutremains strictly{ modular, pipeline-runtime, monolith }. Noexecution-segmentlayout, Maven profile, or runtime flag substitutes another source universe. - Explicit colocation rule:
transport: LOCALresolves all steps and nested/self invocations toLOCAL_IN_SEGMENT.- Under
RESTorGRPC, an explicitpipeline.runtime.yamladmitsLOCAL_IN_SEGMENTwhen the resolved(module, runtime)matches the compiled module and runtime underpipeline-runtime, or undermonolithwhenplatform: FUNCTION. monolithunderCOMPUTEpreserves existing loopback transport adapters.modularand unmappedREST/GRPCcompilations resolve cross-boundary invocations toREMOTE_BOUNDARY, and fail closed until remote nested pipeline invocation is implemented.
- Graph-derived placement metadata: When a pipeline contains nested/self invocations or colocated
REST/GRPCplacement,pipeline-contract.jsonemits an additive, value-onlyplacementsection (omitted when absent so existing contract fingerprints remain unchanged). Execution segments are derived from the actual reachable Await boundaries across branches and bounded recursion rather than by counting textualawait:declarations. - Release agreement: When a Release carries
deploymentfacts (ADR-0090) and the compiled contract carriesplacement, release validation enforces agreement between deployed entry modules and compiled placement modules directly. Release schema-2 deployment packaging is not a backwards-compatibility surface, so no legacy schema-2 compatibility shim is retained whenplacementis present.
Rationale ​
An application's external deployment contract (REST/FUNCTION, QUEUE_ASYNC coordination, immutable Release packaging) is distinct from whether two compiled definitions share one physical worker segment. Making placement own invocation locality lets nested composition, bounded self-call, colocated aspects, and nested Await compile cleanly as REST/FUNCTION without flattening the pipeline, bypassing validators, or inventing a fourth layout mode.
Keeping placement factual and additive inside pipeline-contract.json also avoids coupling this change to a broader multi-environment release-targeting redesign (for example targeting different platform/transport/layout combinations per environment from one definition), which remains a separate future decision.
Consequences ​
pipelineframework-contractsowns the immutablePipelinePlacementDescriptorcontract, its additive JSON inclusion inPipelineContractDescriptor, and release-descriptor cross-checking against deployed modules.pipelineframework-compilerresolves per-step and per-invocation locality after runtime mapping, validates nested composition and nested Await againstLOCAL_IN_SEGMENTplacement, generates in-segmentLocalClientStepandPipelineInvocation_*classes alongside truthful rootREST/FUNCTIONorchestrator adapters, and derives the branch-/recursion-aware segment graph.- Unmapped
REST/FUNCTIONor cross-module nested/self invocations continue to fail compilation explicitly rather than silently flattening or emitting broken remote calls. pipelineframework-runtimeexecutes compiled segments through the admitted Coordinator and transition-worker path without a separate placement-specific runtime mode.