M5: Account lifecycle over gRPC (edit/delete/test) + persist TLS mode #230

Merged
KofTwentyTwo merged 5 commits from story/m5-s1-account-lifecycle into dev 2026-07-30 01:57:56 +00:00
5 Commits
Author SHA1 Message Date
James Maes e873434dad docs(accounts): scope TestAccountConnection SMTP claim to reachability
The SMTP leg only dials and negotiates TLS/STARTTLS; it performs no AUTH
(lettre exposes no clean auth-only probe on AsyncSmtpTransport), while
IMAP genuinely logs in. Clarify the proto doc for smtp_ok/smtp_error and
the CLI output wording so nothing implies SMTP authentication was
verified. Doc-only proto change; golden unchanged.

Refs #194 #182
2026-07-29 20:55:01 -05:00
James Maes 065e19cb2a fix(accounts): restore prior credential on update rollback
A password rotation that fails to persist previously deleted the
just-written secret, destroying the working credential the key already
held and orphaning the still-present account row. Snapshot the prior
secret first and restore it on save failure (falling back to delete
only when none existed). Regression tests force save_account to fail
and assert the original secret survives.

Refs #194 #182
2026-07-29 20:54:12 -05:00
James Maes 2e29cdb424 feat(accounts): edit/delete/test account lifecycle over gRPC
Implements Accounts UpdateAccount/RemoveAccount/TestAccountConnection in
the daemon (update mirrors add_account's keyring rollback discipline;
test probes real IMAP+SMTP via an injectable tester, honoring persisted
TLS modes), wires the configured TLS modes into build_mail_backend/
build_smtp_sender, and replaces the fabricated CLI account
show/edit/delete/test handlers with real thin gRPC clients. Adds an
offline full-daemon lifecycle E2E and unauth-rejection coverage for all
three new RPCs.

Refs #194 #182
2026-07-29 20:40:14 -05:00
James Maes ea42f64e9f feat(mail): branch IMAP/SMTP transport on TlsMode; add connection probes
Threads TlsMode through ImapEngine/ImapDualSocketManager and
SmtpTransportEngine so implicit TLS, STARTTLS, and plain are genuine
transport paths (a unified MailStream plus a real IMAP STARTTLS
negotiation), not validate-and-discard. Adds bounded connect timeout
and per-engine probe_connection backing TestAccountConnection, with
mock/loopback-only setup tests for each mode.

Refs #194 #182
2026-07-29 20:39:01 -05:00
James Maes 5d6889e73e feat(store): persist per-account IMAP/SMTP TLS modes; add account CRUD
Adds a backfill-safe imap_tls_mode/smtp_tls_mode column migration,
binds+reads both modes in save_account/list_accounts (previously
validated then silently discarded and hardcoded back to ImplicitTls),
and adds get_account/delete_account. Regression test proves the modes
survive a save/list/get round-trip.

Refs #194 #182
2026-07-29 20:38:12 -05:00