Each task's tests were run against a reference at its end state; the end states were replayed from master in order with the gate at each step (650 to 762 tests); each skeleton compiles against its tests and fails them. The reference is kept off this machine. Lessons T27 (every wait in a test has a limit) and T28 (mutate the reference before hand-over) come from this work. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
38 lines
1.7 KiB
Rust
38 lines
1.7 KiB
Rust
//! `gatewayd serve --config <path>`: the Mattermost channel. It loads its configuration and its
|
|
//! token, prepares its directory, then serves until it must stop (exit 1).
|
|
|
|
use std::os::unix::fs::DirBuilderExt;
|
|
use std::path::Path;
|
|
use std::process::ExitCode;
|
|
use std::sync::Arc;
|
|
use std::sync::atomic::AtomicBool;
|
|
|
|
use gatewayd::config::{Config, MATTERMOST_TOKEN};
|
|
use gatewayd::secrets;
|
|
use gatewayd::serve::{START_FAILED, Tuning, run};
|
|
|
|
fn main() -> ExitCode {
|
|
// `args_os`: the config path need not be UTF-8, and `args` would panic on one that is not.
|
|
let args: Vec<std::ffi::OsString> = std::env::args_os().skip(1).collect();
|
|
let words: Vec<Option<&str>> = args.iter().map(|a| a.to_str()).collect();
|
|
match (words.as_slice(), args.get(2)) {
|
|
([Some("serve"), Some("--config"), _], Some(path)) => serve(Path::new(path)),
|
|
_ => {
|
|
eprintln!("usage: gatewayd serve --config <path>");
|
|
ExitCode::from(2)
|
|
}
|
|
}
|
|
}
|
|
|
|
fn serve(path: &Path) -> ExitCode {
|
|
// Each failure prints one line (plus its pointer) and returns ExitCode::from(1):
|
|
// 1. `Config::load`: "gatewayd: <error>\n<START_FAILED>". 2. `token_source`: "gatewayd: <path>:
|
|
// <why>\n<START_FAILED>".
|
|
// 3. `secrets::load(MATTERMOST_TOKEN, &source, &|k| std::env::var_os(k))`: "gatewayd: <error>"
|
|
// (it carries its pointer). Print the warning, if any, as it is. 4. Create the state file
|
|
// directory, recursive, 0700: "gatewayd: cannot prepare <dir>: <e>\n<START_FAILED>". 5.
|
|
// `run` with Tuning::default(), a log that prints each line to standard error, and a stop
|
|
// flag that is never set; print the Stop it returns.
|
|
todo!()
|
|
}
|