Skip to content

fastmail: Sync upstream and complete self-hosted support - #4

Merged
marcodejongh merged 3166 commits into
mainfrom
release/fastmail-selfhosted
Oct 4, 2026
Merged

marcodejongh merged 3166 commits into
mainfrom
release/fastmail-selfhosted

Conversation

@marcodejongh

@marcodejongh marcodejongh commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Complete Fastmail support for the current upstream mail interface and self-hosted deployments, including JMAP mail, durable synchronization, CalDAV calendars, and Authelia-only login. This PR also includes the existing upstream merge because the fork's main still points to the earlier Fastmail implementation.

  • Review scope: upstream sync is commit 406392d71; the Fastmail release implementation is commit 6a3282fac. Review fixes are in 01d26e739, and 3f9c41555 fixes CI selection for the large upstream import; compare the complete release changes to isolate the 126 release files from the large upstream import. Generic IMAP and native desktop/mobile certification remain out of scope.
  • Mail and recovery: complete provider operations, account-bound API-token reconnects, durable drafts and ambiguous-send handling; outbound SSE notifications plus five-minute polling, per-account leases, transactional cursor/intake storage, retry records, and application-managed sender filters. Remove obsolete Fastmail OAuth paths and the daemon's direct database dependency.
  • Calendars and deployment: CalDAV discovery, availability, recurrence, event changes and invitation responses with separate encrypted app passwords; Google-free Authelia configuration; PostgreSQL and SQLite migrations; Compose worker/cron/daemon services and fork-owned multi-architecture image publishing. See deployment and release checklist.
  • Validation: the initial implementation passed 843 relevant tests (614 web, 174 SQLite, 47 mail-core, 5 real PostgreSQL, 3 daemon; two existing scale tests skipped). App/package type checks, changed-file Biome checks, action exports, Compose validation, fresh/legacy SQLite upgrades, and PostgreSQL migrations passed. Native amd64 web/daemon images built; production-image migrations and Chromium startup/mock-OIDC PKCE checks passed, with form screenshots inspected. Review follow-up added two regression tests that failed before the fixes and now pass; all 175 SQLite tests (two existing scale skips), seven sync tests, SQLite types, and changed-file formatting pass. Chromium checks cover discovery loading, failure, failed retry and recovery on both connection screens; screenshots inspected. A file-backed changed-file list avoids Linux environment-size limits in browser CI; 44 selection/runner tests pass, and the full PR diff selects 63 specs in 17 batches. Local container builds predate the follow-up commits.
  • Release gates and operational cost: real Fastmail mail/CalDAV workflows, full Authelia login, and ARM64 execution remain unverified. Keep the worker, cron, and SSE daemon running. Sync adds durable database writes, one long-lived SSE connection per account, bounded JMAP requests and five-minute recovery polling; calendar availability adds CalDAV calls. Back up PostgreSQL before applying the additive migration and retain existing encryption keys.

elie222 and others added 30 commits September 15, 2026 22:38
Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* mail: Add slash snippets in compose

Users can save reusable replies and insert them from a draft by typing / or using the snippet toolbar button. Placeholders like {first_name} fill in from the first recipient.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Fix slash snippet types and keyboard handling

Import Range from TipTap core so the Next build type-checks, and forward the picker ref so arrow keys and Enter work in the slash menu.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Fix snippet form state types and picker keys

Close the save-snippet dialog with a complete form state so the Next build type-checks, and handle arrow/Enter keys in the toolbar picker.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Dismiss slash snippets on Escape without closing compose

Radix handles Escape in capture and preventDefault skipped ProseMirror, so the picker stayed open. Dismiss it from a window capture listener instead.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Assert composer stays open under the snippet modal

Escape already dismisses the slash picker. Opening Save snippet then
aria-hides New Message, so getByRole can no longer see the composer.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Drop duplicate slash copy from snippet dialogs

The shortcut field already shows /. Keep the recipient placeholder hint.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Name the snippet delete control for assistive tech

The trigger is icon-only, so screen readers need an explicit label.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

* mail: Identify snippets by shortcut and content

Drop the required name field. The picker and settings list both show
/shortcut plus a content preview. Recipients and subject can be added
later without changing this identity.

Co-authored-by: eliesteinbock <eliesteinbock@gmail.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* mail: Focus the To field when forwarding

Forwards start without a recipient, so keyboard and button forward should land on To instead of the message body.

