pub fn init_all(stage: InitStage) -> Result<(), ComponentInitError>Expand description
Initialize all components registered for stage in dependency order.
§Algorithm (Kahn’s topological sort)
- Collect every
ComponentEntryin.component_entriesthat matches the requested stage. - Build a directed graph from
depends_onedges (A→B: A must run first). - Topological sort with
priorityas the tiebreaker when multiple components become ready at the same time (lower number = earlier). - Execute each initializer in the computed order.
Cross-stage dependencies (names not found in the current stage) are warned about and skipped — they are assumed to have already run in a prior stage.
Detected cycles are logged as errors; cyclic components are appended in priority order after the acyclic ones (best-effort fallback).