degenbot_workers/lib.rs
1//! The role-switching worker fleet core .
2//!
3//! One generalized, bounded worker fleet whose workers **switch roles** —
4//! hosting every execution resource the bot needs — replacing the per-era
5//! pile of independently-sized parallelism mechanisms. This crate is the
6//! F1+F2 migration steps plus the posture skeleton:
7//!
8//! - [`role`] — the sized `WorkerRole` enum (`ALL_ROLES`), its cordon classes
9//! and pin classes (ADR-042 §3.1, design doc §3.1).
10//! - [`slot`] — worker-slot states and the T1–T9 legal-transition table;
11//! every off-table move is a loud, typed rejection (design doc §3.2–3.3).
12//! - [`budget`] — `FleetBudget`, the single budget authority bounding the
13//! SUM of every consumer's declared peak share against the cgroup quota
14//! (design doc §5), with floor-allocation of the fractional quota.
15//! - [`quota`] — the fleet-local fractional (pre-ceil) cgroup-quota
16//! detector: `floor`-allocation's input `Q` (see `budget`).
17//! - [`posture`] — the `Nominal ⇄ Cordoned` posture FSM consuming
18//! `cpu_budget::cgroup_throttle_delta` deltas; typed, tunable thresholds
19//! (sign-off amendment 2026-09-09) (design doc §6).
20//! - [`dispatcher`] — per-role bounded queues, sim-before-solve lease
21//! precedence, and the slot host that grants leases only along the
22//! T-table (design doc §3–§4). No production callers yet: the
23//! conformance harness (`NoopStubFleetHost` mirror) is the consumer.
24//! - [`gauges`] — per-role busy/idle gauge surface for the activation
25//! dashboard (the `instruments.rs` mirror seam), plus worker-census
26//! self-registration of fleet slots (design doc §7).
27//!
28//! Engine-agnostic by construction: it depends on `degenbot-core`
29//! (`cpu_budget` + `worker_census`) and `degenbot-config` ONLY. The engine
30//! plugs roles in as closures/tasks in later migration steps (F3–F5);
31//! there is deliberately no pyo3 dependency — simulation never round-trips
32//! Python and the FFI is crossed only for runtime/startup concerns
33//! (design doc §8).
34
35pub mod budget;
36pub mod dispatcher;
37pub mod gauges;
38pub mod lane;
39pub mod plan;
40pub mod posture;
41pub mod quota;
42pub mod role;
43pub mod slot;