Commit Graph
40 Commits
Author SHA1 Message Date
Gemini CLI 8cbe8c01bb ci: use idiomatic Dagger service bindings for Stalwart
Refactor the CI pipeline to use WithServiceBinding for the Stalwart mail
server, replacing legacy shell scripts and manual port management.
Introduces pre-seeded data for the Stalwart service to avoid network
hits and improves headless UI testing with Xvfb.
2026-05-17 16:01:42 +02:00
GuettliBot2 982618c9fe fix(ci): pin Stalwart to v0.14.1 and fix local start script 2026-05-17 14:24:06 +02:00
GuettliBot2 92778346d3 ci: remove Nix dependency and modernize Stalwart test setup with Dagger Services 2026-05-17 13:17:28 +02:00
GuettliBot2 73c1a09d47 ci: minor cleanup of self-hosted runner references 2026-05-17 11:38:27 +02:00
GuettliBot2 90ab0a6905 ci: rename integration tests to test-backend and migrate to Dagger 2026-05-17 08:47:15 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 7a3661dda4 fix: kill leftover stalwart process before starting integration tests
The CI self-hosted runner can leave a stalwart process alive from a prior
run that was interrupted externally, causing the next run to fail with
"port already in use". Kill any existing stalwart before starting a new one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 22:04:35 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 cf277064cc feat(builds): populate builds page with Linux and Android history (#94)
The builds page at /builds/ was empty because generate-build-history
only ran inside deploy-playstore; if that job failed early (e.g. Play
Store secrets not configured) the website was never updated, and the
build-linux job never triggered a website update at all.

Changes:
- generate_build_history.py: extend to cover Linux tarballs in addition
  to Android APKs, capped at MAX_BUILDS_PER_PLATFORM (30) each
- Taskfile: add website-publish task (generate-build-history +
  website-deploy), exclude *.tar.gz from rsync, update descriptions
- .forgejo/workflows/ci.yml: add publish-website job that waits for
  both build-linux and deploy-playstore (using always() so it runs
  even when deploy-playstore fails), then removes the duplicate
  generate/deploy steps from deploy-playstore
- .github/workflows/ci.yml: add deploy job that deploys Linux build,
  generates build history, builds Hugo site, and rsyncs to server
- .gitignore: ignore website/content/builds/_index.md (generated),
  Python __pycache__, and widget test failure screenshots
- stalwart-dev/integration_ui_test.sh: use ${USER:-$(id -un)} for
  robustness in environments where USER is unset
- scripts/test_generate_build_history.py: unit tests for parse_builds
  and render_entries covering both platforms

Generated content (builds/_index.md and per-day pages) is not tracked
in git; it is produced at CI time and rsynced to the server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 19:08:55 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 dd1425a497 fix(test): fix E2E retry — set -e broke exit-code capture
With set -Eeuo pipefail, a failing fvm flutter test exited the script
before _e2e_exit=$? could run, so the retry-on-new-display logic never
fired. Use the cmd || var=$? pattern to capture the exit code safely,
and add || true to the break guard so set -e doesn't trip on it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 00:10:46 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 47bdf3ec35 fix(ci): reduce verbose output in CI jobs
- Add --no-warn-dirty to all nix develop calls to suppress Git dirty-tree warnings
- Switch integration test reporter from expanded to compact (per-test names suppressed on success)
- Show only summary line on integration test success, matching unit/widget test behavior

Closes #8

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 20:42:37 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 f7e75cd5b6 fix(test): update E2E test for onboarding screen + increase timeouts
The U7 onboarding view replaced "No accounts yet." with "Welcome to
SharedInbox", causing the E2E test to spin for the full timeout budget
(pumping slowly in headless CI) before failing. Fix the finder and
bump per-attempt timeout from 240s → 360s and CI job ceiling from
20 min → 30 min to give the full account-add → send → verify flow
room to complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 16:56:53 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 9c1d8cfe72 fix(ci): manage Xvfb directly to get accurate E2E exit codes
xvfb-run catches SIGTERM from `timeout`, kills its children, and exits 0,
making a timed-out test indistinguishable from a pass (CI #168 false positive).
Running Xvfb ourselves captures fvm flutter test's real exit code so timeouts
(exit 124) are correctly treated as failures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 16:45:38 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 d12cdd6ca4 fix(e2e): kill stale processes + retry once on display init hang
Previous failed CI runs leave orphan sharedinbox/flutter processes that hold
onto Xvfb display resources, causing the next run's GTK app to hang during
initialisation (never connects back to the flutter test runner, no output
for 9+ min until timeout fires).

Fix:
- Kill stale sharedinbox/flutter processes before launching xvfb-run
- Retry the xvfb-run call once (4-min timeout per attempt) so a transient
  display-init hang doesn't permanently fail the job

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 16:27:48 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 0d6a8062e4 fix(ci): increase E2E timeout to 10 min (was 5 min, too tight)
Sequential CI steps leave the runner under heavier load than the parallel
task check approach, so the E2E test can legitimately take 4-5 min.
Raise timeout 300→600 in integration_ui_test.sh and step timeout 6→12 min.
Job-level ceiling raised to 30 min to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 15:51:58 +02:00
Thomas SharedInboxandClaude Sonnet 4.6 c45b0e852e ci: add step-level timeouts and cap E2E hang at 5 min (#67)
- Split single 'Run Full Check Suite' step into named steps so per-step
  timing is visible in the CI UI
- Add timeout-minutes: 20 to the overall job and timeout-minutes: 6 to
  the UI E2E step — previously a stuck xvfb-run could hang for 23+ min
- Add 'timeout 300' to xvfb-run in integration_ui_test.sh so the E2E
  test exits with a clear error instead of hanging indefinitely

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 15:36:31 +02:00
Thomas SharedInbox d4902d1395 Deploy via CI. 2026-05-12 08:15:47 +02:00
Thomas SharedInbox 03a68a00c6 feat: implement periodic sync reliability verification and health indicator 2026-05-09 09:47:42 +02:00
Thomas Güttler 3c90818845 Harden Android deployment and implement dynamic port allocation
- Replace fixed ports with dynamic allocation (port 0) for all Stalwart listeners, including ManageSieve.
- Require KVM acceleration for Android integration tests; fail early with setup instructions if /dev/kvm is inaccessible.
- Require all ANDROID_APK_SCP environment variables for deployment; fail early if any are missing.
- Revert emulator boot timeouts to standard values (120s device / 60s boot) now that software emulation is disabled.
2026-05-07 07:35:27 +02:00
Thomas Güttler ae5a48016c Fix Android deployment pipeline and integration tests
- Run integration tests sequentially in Taskfile.yml to avoid port 4190 (ManageSieve) conflict.
- Add ManageSieve listener to Stalwart config for better test coverage.
- Increase Android emulator boot timeout and add software-mode flags (-accel off, -no-boot-anim, -gpu swiftshader_indirect) to accommodate environments without KVM.
- Update LATER.md with notes on software emulation performance.
2026-05-06 21:54:41 +02:00
Thomas GüttlerandClaude Opus 4.7 db05878aca fix: reap orphan Xvfb before integration-ui run
xvfb-run --auto-servernum picks a fresh display number, but if a previous
session left an orphan Xvfb process (e.g. killed mid-flight), the stale
/tmp/.X11-unix/X<N> socket and X<N>-lock still belong to that orphan, and
xvfb-run's cleanup at the end fails with "kill: No such process" — flipping
the script's exit status to non-zero even when the integration test itself
passed. Reap orphan Xvfb processes (pgrep -u $USER -x Xvfb) and remove their
display sockets and lock files before invoking xvfb-run.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 12:42:34 +02:00
Thomas GüttlerandClaude Opus 4.7 2e2b7c3d9f fix: Android E2E aliceTile race + bundle deploy-android infra
The Android UI integration test failed at tap(aliceTile) with "0 widgets"
even though pumpUntil had just found the tile. On the slow software-rendered
emulator the route-pop animation finalises during pumpUntil's trailing 300 ms
settle, briefly leaving the tile out of the tree. Re-confirm with a second
pumpUntil before the tap.

Bundles the previously uncommitted infra changes that make task deploy-android
run end-to-end inside nix develop: Linux desktop runtime libs + GL software
rendering env in flake.nix, path_provider_android pin to <2.3 to avoid the
libdartjni SIGSEGV, deferred DB-path resolution after WidgetsFlutterBinding,
+iglx for xvfb-run, platform-tools on PATH, and a single pre-commit script
replacing the dart-format / task-check-fast pair.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 12:36:30 +02:00
Thomas Güttler d2226388d7 deploy to android works now. 2026-04-27 08:44:42 +02:00
Thomas GüttlerandClaude Sonnet 4.6 a2d98ed9bc fix: Android E2E search — unfocus IME keyboard before polling results
On Android, the soft keyboard keeps viewInsets.bottom non-zero while the
search TextField is focused.  ListView.builder is allocated near-zero
height and renders 0 items, so find.text(subject) always finds nothing
even though the IMAP search returned results.  Unfocusing the primary
focus after enterText dismisses the keyboard and gives the results list
full body height before pumpUntil starts polling.

Also fix pumpUntil to use pump(300ms) instead of pumpAndSettle() so a
continuously-running animation (spinner under CPU load) never prevents
settling, and override accountConnectionStatusProvider so _AccountTile
never shows a CircularProgressIndicator during the test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 22:31:25 +02:00
Thomas GüttlerandClaude Sonnet 4.6 e50ff3cd1d fix: override accountConnectionStatusProvider in E2E test to prevent spinner deadlock
CircularProgressIndicator in _AccountTile (from accountConnectionStatusProvider)
runs continuously and prevents pumpAndSettle() from ever settling on Android,
causing frame-pump storms that drop the StreamBuilder data state and make
tap(aliceTile) find 0 widgets.

Overriding the provider to return immediately means no spinner ever enters the
tree, so pumpUntil() can use pumpAndSettle() cleanly again.

Also adds task run-android (boots sharedinbox_test AVD and runs flutter run).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 21:22:38 +02:00
Thomas GüttlerandClaude Sonnet 4.6 c4928ef362 fix: Android E2E — robust account-tile finder, search debounce, DEFUNCT error filter
- pumpUntil uses ListTile-scoped finder so it doesn't exit early when
  'Alice' is still in the form's EditableText before navigation pops
- tap(aliceTile) reuses that same finder instead of a second find.text
- EmailListScreen search bar adds onChanged debounce (300ms) so the
  test never needs receiveAction(TextInputAction.search), which caused
  a keyboard-dismiss animation that triggered layout overflow in
  disposed render objects
- FlutterError.onError filter in the test suppresses DEFUNCT/DISPOSED
  overflow errors from Android's route-teardown layout passes
- integration_android_test.sh: force-stop + pm clear before uninstall
  so stale app data can't bleed into subsequent runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 20:04:31 +02:00
Thomas GüttlerandClaude Sonnet 4.6 077ddbd9c3 fix: Android app startup — INTERNET permission, MobSF scan, E2E robustness
- Add INTERNET permission to main AndroidManifest.xml (was missing from
  release builds, causing all network calls to fail on device)
- Add scripts/mobsf_scan.sh: uploads release APK to MobSF after each
  build and asserts required permissions are declared; docker pull -q
  suppresses progress-bar noise
- Wire MobSF scan into build-android task; add mobsf-stop convenience task
- Fix _AccountTile subtitle overflow on Android: replace Column([Text,Text])
  with single Text('email\ntype') so ListTile can measure height correctly
- E2E test robustness on Android: use pumpUntil(find.text('Alice')) instead
  of pumpUntil(FAB)+expect to handle Drift background-isolate stream delay;
  add skipOffstage:false to tap; remove stale email-address assertion
- Uninstall app before each Android integration test run to clear leftover
  DB state and prevent "Unable to start the app" on repeated runs
- Update widget tests to use find.textContaining for merged subtitle text

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 19:02:19 +02:00
Thomas GüttlerandClaude Sonnet 4.6 40cbf0b3b0 fix: Android E2E — use adb reverse instead of Platform.environment for Stalwart ports
Platform.environment is empty inside the Android app process, so the dynamic
IMAP/SMTP port numbers exported by the test script were never visible to the
Dart test code.  The test fell back to its defaults (127.0.0.1:1430/1025),
which aren't reachable inside the emulator.

Replace the export STALWART_IMAP_HOST=10.0.2.2 approach with
  adb reverse tcp:1430 tcp:$STALWART_IMAP_PORT
  adb reverse tcp:1025 tcp:$STALWART_SMTP_PORT
so the emulator's loopback ports 1430/1025 forward to the actual random host
ports — matching the test's hard-coded defaults exactly.  Clean up the
forwarding rules in the EXIT trap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 21:49:31 +02:00
Thomas GüttlerandClaude Sonnet 4.6 8a51496181 fix: INBOX sync misses SMTP-delivered mail due to Stalwart CONDSTORE bug
Stalwart 0.14.x does not increment HIGHESTMODSEQ when new mail arrives
via SMTP delivery, so the incremental sync's CONDSTORE fast-path saw
serverModSeq == storedModSeq and returned early — silently skipping
UID SEARCH and missing any newly received messages.

Fix: remove the early-return fast-path. Incremental sync now always
runs UID SEARCH UID ${lastUid+1}:* to discover new messages. CONDSTORE
is still used for the flag-refresh gate (only runs when modseq changed),
which is its correct, narrower role.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 17:55:52 +02:00
Thomas Güttler 317827541e less noise. 2026-04-25 07:23:56 +02:00
Thomas GüttlerandClaude Sonnet 4.6 681e0c0167 feat: Android emulator integration test via Stalwart
Adds stalwart-dev/integration_android_test.sh which starts Stalwart on
random ports, detects a connected Android emulator via adb, sets
STALWART_IMAP_HOST=10.0.2.2 (emulator-to-host alias), and runs the
existing integration_test/ suite on the emulator.

Wires it up as `task integration-android` in Taskfile.yml.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 06:13:38 +02:00
Thomas Güttler b814a3736b fix test. 2026-04-23 17:43:20 +02:00
Thomas GüttlerandClaude Sonnet 4.6 1820487c46 test: include integration test coverage in coverage gate
- Add lcov to nix flake (required for flutter --merge-coverage)
- stalwart-dev/test.sh: collect and merge coverage when unit baseline exists
- run_unit_tests.sh: remove inline coverage check (now in dedicated task)
- Taskfile: add coverage task; check runs test → integration → coverage
  sequentially so the gate sees combined unit + integration data
- check-fast (pre-commit) omits coverage gate since integration tests
  don't run there; full gate runs only in task check
- Drop two untestable fake-only tests (UID-validity reset, malformed envelope)
- Coverage threshold restored to 80% (84% with merged data)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 08:27:16 +02:00
Thomas GüttlerandClaude Sonnet 4.6 733da201ee fix: integration tests — sequential execution, IMAP timeouts, JMAP timeout
Root cause: flutter test ran all 3 integration test files in parallel
against the same Stalwart instance. Concurrent SMTP/IMAP from
email_repository_imap_test and concurrent_sync_test caused SMTP rate
limiting (4th send hung for ~27s) and flushPendingChanges race failures.

Fixes:
- stalwart-dev/test.sh: add --concurrency=1 so test files run serially
- concurrent_sync_test: reduce timeout 2 min → 30 s (tests now pass in ~2s)
- imap_client_factory + test helpers: set defaultResponseTimeout=20s on
  ImapClient so individual IMAP commands never block indefinitely
- jmap_client: reduce HTTP call timeout 30 s → 10 s (local server; keeps
  stacked-timeout total well below any reasonable per-test limit)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 06:29:49 +02:00
Thomas GüttlerandClaude Sonnet 4.6 33d1e21bc9 perf: cut integration-ui test time from 250s to 28s
- Fix HOME override that caused FVM to re-download 220MB Flutter SDK on
  every run; use XDG_DATA_HOME instead to isolate app data without
  touching HOME
- Switch DB path from getApplicationDocumentsDirectory() to
  getApplicationSupportDirectory() so XDG_DATA_HOME isolation works and
  stale accounts don't leak between test runs
- Replace fixed pump(5s/3s) waits with pumpUntil() polling at 200ms so
  tests stop waiting as soon as the UI is ready (23s of dead wait → 8s)
- Add timing instrumentation (ts() in shell, _log()/Stopwatch in Dart)
- Fix CI integration-ui job: was mixing subosito flutter with fvm flutter;
  now uses fvm consistently with actions/cache for ~/.fvm, ~/.pub-cache,
  and build/linux

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 13:25:16 +02:00
Thomas Güttler c7a121e386 stalwart-dev/integration_ui_test.sh working! great! 2026-04-18 12:05:20 +02:00
Thomas Güttler f0d3d9e6a2 task run show a window. Empty, but at least a window. 2026-04-17 22:20:10 +02:00
Thomas Güttler 9f94310bde clean up 2026-04-16 13:29:34 +02:00
Thomas Güttler 746f3c373c tests. 2026-04-16 11:48:37 +02:00
Thomas GüttlerandClaude Sonnet 4.6 0e2021f343 Fix integration tests: allow plain-text auth in Stalwart dev config
Stalwart 0.14 disables PLAIN/LOGIN on non-TLS ports by default:
- [imap.auth] allow-plain-text = true  → unblocks IMAP LOGIN
- [session.auth] mechanisms + allow-plain-text → advertises PLAIN/LOGIN on SMTP

Also fix test: SMTP authenticates as "alice" not "alice@localhost"
(Stalwart SMTP auth accepts username without domain, unlike IMAP login)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 10:08:05 +02:00
Thomas GüttlerandClaude Sonnet 4.6 da38948652 Fix dart→flutter test in integration script; add task build-android
- stalwart-dev/test.sh: dart test → flutter test (project requires Flutter SDK)
- Taskfile: add build-android task (flutter build apk --release)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 09:43:24 +02:00
Thomas GüttlerandClaude Sonnet 4.6 22db4a2dd6 Add Nix flake, .envrc, Taskfile, and Stalwart dev server
- flake.nix: Flutter 3.41.6, Android SDK, Stalwart, GTK3/build
  tools for Linux desktop, go-task
- .envrc: copied from sharedinbox — use flake + dotenv_if_exists
- Taskfile.yml: analyze, test, integration, codegen, run tasks
- stalwart-dev/: IMAP+SMTP dev server reused from sharedinbox
- test/integration/imap_sync_test.dart: login, list mailboxes,
  send via SMTP and receive via IMAP
- pubspec.yaml: add flutter_secure_storage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 07:40:34 +02:00