Co-authored-by: Cursor <cursoragent@cursor.com>

* mail: Open the forward focus test by thread id

An earlier reply-and-mark-done test removes the conversation from the inbox list, so this coverage should load the thread directly.

Co-authored-by: Cursor <cursoragent@cursor.com>

* mail: Open the forward focus test from the Forward button

The F shortcut does not bind after opening a thread by URL, so the composer never appeared. Clicking Forward covers the same autofocus path.

Co-authored-by: Cursor <cursoragent@cursor.com>

* mail: Cover forward To-focus through the F shortcut

Keep the Forward button assertion, and add an F-key path while the conversation is still in the inbox.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the read-state toggle visible in the reader and list toolbars so users do not have to open the overflow menu.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…lie222#3717)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Queue service worker updates so rapid deploys replace the waiting worker and one reload applies the latest version.

Co-authored-by: Cursor <cursoragent@cursor.com>
)

Co-authored-by: Cursor <cursoragent@cursor.com>
…elie222#3723)

Email code sessions are rejected by every authorization endpoint, so the
consent page's client lookup also failed and rendered an error page instead
of the intended explanation.

- Skip the client lookup and render a sign-in-with-your-provider message
- Drop the unreachable disabled-button state from the consent component
- Cover the page branch and lock in that authorize and consent both refuse
  an email code session without recording a grant

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…222#3724)

Mailbox OAuth linking ran on any authenticated session, including the
restricted sessions created by opt-in email code sign-in. Because a linked
row is also the credential the auth layer accepts for provider sign-in, a
link or reconnect started from a restricted session could outlive it.

- Reject restricted sessions on the Google and Outlook linking auth-url
  routes, and again in both callbacks before any code is exchanged
- Centralize the rule in one place so all four routes stay in sync
- Surface the server's reason in the UI instead of a generic error
- Add regression tests for both providers on both halves of the flow

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…3725)

* mail: Align the advanced search panel with the search field

The panel anchored to the chevron button at the right end of the search
field, so it opened against the viewport edge instead of under the box.

- Anchor the popover to the whole search field with PopoverAnchor
- Add an emulated Playwright test asserting the panel's left alignment

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test: Match command palette rows by label instead of accessible name

Palette rows started rendering an optional description between the label
and the shortcut key, so exact accessible-name locators no longer matched
the two commands that carry one.

- Match the label element within the option so the locator survives
  description and shortcut changes

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
…3498)

Co-authored-by: Eliezer Steinbock <3090527+elie222@users.noreply.github.com>
…lie222#3731)

The documented build command never completed, so the sandbox image could
not be produced from a clean checkout.

- Copy the patches directory. pnpm hashes every patch named in the
  workspace file, including ones this filtered install never resolves,
  and aborts when the file is absent.
- Invoke the Playwright binary directly. `pnpm exec` treats the preceding
  filtered install as stale, then aborts because it cannot confirm
  removing the modules directory without a TTY.
- Install the coordinator with a local virtual store. The default links
  dependencies through the store under the home directory, which a
  service unit that protects it cannot follow.

Verified by building the image and running the sandbox on a host with
Docker and gVisor.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Barbara Dalavechia <barbara.martinazzo@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
* unsubscribe: Let the sandbox browser reach the broker

Every job failed. Two faults in the tunnel between the sandbox and the
coordinator, each found by running a job against a neutral page.

The broker refused an unauthenticated CONNECT outright. A client only
sends proxy credentials after it has been challenged, so the browser
never sent its token and the tunnel failed rather than retrying. Answer
the first attempt with a challenge instead, and keep refusing once
credentials are present but wrong.

The decision request pinned the broker address with a lookup that only
answered in the single-address form. Node asks for every address when it
selects an address family, and rejects that reply, so the runner could
not reach the decision endpoint. Answer both forms, as the web app's
pinned lookup already does.

Verified on a host with Docker and gVisor: a job against a neutral page
now returns needs_user, having loaded the page through the broker and
taken a model decision, where it previously failed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* unsubscribe: Cover the proxy challenge and accept any scheme casing

Addresses review feedback.

Authentication scheme names are case-insensitive, so a client sending
`basic` was challenged forever instead of being let through.

The challenge itself had no test: the existing case sends valid
credentials and only asserts the later refusal, so the status, the
challenge header and the connection close could all regress unnoticed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* unsubscribe: Cover a non-Basic proxy authorization header

