Add diagnostic logs for total pages not updating investigation

Add RDEPUBBackgroundTrace.log at key decision points in the
reconciliation pipeline to trace why pageMap updates get rejected:

1. refreshBookPageMapInPlace — logs when a full pageMap update is enqueued
2. evaluateTakeover — logs when keepCurrentWindow is returned due to:
   - jumpSession coverage ratio < 0.8
   - adjacent coverage missing (hasPrev/hasNext)
   - renderSignature mismatch
3. evaluateFullPageMapTakeover — logs when keepCurrentWindow is returned due to:
   - currentSpineIndex not in candidate chapters
   - adjacent coverage missing
4. commitPendingPageMapUpdate — logs when keepCurrentWindow decision is
   applied and pending update is removed from queue

Also fix unused variable warning for currentPageNumber in extendPartial case.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-06-25 18:57:16 +08:00
co-authored by Claude
parent 15b15d0e11
commit b8aa10c535
2 changed files with 29 additions and 1 deletions
@@ -56,6 +56,10 @@ final class RDEPUBPresentationRuntime {
func refreshBookPageMapInPlace(_ bookPageMap: RDEPUBBookPageMap) {
navigationStateMachine.transition(to: .reconcilingFullMap)
RDEPUBBackgroundTrace.log(
"Reconciliation",
"refreshBookPageMapInPlace: enqueued reconcileFullMap chapters=\(bookPageMap.totalChapters) pages=\(bookPageMap.totalPages)"
)
enqueuePendingPageMapUpdate(
RDEPUBPendingPageMapUpdate(
pageMap: bookPageMap,
@@ -225,6 +229,10 @@ final class RDEPUBPresentationRuntime {
switch decision {
case .keepCurrentWindow:
RDEPUBBackgroundTrace.log(
"Reconciliation",
"commitPendingPageMapUpdate: keepCurrentWindow — removed pending update, totalPages=\(update.pageMap.totalPages)"
)
removePendingPageMapUpdate(at: index)
return false
@@ -238,7 +246,7 @@ final class RDEPUBPresentationRuntime {
return false
}
case .extendPartial(let currentPageNumber, let currentLocation):
case .extendPartial(_, let currentLocation):
removePendingPageMapUpdate(at: index)
applyPageMapToLiveModel(update.pageMap, source: update.source)
if let currentLocation,