feat(sync): evict ghost items via deferred synthetic deletions#90
Draft
TDannhauer wants to merge 1 commit into
Draft
feat(sync): evict ghost items via deferred synthetic deletions#90TDannhauer wants to merge 1 commit into
TDannhauer wants to merge 1 commit into
Conversation
A mail deleted through another vector (IMAP client, webmail) may leave a "ghost" item on a client that fails to apply the Remove command sent at deletion time; iOS Mail then retries the SYNC_FETCH for the vanished item forever. Detect this case (Fetch fails with NotFound and the uid is untracked in the folder state), record the uid in the folder state, and export a synthetic deletion through the regular change pipeline on a later GetChanges Sync. The eviction Remove is deliberately NOT emitted in the same response as the Fetch reply: iOS maild crashes (SIGABRT assertion loop) when a Sync response combines a Fetch reply with a Remove command for the same item.
🔍 CI ResultsOverall: ❌ 12/12 lanes failed TL;DR: ❌ Quality issues: PHPStan: 242 unique errors in 11 lanes; PHP-CS-Fixer: 25 files. Summary by PHP Version
Quality Metrics
❌ Failed Lanesphp8.0-dev
php8.0-stable
php8.1-dev
php8.1-stable
php8.2-dev
php8.2-stable
php8.3-dev
php8.3-stable
php8.4-dev
php8.4-stable
php8.5-dev
php8.5-stable
CI powered by horde-components • View full results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deleted server-side long ago and the client never applied the Remove.
pipeline (never in the Fetch response itself).
Motivation
When a mail is deleted via IMAP/webmail, the server sends a Remove once.
If the client fails to apply it (observed with iOS Mail), the client
retries SYNC_FETCH for the vanished item indefinitely; the diff engine
can never delete an untracked uid again, so the loop never ends.
Answering with Status 8 alone does not recover iOS.
An earlier variant that emitted the Remove in the same Sync response as
the Fetch reply reproducibly crashed iOS maild (SIGABRT parsing
assertion, crash loop with 20-minute throttling). Hence the deferred
design: record the ghost uid, deliver the Remove in a normal GetChanges
response — the shape every client already handles.
Changes
Exporter_Sync::fetchIds()records NotFound failures;getFailedFetchIds()exposes them.Request_Sync::_getGhostFetchIds()filters failures to uids untrackedin the folder state and records them via
State_Base::addGhostUids().Folder_Imappersists ghost uids (new optionalgkey, BC in bothdirections) with add/list/remove API.
State_Base::getChanges()injects synthetic CHANGE_TYPE_DELETEentries for recorded ghosts (also in PING mode, so the device is woken
to pick up the eviction); the uid is cleared once the deletion is
exported. Uids tracked again in state are dropped without eviction.
Expected exception types
No new catch blocks; existing
Horde_Exception_NotFoundhandling infetchIds()is reused.Test plan
serialization, ghost detection, state injection/clearing)
loop ended