On this page
Contributing
Run the tests
Run Go and documentation checks without contacting a live mailbox.
For first-run mailbox verification, follow Connect Your Assistant; this page covers contributor checks and synthetic regression tests.
Use Go 1.27.4, the toolchain requested by go.mod and used in CI. The module declares a Go 1.26.0 language version. For documentation checks, use Bun 1.4.2 as declared by docs/package.json. Keep mail credentials out of test fixtures and CI logs.
Go checks
From the repository root:
go mod tidy
gofmt -w .
go test -race -cover ./...
go vet ./...
go build ./...
go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./...
Review formatting, go.mod, and go.sum changes before committing. CI rejects uncommitted formatting or module-manifest changes, runs race tests, vet and build, and checks reachable known Go vulnerabilities. Review the logs for the exact commit under test.
Tests use local fixtures, fake transports, and injected dependencies where appropriate. CI also starts an ephemeral Redis container to test the actual atomic claim scripts and payload retention; these integration tests skip locally unless ANGELOS_TEST_REDIS_ADDR names a loopback fixture. MIME regressions cover byte-exact non-UTF-8 text attachments, unsupported and malformed transfer encodings, attached multipart isolation, and bounded parsing using synthetic messages. Unit-test success does not establish that a real provider, OAuth tenant, Redis service, or deployed MCP connection is configured correctly.
For an additional bounded MIME fuzz pass (seed cases also run in ordinary tests):
go test ./internal/mail -run '^$' -fuzz FuzzParseMessageAttachment -fuzztime=30s -parallel=2
Natural-composition fixtures also exercise TLS IMAP reads through signed OAuth/MCP calls, source headers longer than compact read output, reply-all routing and aliases, exact Message-ID case, text/HTML alternatives, byte-accurate EML and selected attachments, privacy, explicit-null rejection, and preparation without SMTP dispatch.
Status/search regressions cover signed OAuth principal isolation and challenges, read-only lookup with sending disabled, strict receipt projection, unchanged send retention, actual Redis GET-only status scripts and concurrent claims, exact-ID header verification and quotas, participant OR/AND semantics, sparse cursors, and no Seen mutation. Redis script/TTL tests require the configured ephemeral loopback fixture and are included in CI.
Gmail tests use synthetic Google-host TLS certificates and injected loopback transports, never real accounts or refresh grants. Coverage includes IMAP with/without SASL-IR, SMTP TLS/STARTTLS, exact XOAUTH2 payloads, challenge termination, no credential downgrade, verified TLS before credentials, token refresh expiry/cancellation/concurrency/response bounds/redaction, and generation-safe invalidation. Signed MCP fixtures verify duplicate-Sent rejection before claim, one SMTP dispatch without explicit Sent APPEND, deletion guards, localized LIST roles, native MOVE requirements, and preserved legacy-provider behavior.
Google initial-grant helper fixtures
Run python3 -m unittest discover -s scripts -p 'test_google_grant.py' -v for the local helper’s synthetic tests. They exercise S256 PKCE and state, one-time loopback callback/code exchange, pinned endpoints, response deadlines and limits, exact full-mail scope and expected-mailbox verification, secret-safe errors including Gmail API unavailable/denied, and exclusive private output. No real grant, API enablement, mailbox access, or live consent is performed. The helper’s Gmail API profile check is separate from the existing IMAP/SMTP runtime tests.
Microsoft Graph fixtures
Graph tests use synthetic HTTPS transports and mailbox data, never a real Microsoft account. They cover folder-tree discovery/create/rename, bounded raw MIME reads and attachments, structured drafts with Bcc/HTML/attachments, full draft retrieval beyond display truncation, rejection of semantic MIME changes while allowing explicitly inert Exchange transport metadata, filtered search and cursor integrity, native references, move/Seen changes, and exact prepared/send bytes with unknown outcomes after a lost response. Copy and Trash share the transfer implementation; synthetic coverage is not a separate live validation of each operation.
The initial-grant helper has separate synthetic tests for its command inputs, protected output paths, secure credential inputs, PKCE/state callback validation, pinned network origins, bounded timeouts, scope/identity checks, and secret-safe failures. Run python3 -m unittest discover -s scripts -p 'test_microsoft_grant.py' -v from the repository root; these tests do not perform real consent or provision credentials.
Keep the native-reference schema budget and existing IMAP fixtures intact when changing Graph. The durable token-store fixtures cover encryption and identity binding, tamper/wrong-key failures, concurrent/cold-start rotation, read/commit failures, timeouts and lost responses without OAuth retry, and partial loss of initialized state. An ephemeral Redis integration validates the Lua compare-and-set behavior and lack of automatic expiry; keep it enabled for the full release check. A passing fake Graph exchange does not prove Entra registration, owner/admin consent, Conditional Access eligibility, token lifecycle, or delivery in an actual tenant. Use the Microsoft reference for capability differences and the canonical setup guide for real-account connection acceptance.
Inbox workflow regressions
The inbox test suite covers the two new query routes through signed OAuth/MCP requests as well as bounded TLS IMAP fixtures. Check these behaviors when changing triage or conversation code:
- Read-only scope enforcement, compact/full rows, exact references and MODSEQ values, and rejection of unsupported fields before mailbox access
- Attention selection as
(unread OR flagged) AND other filters, explicit true/false flag constraints, forced triage attention, and page-only overlapping counts - Standard system flags retained after 100 custom keywords, so overflow cannot hide Seen/Flagged or alter page counts
- Default/max row limits, one bounded UID window, sparse and empty pages, both UID orders, frozen upper bounds, and compatibility with older non-attention cursors
- Exact case-sensitive Message-ID/References/In-Reply-To linkage to a fixed anchor seed, with no subject fallback or recursive expansion
- Bounded server-side header prefilter, conservative 64 KiB encoded-query cap, and exact local verification of candidates rather than substring acceptance
- Conversation cursor binding to operation, anchor, seed, order, and UIDVALIDITY; no reuse across search and conversation
- Malformed anchors/candidates, duplicate fields, bounded ID/header lengths, incomplete provider responses, missing/expunged messages, and failure without a successful partial parse
- Premature literal-drain race regressions in ordinary read, exact-ID search, and conversation paths, run under the race detector
- Selected-header PEEK, no body fetch during triage/conversation, no Seen change, and no mailbox mutation or SMTP dispatch
Use synthetic headers, bodies, and credentials. Passing fixture tests does not validate a real provider’s threading behavior or establish complete conversation coverage across folders. Current discovery cost must be measured from TestToolSchemaTokenBudget; the version 0.2 table in Migration and token budget is historical.
First-party OAuth fixtures
The internal/oauth fixtures use synthetic owner identities and ephemeral test keys. Virtual authenticators exercise passkey enrollment/sign-in, second-authenticator enrollment, challenge consumption, origin/RP ID, user verification, signature/counter rejection, CSRF, secure cookies, session expiry, and logout. These are protocol fixtures, not a real Touch ID or browser-device acceptance test.
The OAuth Redis integration tests use the same ANGELOS_TEST_REDIS_ADDR loopback fixture as dispatch tests. They cover concurrent one-time consumption across instances, state surviving a new store instance, owner/bootstrap CAS, TTLs, owner isolation, refresh rotation/replay, grant revocation/limits, and fail-closed ambiguous responses without automatic retries. They skip without the fixture. Keep the existing dispatch atomic-claim and receipt-retention suites in the same verification run.
Resource-server tests check local public keys and grant validation. MCP discovery tests check identical top-level and _meta security schemes, preservation of schemas/large integer values and result metadata, and concurrency without mutating registered tools. Conditional Sent filing requests all three needed scopes in its OAuth challenge before claiming or sending a prepared message; deployment-disabled errors remain separate. Read Connect Your Assistant for the owner setup and real assistant acceptance checklist; passing automated fixtures does not complete it.
An optional browser contract test uses Playwright, Chromium, and a CDP virtual authenticator to exercise the shipped JavaScript, cookies, consent redirect/CSP, sign-in, backup enrollment, and revocation. With Node able to resolve playwright and a compatible Chromium installed, run ANGELOS_BROWSER_TEST=1 go test ./internal/oauth -run '^TestBrowserChromiumVirtualAuthenticator$' -v. Set CHROMIUM_EXECUTABLE_PATH for a non-default Chromium installation, and NODE_PATH if Playwright is outside normal module resolution. All application requests are intercepted into a loopback fixture; unexpected origins are blocked. The test skips by default and is not part of the Go-only CI promise. A successful virtual-browser run still does not validate a real owner passkey or assistant account.
Documentation checks
Run the required commands serially:
cd docs
bun install --frozen-lockfile
bun run check
bun run build
The separate documentation CI job uses the same check-then-build order. See Improve the docs for the content structure.
Live validation
A live test is an operation against an actual account. Reading, changing flags, creating folders, saving drafts, moving messages, and sending mail have different effects; verify only the operations intended for that test account.
Begin with authentication and read-only checks from Connect Your Assistant. Test writes using disposable messages and folders. A successful SMTP transaction confirms server acceptance, not inbox delivery. Never repeat an uncertain send just to make a test appear successful.
When reporting verification, distinguish checks that passed, checks that failed, checks blocked by the environment, and live integration checks that have not been performed.
Agent batch and error fixtures
TestReadMany* uses exact-reference fake reads and signed MCP calls to verify input ordering, mixed stale/missing failures, 64-bit MODSEQ fidelity, UTF-8 JSON budgets, explicit continuation, invalid input rejection before backend access, and scope enforcement. TestReadManyWorkflowMetrics reports actual complete MCP result bytes and the five-to-one call comparison. TestToolSchemaTokenBudget limits structural definitions to 70% of the unchanged original 17-tool baseline plus a bounded 768-byte allowance for the three structured-draft actions. A separate allowance of at most 512 bytes covers only the duplicated top-level securitySchemes required alongside the legacy _meta mirror; the test also reports complete wire bytes, including that duplication. Classified error tests cover recovery codes, deployment gates, OAuth metadata, partial outcomes, and conservative mutation/unknown-outcome retry behavior. These tests do not exercise a live mailbox or verify delivery.