Repository navigation
feat(activesync): let backends set the per-item status of a failed change - #111
Merged
Merged
Conversation
…ange Connector_Importer::importMessageChange() reported every changeMessage() failure as Status 5 (server error), so a client resends an item the server will never accept on every Sync. Allow Driver_Base::changeMessage() to return ['error' => <Status>] in addition to false; the importer propagates the status into the importfailures list and still defaults to Status 5 for false. The core driver uses this to answer Status 6 (STATUS_INVALID) when the backend rejected the client's data (see horde/turba#73).
This was referenced Oct 26, 2026
🔍 CI ResultsOverall: ❌ 12/12 lanes failed TL;DR: ❌ Quality issues: PHP-CS-Fixer: 47 files. Summary by PHP Version
Quality Metrics
❌ Failed Lanesphp8.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
php8.6-dev
php8.6-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
Horde_ActiveSync_Driver_Base::changeMessage()may now return['error' => <Sync status>]in addition to a stat array orfalse.Horde_ActiveSync_Connector_Importer::importMessageChange()propagates that status into the per-item failure list instead of always reportingStatus 5.Part of horde/turba#73 (follow-up to #110, which stopped the same failure from aborting the whole Sync request).
Motivation
When a backend cannot store a client change because the data is invalid (a contact field over its configured length, for example), the importer reported
Status 5(server error). Clients treatStatus 5as transient and resend the item on every Sync.Status 6(STATUS_INVALID) tells the client to drop the change — but the driver API had no way to say which one applies.Changes
lib/Horde/ActiveSync/Driver/Base.php:changeMessage()docblock documents the return contract — stat array on success,falsefor a server error (retryable,Status 5),['error' => STATUS_*]for a backend-chosen status (STATUS_INVALIDfor rejected data).lib/Horde/ActiveSync/Connector/Importer.phpif (!$stat || !empty($stat['error']))→ status from$stat['error'], defaultSTATUS_SERVERERROR; log line includes the status; return[0 => $id ?: false, 'error' => $status]as before.&& empty($stat['error'])so an error array is not mistaken for a stat array.doc/architecture.md: one paragraph on the per-item status in the importer section.test/unit/Horde/ActiveSync/Connector/ImporterChangeStatusTest.php(new, 4 tests):false→STATUS_SERVERERROR;['error' => STATUS_INVALID]→STATUS_INVALIDfor ADD and MODIFY; stat array → success and change map updated.Compatibility
Existing drivers that return a stat array or
falseare unaffected.Request/Sync.phpalready encodesimportfailures[$id]per item, so no change there.Dependencies
Horde_Core_ActiveSync_DriverreturnSTATUS_INVALIDforHorde\Exception\InvalidDataThrowable; merge this PR first (or together).Test plan
ImporterChangeStatusTest(4 tests);test/unit/Horde/ActiveSync/Connector36 tests OKAppointmentTest/FindRequestTest/Rfc822Testfailures (reproduced on pristineFRAMEWORK_6_0), nothing newStatus 6for that item, device stops resending