Skip to main content

runner_manager_platform/
lib.rs

1// owner: d1-platform-core
2//
3// d1 owns `os`, `paths`, `lock`, `process`, `logging` and this crate root;
4// d2 owns `secrets`; d3 owns `service`.
5
6//! Host primitives every other crate in `runner-manager` assumes exist.
7//!
8//! This crate is the whole of the surface where *"works on my machine"* becomes
9//! *"works on Windows, macOS, and Linux"*. Everything above it — the domain, the
10//! GitHub gateway, the agent, the CLI and the TUI — is written once and is
11//! platform-blind; the three-way differences live here and nowhere else.
12//!
13//! | Module | Primitive | Whose Definition of Done depends on it |
14//! |---|---|---|
15//! | [`os`] | Host OS/architecture, and their standing in GitHub's documented support matrix | `f2` warns on ARM64 and reports the Linux-only container limitation |
16//! | [`paths`] | The `config/`, `state/`, `runtime/`, `logs/` directories, in platform-standard locations | everything that touches disk |
17//! | [`runner_root`] | Where runner workspaces go: the short `%SystemDrive%` default, and the local/writable/non-overlapping check every configured root passes | `b2`'s default-root ACL, `c1`'s ephemeral launch, `d1`'s mutations |
18//! | [`runner_root_access`] | Creating the default runner root, and the protected DACL that keeps unrelated local users out of it | `b2`'s Windows acceptance test, `f1`'s security gate |
19//! | [`lock`] | The single-instance lock and the runtime allocation lock | `e1`'s allocation, `e3`'s restart recovery |
20//! | [`process`] | Spawn, observe, terminate; a process identity a recycled PID cannot forge; the restrictive JIT handoff | `e3` adopts a live process without starting a duplicate |
21//! | [`logging`] | Structured allowlist logging with unconditional redaction | `07-security.md`'s secret-injection log scan |
22//! | [`secrets`] | Machine-scoped secret store (`d2`) | |
23//! | [`service`] | Service and daemon installers (`d3`) | |
24//! | [`wsl`] | Managing a named WSL2 distribution as a second host on a Windows workstation (`a1-wsl-platform-adapter`) | the managed-WSL-host feature's whole platform half |
25//!
26//! # Three properties worth knowing before reading any of it
27//!
28//! **A PID is not an identity.** [`process::ProcessIdentity`] pairs a PID with
29//! a platform-defined start token, because the attempt journal outlives a
30//! reboot and PIDs are reused. Adopting a stranger — or terminating one — is
31//! the failure mode that primitive exists to prevent.
32//!
33//! **A lock is an operating-system file lock, not a PID file.** The requirement
34//! is *"released on crash rather than leaking"*, and only the kernel can
35//! deliver that for a process that was killed or whose machine lost power.
36//!
37//! **Redaction is allowlist-first and unconditional.** A field this crate has
38//! not been told about is redacted, so a field added by a later task cannot
39//! leak by default.
40//!
41//! # Platform coverage is a CI property, not a local one
42//!
43//! Each of these modules has a Windows path, a macOS path, and a Linux path,
44//! and a developer's machine exercises exactly one of them. The contract tests
45//! are written to run natively on all three legs of the CI matrix rather than
46//! to be cross-compiled and assumed; where a test can only assert something on
47//! one family — a Unix mode bit, a Windows DACL — it asserts the *property*
48//! ("no other local user can read this") through a platform-specific check
49//! behind one cross-platform name.
50
51pub mod lock;
52pub mod logging;
53pub mod os;
54pub mod paths;
55pub mod process;
56pub mod runner_root;
57pub mod runner_root_access;
58pub mod secrets;
59pub mod service;
60pub mod wsl;