Skip to main content

Module federation

Module federation 

Source
Expand description

Federation — kind = "repolith" executes a child stack’s manifest as a nested plan (orchestrator-of-orchestrators). Federation — kind = "repolith" runs a child stack’s manifest as a nested plan (orchestrator-of-orchestrators).

RepolithSync is an Action that, at execute time, parses the child manifest found inside the node’s checkout, builds a nested Orchestrator over it, and runs it to completion. The child stack keeps its own local cache — exactly what a human would get running repolith sync in that directory — so parent cache ids never collide with child ids.

§Guard rails

  • Cycle detection: every RepolithSync carries the canonicalized manifest paths of its ancestors. A child manifest already in that chain aborts with the full offending chain in the error.
  • Depth bound: MAX_FEDERATION_DEPTH levels, then a hard error.
  • Cancellation tree: the child orchestrator’s root token is a child_token() of the parent’s Ctx token — Ctrl-C at any level reaps the whole tree, subprocess groups included.
  • Global concurrency: the child draws permits from the parent’s semaphore (see Builder::shared_semaphore), so --jobs N bounds the whole tree. RepolithSync itself is a coordinator (Action::is_coordinator) and is never charged a permit.

§Wiring (dependency direction)

Turning a parsed Manifest into concrete actions requires the action implementations (repolith-actions) and a cache backend (repolith-cache) — both out of reach from this crate without inverting the dependency graph. The CLI injects them through FederationHooks; recursion happens naturally because the CLI’s factory constructs nested RepolithSync values with the same hooks.

Structs§

RepolithSync
Action that syncs a child repolith stack found in the node’s checkout.

Constants§

MAX_FEDERATION_DEPTH
Maximum number of nested federation levels. Deep enough for any sane stack-of-stacks; shallow enough that a runaway recursion fails fast with a readable chain instead of exhausting the filesystem.

Traits§

FederationHooks
Environment injected by the host (CLI) — everything RepolithSync cannot construct without inverting the crate dependency graph.