A regression that stopped checking the scheme would still be refused
later, but through a different path and with no assertion on it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The image downloaded the browsers into the default cache, then moved
them to their final path in a later layer. Layers are additive, so the
downloaded copy stayed in the image alongside the moved one.

Setting the path before the install puts them in the right place once,
and folding the permission fix into the same layer avoids rewriting
several hundred megabytes of file metadata into another layer.

Image size drops from 4.15 GB to 3.17 GB with identical contents.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Elie Steinbock <elie222@users.noreply.github.com>
…age (elie222#3738)

* unsubscribe: Finish the unsubscribe instead of opening the sender's page

Clicking unsubscribe in the bulk list opened the sender's page in a new
tab and ran the automatic unsubscribe at the same time, so a reader who
had just been unsubscribed still had a page to deal with.

Unsubscribe in place when an automatic link exists, and only offer the
sender's page, from the failure toast, when the attempt does not
succeed. This is what the reader view already does.

Also prefer a web link over a mailto when choosing what to show the
reader. Both were previously picked by their order in the header, so a
sender listing a mailto first sent the reader to a draft email even
though a page was on offer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* unsubscribe: Keep the sender's page available on every failure

Addresses review feedback. The failure toast offered the sender's page,
but the two exception toasts did not, so a rejected attempt left the
reader with no way to finish.

The provider rate limit is raised by the unsubscribe call itself rather
than by the archiving that follows, so that branch has not unsubscribed
anyone either and offers the page as well.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* mail: Keep archived threads out of inbox splits

Archive overlay dropped after one stale list refetch, and custom splits did not filter INBOX, so archived mail could reappear.

Co-authored-by: Cursor <cursoragent@cursor.com>

* mail: Fix overlay reconcile typecheck against SWR mutate

Co-authored-by: Cursor <cursoragent@cursor.com>

* mail: Keep combined label archives overlaid until the list drops them

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
* Add local-first mail search with provider completion

* Strengthen live search navigation regression coverage

* Narrow local search date terms for type safety

* Register local search coverage with browser suite selection

* Preserve worker bootstrap URLs through offline caching

* Allow clearing mail search while typing

* Address local search freshness and result-state review findings
elie222 and others added 22 commits October 2, 2026 01:14
* chore: Upgrade development emulator to 0.12.0

* fix: Preserve emulator delta sync date filters
* dev: Add one-command local emulator startup

* dev: Declare PostgreSQL client types for launcher

* dev: Harden local launcher lifecycle and environment types

* dev: Make launcher lock acquisition atomic

* dev: Close connections to the launcher lock immediately

* dev: Keep launcher shutdown resilient to missing PID metadata
)

* fix(mail): limit browser sync to mail consumers

* fix(mail): activate sync for composers and retain queued work

* fix(mail): retain engine access for cleanup and draft restore
* mcp: Prepare tool metadata for Claude directory review

