Skip to main content

Module config

Module config 

Source
Expand description

bootroom.toml schema + load-time validation.

This module is the single source of truth for the Phase-3 config surface (Pitfall #5: schema drift). Every downstream consumer — /api/config, bootroom check, the live-reload watcher, and the Phase-4 scenario engine — projects from these types.

Pure: no I/O, no async, no panic on operator input. All errors surface through LoadError with optional 1-based line/col span coordinates suitable for UI underlining.

See .planning/phases/03-config-buttons-watcher/03-CONTEXT.md decision D-01 for the canonical schema shape.

§Phase 4 extensions: load-time assertion validation

Two checks run at LoadedConfig::from_config time, after the existing scenario cross-validation loop:

  1. Assertions with kind = "regex" have their pattern compiled by the Rust regex crate. The supported regex feature subset is the intersection of Rust regex and ECMAScript RegExp: no backreferences, no lookaround. Rust is the stricter engine — anything Rust accepts here will compile as a JS RegExp in the browser scenario engine. See 04-RESEARCH Pitfall #1 for the feature-intersection table.

  2. Every assertion’s after value must resolve to either the literal "any" (universal-buffer evaluation, Pitfall #5) OR a label that appears in THIS scenario’s actions Vec. A typo like after = "rebot" when actions = ["reboot"] would silently never-match in the browser engine; rejecting at load surfaces the typo in bootroom check instead.

Structs§

Action
Assertion
CliAction
An ad-hoc Action introduced via --action label=<bytes> on the CLI.
Config
Root bootroom.toml document.
LoadError
Failure raised while parsing or validating a bootroom.toml.
LoadedConfig
A fully-validated bootroom.toml ready for projection to /api/config, bootroom check, the watcher, or the Phase-4 scenario engine.
ResolvedAction
One Action after byte-escape decoding and CLI-override merging.
Scenario

Enums§

AssertionKind

Functions§

offset_to_line_col
Convert a 0-based byte offset within input into a 1-based (line, col) pair suitable for vim/code editor jump-to-line.
parse_str
Parse a bootroom.toml string into the raw Config AST.