%%%------------------------------------------------------------------- %%% @doc Sanhedrin top-level supervisor. %%% %%% Architecture §3.2 supervision tree: %%% sanhedrin_sup (top supervisor) %%% ├── clerk (gen_server — vote collection, opinion storage) %%% ├── escalation (gen_server — routes cases to appropriate panel size) %%% └── halt_monitor (gen_server — monitors for 3 cardinal sin conditions) %%% %%% Panel supervisors are started dynamically by escalation %%% via panel_sup:start_panel/2. %%% @end %%%------------------------------------------------------------------- -module(sanhedrin_sup). -behaviour(supervisor). -export([start_link/0]). -export([init/1]). -define(SERVER, ?MODULE). start_link() -> supervisor:start_link({local, ?SERVER}, ?MODULE, []). init([]) -> SupFlags = #{ strategy => one_for_one, intensity => 5, period => 60 }, ChildSpecs = [ %% Clerk — vote collection and opinion storage #{ id => clerk, start => {clerk, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [clerk] }, %% Escalation — complexity assessment and case routing #{ id => escalation, start => {escalation, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [escalation] }, %% Halt monitor — 3 cardinal sin conditions #{ id => halt_monitor, start => {halt_monitor, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [halt_monitor] }, %% Panel supervisor — dynamic, starts panels on demand #{ id => panel_sup, start => {panel_sup, start_link, []}, restart => permanent, shutdown => infinity, type => supervisor, modules => [panel_sup] } ], {ok, {SupFlags, ChildSpecs}}.