crossmate

A collaborative crossword app for iOS
Log | Files | Refs | LICENSE

commit c6073ccdf2e5365010503edf6095c641e6ca2344
parent d63d53b9e3d9eae6f6bb86604be2a2d8058d3576
Author: Michael Camilleri <[email protected]>
Date:   Sun, 17 May 2026 17:56:55 +0900

Fix misleading zone count

The private database's allRecordZones() always includes _defaultZone, which
knownZones never tracks. As a result, the trace logged a permanent server/known
off-by-one (e.g. server=24, known=23) even though the candidate filter
correctly excludes it and discovery was working. The trace now counts only
non-default server zones, so the figure matches what the filter actually
compares and a non-zero gap becomes a real signal.

Co-Authored-By: Claude Opus 4.7 <[email protected]>

Diffstat:
MCrossmate/Sync/SyncEngine.swift | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Crossmate/Sync/SyncEngine.swift b/Crossmate/Sync/SyncEngine.swift @@ -1056,9 +1056,16 @@ actor SyncEngine { } guard !candidates.isEmpty else { + // Count non-default server zones so the figure matches what the + // candidate filter actually compares: the private DB's + // allRecordZones() always includes _defaultZone, which knownZones + // never tracks, so a raw serverZones.count reads a permanent +1. + let serverNonDefault = serverZones.lazy + .filter { $0.zoneID != .default } + .count await trace( "\(label) zone discovery: nothing new " + - "(server=\(serverZones.count), known=\(known.count))" + "(server=\(serverNonDefault), known=\(known.count))" ) return 0 }