14 Commits
Author SHA1 Message Date
Mateusz PstruchaandClaude Opus 5.5 4b6eeaca15 Bump to 0.5.0
CI / test (push) Successful in 3m51s
Release / image (push) Successful in 2m48s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.5.0
2026-09-23 12:01:40 +02:00
Mateusz PstruchaandClaude Opus 5.5 3f1d9227c6 Add trash retention, stop-after-match and run-now
CI / test (push) Successful in 46s
Mail in Trash is purged after TRASH_RETENTION_DAYS (default 30, 0
disables), hourly. Stored files are content-addressed and shared, so a
file is only removed once nothing references it — and not if written or
reused in the last hour, since ingest writes a file before inserting the
row that points at it. Reusing an existing blob now refreshes its mtime
so that grace period protects it too. Trash rows report when they purge.

"Stop processing further rules" moves from an action to a per-rule
option (stop_after_match): it's a property of the rule, not something
done to a message. Migration 0007 converts existing stop actions, and a
stop submitted as an action is now rejected.

Rules can be run now against existing mail outside Trash, disabled ones
included so a rule can be tried before it's switched on. It pages by
key, one transaction per page, and only re-reads stored raw messages
when the rule tests a header.

All JSON bodies now go through an AppJson extractor so malformed or
mistyped bodies return the API's {"error": …} shape. Axum's default was
a plain-text 422 the webapp could only show as "request failed: 422" —
losing the useful part, e.g. "unknown variant `stop`".

Verified live: the stop flag blocks a lower rule on arriving mail; run
now on a disabled header rule archived 2 of 4 messages; a purge removed
an expired message and its unique raw file while keeping an attachment
file still shared with a live copy, with no orphaned rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 12:00:04 +02:00
Mateusz PstruchaandClaude Opus 5.5 5809c9e310 Document threading, tags and rules behaviour
CI / test (push) Successful in 50s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 11:26:03 +02:00
Mateusz PstruchaandClaude Opus 5.5 807775726c Add threading, tags, rules and thread actions
CI / test (push) Successful in 3m3s
Threading (§3.6) is an incremental, database-backed JWZ: each message
links to its ancestors, to replies that arrived before it, and to
siblings sharing a missing ancestor (what JWZ's placeholder containers
do), merging every thread it touches into the one holding the oldest
message. Subject-only grouping applies only to Re:/Fwd: messages with no
reference headers, so lists that strip References still thread while
unrelated mail sharing a generic subject never merges. Existing mail is
re-threaded once per account via a versioned backfill.

Rules (§3.5) are structured JSON — one level of all/any tests, exactly
what the editor can show — run after the body is fetched since they need
headers. Every matching rule applies in priority order until a `stop`.
Patterns use the regex crate: linear-time, so a user-written pattern run
against every incoming message can't hang ingest. Numeric comparison
reads the first number in a value, so both "5.3" and "Yes, score=5.3"
spam headers work for phase 6.

Rule "delete" is a soft delete to Trash: a rule with an over-broad
pattern must not be able to destroy mail. Archive moves to a system
folder found by role, so renaming it doesn't break archiving. Manual
thread actions use the same action type and applier as rules, so the two
can't drift.

Thread listing now takes a view (inbox/all/sent/trash/folder/tag). A
thread appears in a view if any message matches, but the row summarises
the whole conversation — so a reply to an archived thread brings it back
to the inbox. Row subjects come from the root when present, not merely
the earliest Date (replies can be dated earlier, and Date ties are
common at one-second resolution).

Verified against a live TLS mail server: out-of-order parent/reply,
replies to a missing root, a list that strips References, and two
unrelated "Invoice" mails kept apart; rules tagging, archiving, trashing
on spam score, and `stop` blocking a lower rule; the backfill rebuilding
the same 9 threads from 13 split messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 11:19:35 +02:00
Mateusz PstruchaandClaude Opus 5.5 d839d57e11 Bump to 0.4.0
CI / test (push) Successful in 2m49s
Release / image (push) Successful in 2m35s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v0.4.0
2026-09-23 11:05:56 +02:00
Mateusz PstruchaandClaude Opus 5.5 fd8ee8311c Add sending: outbox queue, SMTP worker, drafts
CI / test (push) Successful in 2m28s
Drafts and queued sends are one outbox row in different states, drained
by a background worker so SMTP never runs in the request path (§3.3).
Retries back off 1-16 min; 5xx, auth and TLS failures fail fast; items
a crashed worker left mid-send are reclaimed. Each message keeps its
Message-ID across retries, so an at-least-once duplicate is recognisable.
Reply headers are derived server-side from the parent, and sent mail is
filed into its thread alongside received mail.

Three things the libraries would have got wrong:
- mail-builder's .bcc() writes an ordinary Bcc header every recipient
  sees. Bcc goes in the envelope only; a test checks it never reaches the
  rendered bytes, and was confirmed to fail if .bcc() is reintroduced.
- mail-send trusts only compiled-in public CAs, while IMAP (native-tls)
  uses the OS store — a server with an internal-CA cert would sync but
  never send. SMTP now uses the OS store too.
