Skip to content

Latest commit

 

History

History
140 lines (113 loc) · 11.1 KB

TESTING.md

File metadata and controls

140 lines (113 loc) · 11.1 KB

Testing and acceptance boundaries

The user explicitly authorized host automated tests, screenshots, builds and interactive NkMail previews on 2026-11-02; reference projects remain untouched. NkMail has eight distinct suites. Enable them with -DNKMAIL_BUILD_TESTS=ON and run ctest --test-dir build --output-on-failure.

Suite Actual code exercised Deliberately isolated boundary
nkmail_i18n Real catalog loading, live QML/tray switching, system locale and saved language choice Temporary preference file; offscreen tray/menu
nkmail_translations Source extraction coverage, finished Chinese/English entries and placeholder integrity lupdate plus XML validation
nkmail_tray Window hide/restore, host loss, guarded quit Injected tray backend, offscreen window
nkmail_core SQLite migrations/cache/drafts, DTO serialization, incremental models Temporary databases; no keyring jobs or network
nkmail_controller Real facade/services, SQLite and message model; asynchronous dispatch and stale-result handling Injected transport regressions plus linked legacy synthetic protocol/credential boundaries; remote-image tests use a synthetic loopback HTTP fixture, never external hosts
loopback-protocol Real mailio adapter, patched TLS/IMAP/SMTP, MIME encoding/decoding Python services bound to loopback, generated test CA/certificates, synthetic credentials and .invalid recipients; no relay
nkmail_ui Real QML views and canonical Kos.Ui components, focus and editor interactions Behavioral controller mock; offscreen software rendering
nkmail_cli Actual application process, demo capture guard, private data directory, session-wide activation, demo relaunch and independent screenshots Private D-Bus session, fresh XDG directories, no configured account, synthetic demo

A controller mock or linked boundary replacement is not protocol acceptance. Conversely a passing protocol fixture does not prove that QML/controller workflows use it correctly; this is why the suites are separate.

UI release gate

Run python3 -m unittest discover -s tests/dependency -v for guard regressions, then python3 scripts/check_ui_dependency.py, in a Git checkout inside the VM. The guard verifies the staged gitlink, clean submodule, canonical URL and exact upstream commit. The pin must be the head or an ancestor of canonical upstream main; a commit present only on another branch is rejected. The user authorized SHA-only upgrades on 2026-11-11: no GitHub Release or tag is required. An optional tag must still resolve to the locked SHA. API/network failures must not be bypassed.

Guard tests create temporary Git fixtures under tmp/, mock network responses, and cover uninitialized submodules, dirty tracked/staged/untracked files, wrong URL or tracking branch, lock/gitlink/HEAD mismatches, commits absent from upstream main, annotated and lightweight tags, tag mismatches, malformed ancestry responses and API failures. They are separate from the existing CTest suites, not additional evidence of mail/provider or GPU compatibility.

The hosted release-gate job runs on all PRs to main and pushes to main, without path filters. It uses an ephemeral Arch container on Ubuntu, a SHA-pinned checkout Action, read-only token, no repository secrets and no build cache. It verifies the pinned commit and upstream-main membership, then configures a new Release build with tests enabled, checks that the cached UI source is the pinned submodule, requires all named suites and runs CTest. The container installs current Qt (at least 6.8), CMake (at least 3.30) and OpenSSL (at least 3.4, required by the existing expired-certificate fixture). Package versions are printed. Arch packages roll forward: a clean build is not a fully locked OS or a minimum-Qt-version matrix. Keyring packages satisfy QtKeychain installation dependencies; tests do not start a Secret Service or use real credentials. UI runs offscreen/software, not a GPU or standalone Demo acceptance check.

Main requires a PR and the successful Actions release-gate check with an up-to-date base, including administrators. Approval count is zero to support a single maintainer; review threads must be resolved, force pushes/deletion are disallowed. New component usage still needs loading/behavior coverage: CI cannot inspect another workspace or infer an intended but untested visual change. Published UI tags must not be moved; the guard detects when a tag no longer matches the locked SHA but does not configure upstream tag protection. Administrators can change branch policy, so this is an accident-prevention gate rather than protection against malicious maintainers.

Modularity regression coverage

  • Core: a second connection must not rewrite a live sending draft; explicit startup recovery preserves accepted/unknown states; flags update summary and cached body together; a draft ID cannot be overwritten through another account binding.
  • Controller/services: first online page establishes batch UIDVALIDITY; failed writes leave cache/view unchanged; a live accepted send survives sidebar probes; a cancelled delay never reaches SMTP; stale compose data cannot cross accounts; background credentials resolve using the correct profile/account key; rendered image caching survives reopening and is isolated across accounts.
  • Protocol: servers without UIDPLUS receive no COPY/STORE/EXPUNGE for delete/move; capable servers receive only UID EXPUNGE; a COPY followed by STORE failure reports partial completion without repeating COPY. All commands target the loopback fixture.
  • UI: sidebar/list/reader load without the shell's ID context; the shell exercises the extracted toolbar, focus, geometry, dialogs and search. QML warnings fail the suite.

