Skip to main content

Module bootstrap

Module bootstrap 

Source
Expand description

Server bootstrap sequence, extracted from main().

Each function here corresponds to one (or a small cluster of) the numbered phases that used to live inline in async fn main(): crash-monitor branch -> parent-process watchdog -> logging init -> PATH enrichment -> CLI/config parsing -> data-dir + migration setup -> DB/store opening -> event bus + subagent watcher + background task spawns -> TCP listener binds -> router/AppState build -> ESTART stderr emission -> stdin-watch thread -> SIGINT/SIGTERM handler.

This module is purely a relocation of that logic into named functions; main() calls them in the same order with the same effect.

Re-exportsΒ§

pub use watchers::*;
pub use logging::*;
pub use stores::*;
pub use background::*;
pub use network::*;
pub use plumbing::*;
pub use shutdown::*;
pub use delivery::*;

ModulesΒ§

background πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
delivery πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
logging πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
network πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
plumbing πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
shutdown πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
stores πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).
watchers πŸ”’
Split out of the single-file bootstrap module unchanged (SPEC_LARGE_FILE_MODULE_ANALYSIS_2026_09_30.md Β§4.3).

MacrosΒ§

eprintln_lossy πŸ”’
eprintln! that can’t panic. srv’s stderr is a pipe the launcher reads, so once the launcher is gone a write fails with EPIPE (Rust ignores SIGPIPE), and eprintln! panics on a failed write. On the paths that must run when the launcher has died, the parent and stdin watchers, that panic killed the watcher thread before it could shut srv down, which left srv running with no launcher, holding srv.lock, so the app could not be opened again.