* mcp: Verify tool annotation titles over HTTP
…anges on web (elie222#3964)

* mail: Stop retrying rejected searches, drop deleted accounts, push changes on web

- Treat provider-rejected and non-retryable searches as unsupported so the
  local engine drops them instead of retrying forever
- Add retainAccounts so the engine purges local accounts that no longer
  belong to the user, including ones deleted on another device
- Follow the mailbox change stream on web while the tab is visible and sync
  on change or when the tab is shown again

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* mail: Catch up on stream reconnect, reopen closed streams, ignore empty account lists

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* admin: Allow granting premium before a user signs up

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* admin: Harden pending premium grant claiming

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* admin: Normalize pending grant email lookup consistently

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test: Cover whitespace in pending grant email lookup

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Eliezer Steinbock <3090527+elie222@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…links (elie222#3969)

* calendars: Searchable timezone picker with live offsets, wider mismatch prompt

- Replace the hard-coded timezone list (fixed offsets that drift with DST) with a searchable list of all IANA zones, labeled by city with the current offset and searchable by generic name
- Show the timezone mismatch prompt on the meeting briefs and meetings pages, not just calendars
- Track when the prompt is shown, accepted, or dismissed, and when a missing timezone is auto-set

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Address timezone review feedback

- Run the timezone check in every state of the briefs and meetings pages
- Record closing the mismatch prompt as a dismissal
- Capture auto-set only after the save succeeds, and try once per mount
- Keep the picker selection until refreshed data arrives
- Always list the detected browser timezone

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Use the account timezone for availability and fill it app-wide

- Availability hours and booking links now read the account timezone instead of a hidden copy stored on the schedule, so changing the timezone setting applies everywhere
- Migration copies the schedule timezone onto accounts that never saved one and makes the schedule column nullable; dropping it is a follow-up once no deployment reads it
- Fill a missing account timezone from the browser on any app page (owner only), since briefings, drafts and digests fall back to UTC without it
- The mismatch prompt no longer runs for non-owners viewing an account

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Validate timezones and keep the schedule column non-null

- Reject invalid timezones on save and fall back to UTC when reading one
- Skip browser timezones that can't be formatted (e.g. unknown zones)
- Retry the missing-timezone fill per account, not once per app load
- Close the mismatch prompt when the viewer isn't the owner
- Keep the deprecated schedule timezone column non-null with a UTC default so older deployments can still read it

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Only auto-fill a timezone that is still missing

- Auto-fill uses a conditional update, so it never overwrites a timezone saved elsewhere, and only reports auto-set when a row changed
- Retry the fill after a failed attempt
- Share the UTC fallback between account timezone reads and formatting

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Keep the missing-timezone fill on calendar pages

Moves the automatic fill back into the timezone detector on the Calendars, Meeting Briefs and Meetings pages instead of the app layout. It still only writes when no timezone is saved.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Clarify the timezone prompt and tighten the availability footer

- The timezone change prompt says updating also moves availability hours and the booking link
- The busy-times note sits on the same row as the availability Save button

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* calendars: Keep timezone validation out of the shared date utils

utils/date is imported almost everywhere, and pulling the scheduling package into it slowed cold imports enough to time out an unrelated test on CI. The account timezone helper now lives in utils/timezone, which only booking and calendar code import, and utils/date matches main again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…#3973)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…er (elie222#3971)

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
…3974)

* bulk-unsubscribe: Keep table header visible while scrolling

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ui: Move sticky table header styles into a TableHeader prop

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* bulk-unsubscribe: Only pin table header when the table fits its card

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore: drop revalidatePath calls that only refresh client-fetched pages

These actions are read through SWR, so revalidating did nothing except
re-render the page the action ran on. The rule delete one could also put
the old URL back after the form navigated away. Also remove an action with
no callers.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore: remove the Reply Zero page

Reply tracking now lives in the To Reply and Awaiting Reply labels and in
follow-up reminders, which are unchanged. Old page URLs redirect to the app.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Nothing links to the page or its API route. The Playwright case that used it
as a host for the email list panel is covered by the mail client case and the
EmailMessage unit test.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* ui: Load the action-required banner on the client

The banner read errors in the app layout on the server, so new errors only
appeared after a full reload and clearing them revalidated the whole layout.
Fetch them with SWR from a user route and update the cache after clearing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ui: Refetch error messages after clearing instead of assuming success

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* mail: Preview image and PDF attachments in the reader

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* mail: Address attachment preview review feedback

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* mail: Cap attachment preview size and close stale previews

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* Update tested integration revision

* Update tested integration revision
Merge upstream fbac6af while preserving the original Fastmail and Authelia work. Adapt account linking, provider contracts, polling context, and daemon schema to the current upstream APIs. Reject unfinished Fastmail operations explicitly and add compatibility regression coverage.

Validation: 7,930 web unit tests passed; subsequent focused regression tests passed; local build:ci, lint, structural checks, and daemon typecheck passed. Database migrations and live Fastmail integration were not run.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T03:38:07.695371Z 01d26e7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

DROP TABLE accounts;
ALTER TABLE accounts_fastmail RENAME TO accounts;

P1 Badge Rebuild derived indexes after replacing accounts

For any existing mailbox that has migrations 2 and 3 applied, dropping accounts executes the ON DELETE CASCADE actions on effective_role_conversations and effective_message_memberships; deferring foreign-key checks does not defer those cascade actions. The replacement account rows make foreign_key_check pass, but the later migration functions skip rebuilding because their migration IDs already exist, leaving existing conversations and mailbox memberships absent until each message is subsequently rewritten.


const baselineDate = account.fastmailSyncStartedAt ?? new Date();
if (!account.fastmailSyncStartedAt) {
// Existing accounts begin automation here; historical rules remain opt-in.
await prisma.emailAccount.update({
where: { id: emailAccountId, fastmailLeaseOwner: owner },
data: { fastmailSyncStartedAt: baselineDate },

P1 Badge Preserve the pre-upgrade Fastmail recovery boundary

When an existing Fastmail account has no fastmailSyncStartedAt, this sets its recovery boundary to the current time even though the account already has lastPolledAt and a pre-upgrade history cursor. If that cursor has expired on the first post-upgrade sync, the resync scans only mail received after this new timestamp and then advances to the current state, permanently skipping every message received between the last successful old poll and the upgrade; initialize migrated accounts from the prior polling boundary instead.



P2 Badge Keep account actions visible when provider discovery fails

If /api/user/mail-providers is still loading or fails, providers remains undefined and every conditional here evaluates false, so the accounts page offers no way to add Google, Microsoft, or Fastmail accounts; ConnectCalendar has the same failure mode with this endpoint. Render the async state with an error/retry or a safe fallback instead of silently removing all affordances.

AGENTS.md reference: AGENTS.md:L74-L76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@marcodejongh

Copy link
Copy Markdown
Owner Author

Addressed all three findings from @chatgpt-codex-connector[bot] in the review, following the completed review status. Fix commit: 01d26e739.

  • Preserve both populated derived SQLite indexes across the account-table replacement, including the immediate cascade effects. A real SQLite upgrade regression reproduces the previous data loss and now verifies both indexes survive repeated migration.
  • Initialize existing Fastmail accounts from their previous lastPolledAt when no automation boundary is stored, so expired-history recovery includes pre-upgrade arrivals. The new regression failed before this fix and passes now.
  • Show loading and error/retry states through LoadingContent for both mail and calendar provider discovery. Chromium verified failed discovery, a failed retry, and successful recovery through each retry button; screenshots inspected.

Validation: 175 SQLite tests passed (two existing scale tests skipped), seven synchronization tests passed, SQLite types and changed-file Biome checks passed. The PR description records the remaining live-account and ARM64 release gates.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01d26e7391

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1872 to +1875
attachments:
forwarded && !body.attachments
? await this.downloadAttachments(forwarded)
: body.attachments,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve original attachments on Fastmail forwards

When a user forwards a message from ComposeEmailForm, the form always serializes outgoing attachments as an array, including [], so this condition never falls back to downloadAttachments(forwarded). Fastmail forwards therefore silently omit all attachments from the original message, including when the user adds a new attachment; merge the downloaded original attachments with body.attachments whenever forwardedMessageId is present.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in follow-up PR #5 (4712340). Original regular and inline attachments are merged with newly added files before both new-draft and saved-draft sends. Six regression cases cover absent, empty, and nonempty attachment arrays; the relevant 64-test suite passes.

},
},
filter,
...(anchor ? { anchor, anchorOffset: 1 } : { position }),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restart local bootstrap when a pagination anchor disappears

If the message used as this anchor is deleted before the next bootstrap page is fetched, JMAP returns anchorNotFound. Recovery exists only in pollFastmailAccount; the browser mail engine reaches this method through source.enumerate, maps the error to paused, persists the same page token, and retries it indefinitely, leaving that mailbox bootstrap stuck. Translate this error into a scan reset or restart the page safely.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in follow-up PR #5 (4712340). Fastmail translates anchorNotFound into InvalidMailboxSyncCursorError so the shared browser source returns reset_required. Background recovery uses the same contract. The regression verifies reset, successful enumeration after restart, and preservation of pause behavior for transient failures; the relevant 64-test suite passes.

async createLabel(name: string, _description?: string): Promise<EmailLabel> {
async getMessage(messageId: string): Promise<ParsedMessage> {
const message = (await this.getMessagesBatch([messageId]))[0];
if (!message) throw new SafeError("Email not found");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Classify missing Fastmail messages as not found

When a Fastmail message disappears between enumeration and hydration, this SafeError carries no 404 status or provider-specific code. source.hydrate consequently cannot recognize it via isMissingProviderResource, reports the request as paused, and leaves the persisted hydration job to be reclaimed and retried indefinitely. Expose a recognizable not-found status/code or add Fastmail handling to the source adapter.

Useful? React with 👍 / 👎.

@marcodejongh
marcodejongh merged commit b3e2011 into main Oct 4, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants