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>
2.4 KiB
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 givencrates/brokerd/tests/support/rig.rs(itsConfiggainsgateway: None,) - Modify:
crates/brokerd/src/config.rs,docs/implementer-log.md
The changes, exactly
In crates/brokerd/src/config.rs:
- 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,
}
- In
struct Config, afterpub runner: Option<Runner>,:
#[serde(default)]
pub gateway: Option<Gateway>,
- In
impl Config, beforeaudit_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, thencp 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_gateway4 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 brokerdpasses;make gateprintsgate: ok.