Screenshots

./build/nkmail --demo --appearance=light --screenshot=tmp/inbox-light.png
./build/nkmail --demo --appearance=dark --review-scenario=details --screenshot=tmp/details-dark.png
./build/nkmail --demo --review-scenario=compose --screenshot=tmp/compose.png
./build/nkmail --demo --review-width=680 --review-height=760 --screenshot=tmp/narrow.png

Run these in a real graphical session for GPU/material review. The CLI suite's offscreen screenshot checks only isolation and PNG export, not final appearance. Review every image before copying it to docs/progress/. Screenshot export requires --demo, which always uses a fresh temporary mailbox and cannot send or change accounts.

Manual acceptance checklist

Use a disposable test data directory, not another mail application's profile.

  1. Empty account: configure manual TLS endpoints; password remains empty when reopening the dialog. New password accounts validate IMAP and SMTP authentication before saving; SMTP validation does not send mail. Refresh starts mailbox synchronization.
  2. Read: refresh folders and headers, paginate, choose an uncached message, save a selected attachment to a new destination. Reading must not change server Seen/flag state. Never use destructive test commands against real mailboxes.
  3. Offline: disconnect, restart, read previously cached content, search cached headers/body, paginate cached results. Uncached content must be labeled unavailable rather than replaced by another message.
  4. Drafts: create, auto-save, close/reopen, restart, add/remove attachments, reply/reply-all/forward, discard. Review generated recipients before any submission.
  5. SMTP: use the loopback fixture for acceptance/rejection/ambiguous-result tests. Do not submit to a real recipient without separate permission. Unknown must remain non-resendable; accepted is not delivered and does not imply a server Sent copy.
  6. Window: resize both column separators by pointer and keyboard, narrow/widen, check light/dark, reopen the same profile to restore geometry. Demo/review must not read or update real profile preferences.
  7. Credentials: only test live QtKeychain integration with explicit permission. Synthetic boundary tests verify controller behavior, not wallet availability. There is no insecure plaintext fallback.

Security limits

  • Cache, drafts and attachment files are local plaintext sensitive data, protected by filesystem permissions, not encryption at rest.
  • Credential keys are scoped to the canonical mailbox data directory. Moving a profile requires re-entering its password. The old preview's global default credential is not automatically read or migrated.
  • Network timeouts bound individual I/O, not an entire multi-message sync; thread shutdown waits for pending work.
  • MIME size/tree checks do not represent a full audit of the upstream parser.
  • Read-only provider verification is independent of local acceptance. Never publish real mailbox output, even after a successful private test.

Retained WebEngine surface regression

The reader keeps the WebEngine front-buffer texture when the render loop pauses, while retaining cleanup on scene-graph invalidation and delegate destruction. MailRenderLifecycle follows visual child/window changes without polling. It matches Qt's private delegate class identity, using public QObject disconnection; this is a narrowly scoped compatibility adapter, not an upstream Qt fix. The reviewed upstream connection is in Qt WebEngine v6.11.2.

The reader suite requires retainedSurface to become true on a real WebEngine view, preserves an isolated-world document marker and internal scroll across hide/minimize/restore, and checks reparenting to a different window. A Qt upgrade that changes the delegate identity or connection must be reviewed when this check fails. Normal document replacement and renderer security tests still apply.

The Xvfb suite does not prove Wayland compositor animation correctness. Pixel capture itself can schedule rendering and must not be used as proof that a passive restore has no black frame. The original failure and successful texture-lifetime comparison were confirmed by the user on native Wayland, threaded OpenGL/EGL, Intel Mesa; production-adapter acceptance on that setup is recorded separately.

Reusable IMAP read session

The protocol fixture exercises implicit TLS and STARTTLS with two distinct UIDs, including header-page-to-body reuse. It asserts one LOGIN for successful reuse, new authentication after account/password changes or explicit reset, one bounded reconnect after a closed connection, no repeated reconnect on a second failure, no automatic retry after protocol NO, rejection of changed UIDVALIDITY before body FETCH, and certificate verification after a trust-anchor change. Commands must remain EXAMINE/BODY.PEEK with no STORE/EXPUNGE/SELECT writes. Controller tests also require queued cleanup on disconnect and account switch.

The reuse timing fixture introduces a synthetic 150ms login delay and reports first/second read durations. Connection/login counts are the regression contract; wall-clock timings are illustrative and are not real-provider benchmarks. Idle cleanup runs on the same serialized worker, so an operation already in progress finishes before queued cleanup; reuse eligibility independently expires at 60s.