Skip to main content

build_sop_engine

Function build_sop_engine 

pub fn build_sop_engine(
    config: SopConfig,
    data_dir: &Path,
    install_root: &Path,
    audit_memory: Arc<dyn Memory>,
    adapters: SopEngineAdapters,
) -> (Arc<Mutex<SopEngine>>, Arc<SopAuditLogger>)
Expand description

Build a single shared SopEngine + SopAuditLogger pair. This is the sole construction site for SOP state within a daemon. Callers receive Arc<Mutex<SopEngine>> and Arc<SopAuditLogger> handles — never call SopEngine::new or SopAuditLogger::new directly outside this module.

The two directory arguments serve different roles and must not be conflated:

  • data_dir is the daemon state dir. It anchors the durable run store, which lands at <data_dir>/sop/runs.db unless [sop] run_state_dir overrides it.
  • install_root is the install root (config.install_root_dir(), i.e. config_path’s parent). It anchors SOP-definition loading, so a relative [sop] sops_dir (documented shared/sops) resolves to <install>/shared/sops — the same directory the web/RPC SOP author writes to. Passing data_dir for both (the historical bug) made the engine load definitions from <data_dir>/sops, which authored SOPs never populate, so every manual trigger reported “no matching manual trigger”.