Files
boxmaker/docs/plans/M4b/05-brokerd-config-gateway.md
kyleandClaude Opus 5.5 2d415fc1be Plan M4b: approvals over Mattermost in 15 tasks
Skeletons for new files only; existing files change by exact edits, so no task overwrites an
earlier one's work. Each task's tests were run against a reference built in order from master,
with the gate at each step and mutations checked; each skeleton compiles and fails its tests, and
every todo!() comment was read beside its signature. The reference is kept off this machine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 03:34:21 -07:00

2.4 KiB

M4b task 05: [gateway] in brokerd.toml

Branch: m4b (run git switch m4b; git status --short must be empty, otherwise stop) Commit subject: brokerd: config, [gateway] socket for Mattermost approvals

Goal

brokerd carries pending approvals to gatewayd only when brokerd.toml says where (M4b spec, section 3):

[gateway]                     # absent: Mattermost approvals are off, as in M3
socket = ""                   # empty: <home>/run/gateway/gateway.sock

Files

  • Copy: crates/brokerd/tests/config_gateway.rs, and a new version of the given crates/brokerd/tests/support/rig.rs (its Config gains gateway: None,)
  • Modify: crates/brokerd/src/config.rs, docs/implementer-log.md

The changes, exactly

In crates/brokerd/src/config.rs:

  1. Before fn default_podman, the section:
/// `[gateway]`: where `gatewayd` takes approvals to post in Mattermost. Without the section,
/// Mattermost approvals are off and only `bxctl` answers. An empty path means the default.
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Default)]
#[serde(deny_unknown_fields, default)]
pub struct Gateway {
    pub socket: PathBuf,
}
  1. In struct Config, after pub runner: Option<Runner>,:
    #[serde(default)]
    pub gateway: Option<Gateway>,
  1. In impl Config, before audit_dir:
    /// `gateway.sock`, when `[gateway]` is set.
    pub fn gateway_socket(&self) -> Option<PathBuf> {
        let gateway = self.gateway.as_ref()?;
        if gateway.socket.as_os_str().is_empty() {
            Some(self.paths.home.join("run/gateway/gateway.sock"))
        } else {
            Some(gateway.socket.clone())
        }
    }

Steps

  • 1. Copy. git switch m4b, then cp docs/plans/M4b/files/crates/brokerd/tests/config_gateway.rs crates/brokerd/tests/ && cp docs/plans/M4b/files/crates/brokerd/tests/support/rig.rs crates/brokerd/tests/support/
  • 2. See it fail. cargo test -p brokerd --test config_gateway. Expected: it does not compile.
  • 3. Make the three changes. Run cargo fmt --all.
  • 4. See it pass. cargo test -p brokerd. Expected: every suite passes; config_gateway 4 passed.
  • 5. Run the gate. make gate. Expected last line: gate: ok.
  • 6. Log and commit. git add crates/brokerd docs/implementer-log.md Cargo.lock && git commit

Done when

  • cargo test -p brokerd passes; make gate prints gate: ok.