From 695ed178a5c4e14242750ee21b367479a2e834b3 Mon Sep 17 00:00:00 2001 From: mnovak Date: Tue, 17 Nov 2026 21:18:19 +0100 Subject: [PATCH] [control] Clippy clean for the T4 code; CLAUDE.md: the deploy folders and the Linux test command in Docker; the Docker smoke turns off Git Bash's path rewriting and removes its volume --- CLAUDE.md | 3 +++ crates/control/src/engine.rs | 3 ++- crates/control/src/previews.rs | 8 +++++++- crates/control/tests/previews.rs | 4 ++-- scripts/smoke-docker.sh | 4 ++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 98fb469..e296d14 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,10 +14,13 @@ tests/diff same requests against Ianitor and Caddy, responses compared. tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only. tests/fuzz cargo-fuzz targets. deploy/nixos NixOS module + VM tests. +deploy/docker the image (edge + control), compose file, the Linux CI image (target ci). deploy/linux: installer, + systemd units. deploy/windows: Windows Server installer (Caddy mode). docs/deploy/anywhere.md. scripts the release's version check. Releases (notes, screenshots): docs/release.md. ## Commands cargo test --workspace # quote test counts per crate; an exit code alone is not green +docker build --load -f deploy/docker/Dockerfile --target ci -t ianitor-ci . && docker run --rm --memory 6g ianitor-ci cargo test --workspace --locked -j 2 # Linux, all suites cargo run -p ianitor-control -- --dev pnpm --filter web dev # 127.0.0.1 only, never --host node apps/web/scripts/shots.mjs # the release's screenshots (demo data, headless Edge) -> target/aula (docs/release.md) diff --git a/crates/control/src/engine.rs b/crates/control/src/engine.rs index 44f4ef3..f777c6a 100644 --- a/crates/control/src/engine.rs +++ b/crates/control/src/engine.rs @@ -39,8 +39,9 @@ use crate::util::{ write_json, }; -/// What a user asked for. +/// What a user asked for. Built once per request; boxing the host body buys nothing. #[derive(Debug, Clone)] +#[allow(clippy::large_enum_variant)] pub enum Change { Put { spec: HostSpec, create: bool }, ShareLinks { hostname: String, on: bool }, diff --git a/crates/control/src/previews.rs b/crates/control/src/previews.rs index ca952a0..64b2efb 100644 --- a/crates/control/src/previews.rs +++ b/crates/control/src/previews.rs @@ -9,6 +9,9 @@ //! (a preview token is hostile: it must not be able to publish this machine's admin ports), //! and the sweeper that closes expired previews. +// A refusal is built once per failed request; boxing it buys nothing (as in `engine`). +#![allow(clippy::result_large_err)] + use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; use std::sync::Arc; use std::time::Duration; @@ -95,7 +98,10 @@ fn parse_entry(e: &str) -> Option { ports, }); } - plain(&name).then(|| Allowed { + if !plain(&name) { + return None; + } + Some(Allowed { target: Target::Name(name), ports, }) diff --git a/crates/control/tests/previews.rs b/crates/control/tests/previews.rs index f140f94..0a87a32 100644 --- a/crates/control/tests/previews.rs +++ b/crates/control/tests/previews.rs @@ -22,7 +22,7 @@ use serde_json::{Value, json}; const DOMAIN: &str = "pv.example.test"; struct Ctl { - dir: TempDir, + _dir: TempDir, api: SocketAddr, admin: String, preview: String, @@ -112,7 +112,7 @@ sweep_secs = 1 "control did not listen" ); Ctl { - dir, + _dir: dir, api, admin, preview, diff --git a/scripts/smoke-docker.sh b/scripts/smoke-docker.sh index 66fcf2e..01a276d 100644 --- a/scripts/smoke-docker.sh +++ b/scripts/smoke-docker.sh @@ -10,6 +10,9 @@ # # scripts/smoke-docker.sh set -euo pipefail +# Git Bash on Windows rewrites /paths in arguments and the environment of Windows programs +# (docker.exe); the paths here are the container's. +export MSYS_NO_PATHCONV=1 MSYS2_ENV_CONV_EXCL='*' IMAGE=$1 CTL=$2 WORK=$3 REPO=$(cd "$(dirname "$0")/.." && pwd) @@ -24,6 +27,7 @@ fail() { echo "FAILED: $*" >&2; exit 1; } cleanup() { "${DC[@]}" down -v --remove-orphans >/dev/null 2>&1 || true docker rm -f $P-app >/dev/null 2>&1 || true + docker volume rm ${P}_state >/dev/null 2>&1 || true } trap cleanup EXIT [ ! -e "$WORK" ] || fail "$WORK exists; give a new folder"