- rustls is added with default-features off: its defaults pull in
  aws-lc-rs, which needs cmake/clang and would break the runner build.

Also fixes: UIDVALIDITY resets now only delete IMAP-sourced rows (sent
mail shares the table and exists nowhere else); first sync no longer
logs a false "UIDVALIDITY changed" warning; Message-IDs are stored bare
whichever path writes them (ENVELOPE brackets them, mail-parser doesn't);
accounts can choose STARTTLS vs implicit TLS for SMTP, defaulting by port.

Verified end to end against a TLS mail server with a private-CA cert,
with no plaintext patching: IMAPS sync, SMTPS send, delivery and headers
checked from the recipients' mailboxes, Bcc absent from other copies,
plaintext refused when STARTTLS is unavailable, retry scheduling on
connection failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 10:59:28 +02:00
Mateusz PstruchaandClaude Opus 5 bc39a1221c Add thread listing, fix dead path routes
CI / test (push) Successful in 29s
Adds GET /api/threads, grouped server-side: a thread's messages are
spread through the flat list by date, so a client grouping page-by-page
would split threads across page boundaries and miscount unread. The
thread detail endpoint now returns bodies too, so opening a conversation
is one request rather than one per message.

Fixes three routes that have been dead since the first commit. axum 0.7
spells a path parameter ':id'; '{id}' is axum 0.8 syntax and was being
matched as a literal segment, so GET /api/messages/<id>, GET
/api/threads/<id> and DELETE /api/accounts/<id> all 404'd. This fails
silently — no compile or startup error — and the original smoke test
only exercised list endpoints. Found by clicking a conversation in the
webapp.

Adds tests/routes.rs to cover route shape, verified to fail against the
old syntax.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 22:53:13 +02:00
Mateusz PstruchaandClaude Opus 5 6c73a91b8e Quieten docker build output in release logs
CI / test (push) Successful in 41s
The v0.2.0 release log was 17k lines, ~12k of which were BuildKit's
animated progress display repainting itself with cursor-movement
escapes. --progress=plain emits one line per event instead.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 22:23:34 +02:00
Mateusz PstruchaandClaude Opus 5 3e183b220c Add .dockerignore and bump to 0.2.0
CI / test (push) Successful in 2m31s
Release / image (push) Successful in 4m39s
Without .dockerignore the build context included target/ — gigabytes
sent to the daemon before the build even starts, on a host where disk
has already been a constraint. Verified the image builds, runs
migrations and serves /healthz.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
v0.2.0
2026-09-22 22:13:32 +02:00
Mateusz PstruchaandClaude Opus 5 a3213bf3e2 Cancel superseded CI runs
CI / test (push) Successful in 4m43s
A single runner serves all three repos, so superseded pushes queueing up
full builds is a real cost. Releases are left uncovered deliberately:
cancelling a publish halfway is worse than running it twice.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 20:33:51 +02:00
Mateusz PstruchaandClaude Opus 5 0272a6f46b Document runner host package requirements
CI / test (push) Successful in 4m40s
First CI run failed with "linker cc not found" — the runner executes
jobs on the host, so the C toolchain a container image would normally
provide has to be installed there. Records the fix, and notes openssl-devel
as the next thing that would break so it can be installed in one go.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 20:17:23 +02:00
Mateusz PstruchaandClaude Opus 5 a4401936a0 Target the rocky-10 runner and its proven action conventions
CI / test (push) Failing after 1m17s
Match the setup already working on that runner: setup-* actions to
provision toolchains rather than host-installed tooling, and the
automatic GITHUB_TOKEN. Registry push keeps a dedicated REGISTRY_TOKEN,
since the automatic token's scope doesn't reliably cover packages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 20:12:29 +02:00
Mateusz PstruchaandClaude Opus 5 3b96f80f36 Store flags in IMAP wire format, add CI and ops docs
CI / test (push) Canceled after 0s
Flags were stored via Debug formatting of async-imap's Flag enum, which
produced Rust-internal spellings ("Seen", "Custom(\"$Junk\")") that don't
round-trip back through Flag::from and aren't what the schema documents.
Map to canonical wire spelling (\Seen, $Junk) before the webapp starts
depending on it, with tests pinning the format.

Adds Gitea Actions CI/release workflows, an nginx rate-limiting config
for the §7 gap, and a shared release-process doc. Records the decision
not to reconcile server-side flag changes or deletions, with the
conditions that should trigger revisiting it.

Also applies rustfmt and clears clippy, so CI passes from the first run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 19:55:09 +02:00
Mateusz PstruchaandClaude Opus 5 4c1a6457c5 Initial sync server: IMAP engine, schema, and read API
Covers phases 1-2 of the build order in the architecture spec: the IMAP
sync engine (IDLE + UIDVALIDITY tracking + jittered reconnect, headers
first with lazy body fetch), the full data model, and a minimal REST API
for auth, accounts, folders, messages and delta polling.

Credentials are encrypted at rest with ChaCha20-Poly1305 rather than
libsodium secretbox, to avoid a system dependency for the same
construction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 19:00:59 +02:00