iSMAIL / developer guide
Toolchain
One stable Rust toolchain plus two extras. On Ubuntu/Debian (also what the CI images use):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
rustup component add rustfmt clippy
rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --locked --version 0.2.130 # must match Cargo.lock
sudo apt-get install -y pkg-config make # C bits needed by `ring`
wasm-bindgen-cli must match the wasm-bindgen version in Cargo.lock —
a mismatch fails the UI build with a confusing wasm version error.
First build
git clone https://git.handtrixxx.com/homelab/ismail.git # canonical (Gitea); GitHub is a read mirror
cd ismail
cargo test # whole suite incl. embedded UI
cargo test --no-default-features # engine only - fastest loop, no wasm needed
Task runner: ./run
One dispatcher at the repo root, the way a Node project uses package.json
scripts. It exists so the local loop and CI describe the same steps, and so the two cannot
drift. Nothing it creates leaves the repo: state and generated credentials live in
.local/ (gitignored, mode 600/700).
./run dev debug build, loopback :8121, no auth → open API and open UI../run dev-auth same plus a generated classic login (user dev) so the sign-in path is testable../run start release binary with bearer token and login — the production shape, locally../run docker runs the ismail:<version> image with a local data dir../run smoke throwaway servers + the API/UI contract checks (token gate, login + session cookie, open mode, embedded wasm)../run wasm rebuild wasm/ + glue../run build release binary; a stale wasm/ is detected and rebuilt first../run build-musl the image's static binary plus the CI size assert../run build-docker the scratch image, tagged with the Cargo version../run lint, ./run test, ./run osv,
./run ci (everything, in CI order — needs the musl target), and
./run ci-docker which runs the CI test job inside the pinned
rust:1.99.1-slim-bookworm image on machines without the extra toolchain.Ports: PORT=8123 ./run dev (also SMOKE_PORT). Starting on a port
another ismail already holds fails with that hint instead of a bare bind error.
The UI build order (the one trap)
Release binaries embed wasm/ via include_bytes!. The wasm and its
wasm-bindgen glue are build artifacts, not sources, so a UI change needs this order —
building the binary first ships a stale UI:
cargo build -p ismail-ui --target wasm32-unknown-unknown --release
wasm-bindgen --target web --out-dir wasm target/wasm32-unknown-unknown/release/ismail_ui.wasm
cargo build --release # only now does the binary see the new UI
For pure engine work (src/imap.rs, sync logic, CLI parsing) use
--no-default-features and skip the wasm dance entirely.
Dashboard theme: vendored CSS, no Node
The UI is styled with Tabler 1.8.1 (MIT), vendored prebuilt at
static/vendor/tabler.min.css (+ LICENSE.tabler) and embedded via
include_bytes! — served at /tabler.min.css, linked from
static/loader.html, dark mode forced with data-bs-theme="dark".
No Tabler/Bootstrap JavaScript is loaded; all interactivity is Leptos. Updating the pin is a
curl plus a version-comment touch:
curl -sL -o static/vendor/tabler.min.css \
"https://cdn.jsdelivr.net/npm/@tabler/core@1.8.1/dist/css/tabler.min.css"
Dev server
./run dev # does exactly the below, after building the wasm when needed
./target/release/ismail --serve --listen 127.0.0.1:8121 \
--schedulefile /tmp/dev-sched.json
# open http://127.0.0.1:8121 - with no --apitoken/--authuser/--oidc-* flags the
# server is OPEN: convenient locally, never do this behind a proxy. The UI opens
# straight away (whoami reports "open":true); bind to loopback or put a proxy in
# front that authenticates.
Login variants for testing auth: --authuser dev --authpassfile /tmp/pw
(classic) or the OIDC flags from the quickstart
(--oidc-issuer … --oidc-clientid … --oidc-clientsecretfile … --oidc-redirect …).
The session cookie gets its Secure flag only when a TLS proxy sends
X-Forwarded-Proto: https, so plain-HTTP dev logins stay cookie-happy.
Quality gates (what CI enforces — run them before pushing)
./run lint # fmt + both clippy runs
./run test # both feature configs
python3 scripts/osv-check.py # supply-chain gate, see below
./run ci # all of it + wasm + musl size assert + smoke
- OSV: every runtime dependency is queried against the Rust advisory DB. A flagged
crate is either fixed, replaced, or accepted with a dated entry in
scripts/osv-allow.toml— acceptance without a reason and review date is not the culture here. - gitleaks: commit hygiene; the allowlist matches only captured test canaries.
- CI images:
rust:*-slimhas no rustfmt/clippy/curl — the workflow installs what it needs in-job (see.gitea/workflows/ci.yml). - Pipeline shape (v0.8+): the OSV check is its own job parallel to
test;image-and-uiande2ewait for both. The two rust steps mount named volumesismail-cargo-registry+ismail-cargo-target— the dind daemon persists them, so dependency compiles are reused between runs (invalidate withdocker volume rm ismail-cargo-registry ismail-cargo-target). Docker layer caches on the same daemon already speed up the image build. Pushes that only touchdocs/**,README.mdorSECURITY.mdskip the pipeline (paths-ignore). - Dev profile:
[profile.dev] debug = "line-tables-only"keepstarget/debugabout half the size with faster linking (backtraces still resolve)../run cleanwipes the wholetarget/(~5 GB).
CI and the e2e round trip
Push to Gitea main (canonical): runs the gates above — fmt, gitleaks, OSV, clippy + tests, wasm size guard, then a Docker image build plus a serve smoke test (API contract, login endpoints, transcript exit line). Gitea push-mirrors to GitHub; never force-push — the mirror keeps history straight.
The e2e job (real IMAP round trip against throwaway Stalwart test accounts,
seed → sync → dedup verify → idempotent rerun → cleanup) runs only on schedule or
Actions → Dispatch workflow, because its credentials are repo Actions secrets.
The scripts live in scripts/e2e_seed.py; Stalwart is strict: IMAP search
strings must be double-quoted, and STORE sets comma-separated.
Repo map
options.rs (325 option spellings), imap.rs (client), sync.rs (parity logic), report.rs (transcript + exit codes), api.rs (HTTP API + gate), auth.rs (sessions + OIDC), schedule.rs, secrets.rs.ismail-ui); talks to the API with the session cookie — no token plumbing. Markup uses the classes of the vendored Tabler stylesheet (static/vendor/).osv-check.py (+ allowlist), e2e_seed.py, option-spec generation. The run script at the repo root is the task runner described above.House rules
- The CLI is the contract: exit codes (0/1/64/101), transcript keys and the
Exiting with return value N …line must stay imapsync-shaped; there are tests for this. - TLS honesty: iSMAIL always verifies the server certificate hostname — unlike
imapsync's
SSL_VERIFY_NONE. Don't "fix" a hostname failure by weakening this. - No
:latestin any compose example; tag everything. - Passwords never land in transcripts, API responses or logs — the CI smoke greps for leaks.