Docs

config

Source: crates/lvcs/src/config.rs.

/// The `lvcs.toml` sections the daemon reads (design §5, §10, §15). Every
/// section is a table whose missing keys keep their defaults, so an absent
/// file or section is the protocol defaults. Each section's type belongs
/// to the lane that reads it: `[coord]` to `M3.coord`
/// (`lvcs_net::coord::CoordConfig`), `[limits]` to `M3.grants`
/// (`lvcs_net::grants::Limits`), `[secrets]` to `M3.secrets`
/// (`SecretsConfig`), `[telemetry]` to the daemon, `[[actions]]`,
/// `[channels]`, and `[runner]` to `M5.validator`
/// (`lvcs_action::config::ActionEntry`, `ChannelsTable`, and
/// `RunnerTable`, decisions 161, 245, and 297, whose canonical form,
/// `lvcs_action::config::Action`, `map` gives; `[workflows]`,
/// `lvcs_action::workflow::WorkflowsTable`, for the GitHub workflows
/// mapped beside them, stage C), and `[git]` to `M5.git`
/// (`crate::git::GitConfig`, decision 124). Other tables (`[deps]`,
/// `[[navigators]]`) are ignored until their lanes add them. `lvcs.toml`
/// is a protected path (`DEFAULT_PROTECTED`), so a change to it is not
/// materialized until approved (§15, decision 122), and no participant
/// changes the `[limits]` every signer is metered by alone (decision 146).
/// Owner: the daemon lanes.
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]
#[serde(default)]
pub(crate) struct LvcsToml {
    pub(crate) coord: CoordConfig,
    pub(crate) limits: Limits,
    pub(crate) secrets: SecretsConfig,
    pub(crate) telemetry: TelemetryConfig,
    /// `[[actions]]` as written, read only at approved heads like every
    /// section (decisions 127 and 245); a list `map` refuses refuses the
    /// file.
    #[serde(rename = "actions")]
    pub(crate) entries: Vec<ActionEntry>,
    /// `[channels]`: each combination's members (decision 297), mapped
    /// with `entries`.
    pub(crate) channels: ChannelsTable,
    /// The canonical actions `map` gives of `entries` and `channels`.
    #[serde(skip)]
    pub(crate) actions: Actions,
    /// `[runner]`: a change runner's quiet period, applied at its next
    /// start (decision 127).
    pub(crate) runner: RunnerTable,
    pub(crate) git: GitConfig,
    /// `[issues]`: the done channel issues close on (decision 304).
    pub(crate) issues: IssuesConfig,
    /// `[workflows]`: how the GitHub workflows map (decision 245).
    pub(crate) workflows: WorkflowsTable,
    /// What each workflow file came to, once [`LvcsToml::add_workflows`]
    /// mapped them.
    #[serde(skip)]
    pub(crate) sources: Vec<FileMapped>,
}

/// `lvcs.toml` `[issues]` (decision 304): `done`, the channel or
/// `[channels]` combination whose value fixes an issue when it holds all
/// its linked work; with none, every change action's channel (decision
/// 297).
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]
#[serde(default)]
pub(crate) struct IssuesConfig {
    /// The channel or combination issues close on.
    pub(crate) done: Option<String>,
}

/// `lvcs.toml` `[telemetry]` (design §6): `subtrees`, the directory
/// prefixes the `subtree` attribute may name (at most `SUBTREE_CAP`), and
/// `ws_names`, the workspace names the `ws_name` attribute may name (at
/// most `WS_NAME_CAP`); entries past a cap are ignored, so both attributes
/// stay bounded whatever the file says. Owner: `M3.daemon`.
#[derive(Debug, Clone, Default, PartialEq, Eq, Deserialize)]
#[serde(default)]
pub(crate) struct TelemetryConfig {
    /// The directory prefixes the `subtree` attribute may name.
    pub(crate) subtrees: Vec<String>,
    /// The workspace names the `ws_name` attribute may name.
    pub(crate) ws_names: Vec<String>,
}

/// Why `lvcs.toml` could not be loaded: it could not be read, it is not
/// TOML of these sections' shapes, or its `[[actions]]` are refused.
#[derive(Debug)]
pub(crate) enum ConfigError {
    Read(io::Error),
    Parse(String),
    /// `[[actions]]` parsed, and `map` refused it.
    Actions(ActionConfigError),
}