Repository navigation
fix(recaps,sync): complete historical recovery and stuck-upload reconciliation - #21362
Conversation
Failure-Class: none
Failure-Class: FC-read-in-flight-across-delete-resurrects-row
|
Thanks @aryanorastar — reviewed this end to end against the current tree. This is a strong, cohesive completion of the recap-recovery path; a few notes below, nothing blocking. What I verified:
Minor, non-blocking:
No security, privacy, workflow, or dependency surfaces touched, and CI is green across the Dart, Android, and web lanes. Leaving for normal maintainer merge review — the cross-client state-consistency reasoning (read leases, WAL reconciliation) is the part worth a human's eyes before merge, and it reads correct to me. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Solid recap-recovery + WAL-reconciliation work with real test coverage, CI green, CLEAN merge state. Not merging: this bundles multiple feature-shaped additions (new historical-date recovery UI, new web recap caching, WAL reconciliation) across mobile+web in a single 1900+ line change, well above the scoped-diff bar for this area — treating as feature-shaped per policy's default-to-feature-when-unsure rule, so approve-only.
|
Verified this end to end against the current head — a few notes for the record:
Thanks for the thorough recovery story — the truthfulness fixes around sync status ("Processed" instead of inventing a conversation) are a nice touch. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
@aryanorastar this conflicts with |
…ery-completeness Resolve conflicts with main's duration-based sync progress, consolidated storage group and shared recap events: keep the PR's needs-attention sync state and retention subtitle, move recovery onto announceRecapArrived (dropping the PR's private DailyRecapUpdates notifier), and update the recap docs and sync/recap tests to match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Pushed a1e0c34: merged current main. It conflicted in three app files, now resolved.
|
|
Re-verified on the new merged head a1e0c34 (merge of current main + conflict resolution). Everything substantive from my earlier reviews still holds on this tree, and the new bits check out:
Note for whoever merges: @kodjima33's approval attaches to 04dda1a, before this merge — the only movement since is the main merge plus the notifier/stream swap described above, which reads as an improvement, but the approval technically predates this head. No dependency, workflow, or backend surfaces touched. Fine from my side for maintainer merge on this head. by AI on behalf of David — if you need David's attention, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
aryanorastar trusted contributor but 2095-line bundle adds entirely new UI surfaces alongside claimed fix - fails scoped-diff criterion, feature-shaped. Approve only.
The orphan-upload recovery loop iterated _wals.where(...) and awaited _localFileExists inside the live iteration, so addExternalWal admitting a recording mid-pass threw ConcurrentModificationError and stalled recovery. Walk a snapshot instead, and after every await re-read the row: it must still belong to this sync and still be uploaded under the same job handle, so a row an upload re-claimed, retention released, or another path finished is never overwritten. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Pushed 8e53eb6: orphan-upload reconciliation no longer crashes when a recording arrives mid-pass, and it re-reads rows before moving them.
|
…io (#21829) ## What changed and why Bound a ring-buffer download that becomes silent after READ_BEGIN or DATA. The initial five-second timeout was cancelled on BEGIN, leaving only a 30-minute overall deadline. A connected, stalled read therefore kept the transfer owner busy instead of yielding to normal capture/retry orchestration. - Reset a 15-second idle deadline on the first valid BEGIN and nonempty DATA, matching the existing legacy SD idle bound. Repeated BEGIN, empty DATA and control chatter are not progress. - Observe arrival before queued custody/disk work. On timeout, stop admitting notifications, send STOP on the original connection epoch, drain already received bytes and flush complete records through the existing durable WAL owner. Do not acknowledge an unfinished source or advance an unproven frontier. - Cancel idle timers on completion/error and put read-command failures through the same cleanup. A valid DONE arrival cancels the radio idle deadline even while its validation waits behind custody I/O. Healthy DONE and existing custody capability gates remain. - Make the ring custody fixtures wait for read/status admission rather than fixed startup sleeps, keeping the original durable-advance assertions. - Preserve the saved cause, original stack and phase when a read-command failure goes through cleanup; keep catch-and-continue behavior. Related: #21279 (uploaded jobs queued/429), #21387 (merged polling backoff), #21319 (merged short-WAL batching), #21755 (merged backfill dispatcher-owner repair), #21823 (merged batch-worker quarantine), and #21362 (retained-upload recovery). These are separate stages. This PR does not close the customer case or assert that the reported 1.4 KB/s, capture interruption, cloud worker state or missing recaps share this cause. No firmware version or diagnostic export was supplied for the Discord 0/127 report, and no production repair, storage deletion or deployment is performed. Why isn't this a shared primitive instead? The existing ring reader already owns read admission, STOP, notification ordering, durable flush and frontier validation. Its watchdog belongs inside that owner, not in a parallel recovery actor. The injectable timer tests the real owner without waiting 15 seconds. ## Product invariants affected - INV-CAP-1 — complete received records still use existing durable file/index registration. Timeout leaves the source pending and sends no unproven advance. Legacy firmware may reclaim on BLE delivery before app durability; this does not repair or conceal that existing risk or promise recovery of incomplete records. ## Verification - Production ring-owner regression: 14 tests passed, including idle BEGIN, partial audio, ignored chatter, cancelled deadlines, healthy DONE and bytes queued behind a deliberately blocked custody check, with and without DONE. - Capture interruption/reconnect journey (`mobile-verify fast --paths app/lib/services/wals/ring_storage_sync.dart`): 3 checks passed, no skips. - Full app analyzer ratchet: passed. `make preflight`: 25 checks passed. - Broader ring/custody/capture regression suites: all 129 passed on the final code, including the diagnostic guard and the 14 ring-owner tests above. - Diagnostic guard: confirmed red without the transfer failure's saved error, then green with its original stack, cause and phase preserved. Changed-file analyzer: no issues found. - Physical BLE throughput, microphone behavior, customer-account processing and released-app retest: not performed; require hardware/account evidence. Architecture and implementation/release checklist: `app/docs/offline-sync-stall-recovery.md`. The listen/pusher pipeline map is updated. This needs a mobile release after merge, not a backend deployment. ## UI evidence UI-Evidence: none -- transfer lifecycle only; no UI, copy or layout changes ## Failure class Failure-Class: FC-sync-failure-records-drop-cause
What changed and why
Daily Recap recovery was unreachable on mobile/web, and successful recovery could still disappear behind an older read or remain hidden on Home. Offline Sync also left restored uploads without a job handle permanently processing and overstated what successful processing proved. Complete the recovery path and reconcile these remaining sync/reporting gaps. Fixes #11821; remaining customer-account outcomes are tracked by #21360.
POST /v1/users/daily-summariesauthority. No push token or enabled schedule is needed; source recordings and existing recaps are preserved.Product invariants affected
INV-CAP-1 — retained recordings stay intact through orphan-job recovery. Requeueing preserves audio and retry budget; missing-file outcomes remain visible rather than being acknowledged as synced. No deletion or retention policy changes.
How it was verified
bash app/test.sh: full hermetic suite passed, 5,368 passed / 21 skipped. Analyzer ratchet passed; existing informational diagnostics remain within baseline.CAPTURE_EVIDENCE_V1_DARK_WRITE=true: 146 passed.make mobile-verify ARGS='fast --paths app/lib/pages/home/widgets/home_daily_recaps.dart app/lib/pages/conversations/sync_page.dart app/lib/pages/conversations/auto_sync_page.dart app/lib/services/wals/local_wal_sync.dart': 23 existing relevant journeys passed. These are the seeded journey lane, separate from the new focused recovery tests.bun run check: typecheck, Moonshine smoke, and the full current web suite passed: 127 files / 682 tests. The final recap lifecycle file passed all 8 tests.Tests
daily_summary_creation_test.dartandapiDailyRecaps.test.ts: endpoint/date/response identity, malformed/legacy replies and status failures.daily_recap_recovery_action_test.dartandGenerateRecapAction.test.tsx: date selection, cancellation, single flight and honest failures.home_recap_recovery_test.dart: successful recovery from another screen reveals Home, older responses cannot hide it, and failed reads retry.useRecapsCreation.test.ts: ownership, creation vs initial read, reads both before and during deletion, malformed-response retry, stable identity, chronological pagination and raw server offsets.ConversationSplitView.test.tsxverifies the user-facing read-error retry.local_wal_sync_test.dartcovers missing/empty/whitespace handles, durable retry state, preserved bytes, unavailable audio, and the whole retained-file upload/poll lifecycle.sync_completion_truth_test.dartandsync_row_recovery_window_test.dartexecute the actual sync screens/rows and prevent false completion, conversation and cloud-copy claims.Release and customer verification
The October scheduler/gateway/retry fixes (#21020, #21304, #21310) are already on current main. Production notifications deployments for #21304 and #21310 succeeded on October 12. They restore the known generation failures and remain required context for this report.
This PR needs merge, a mobile release containing these changes, and web deployment. It uses existing backend contracts; no new backend deployment is required by this PR. macOS already uses the shared creation endpoint.
The remaining customer-account checks are operational verification, not an assertion that the client PR restored customer data: confirm scheduled recaps resumed, generate/check each missing eligible date from retained server conversations, and confirm every reported recording reached processing completion on the customer's installed release. The feedback lacks a platform/version/exact sync error; do not claim the orphan-job fix is its proven cause.
#21347 remains open for malformed stored recap read validation; #21319 remains open for pendant upload batching, and #21216 tracks capacity/backlog complaints. Their causes are not established for this customer. Do not duplicate those fixes or claim those separate symptoms solved by this PR. Keep #21360/Featurebase open until the account outcome is verified.
Local preflight passed all 27 checks. Architecture and implementation/release checklist:
app/docs/recap-recovery.md.UI evidence
Synthetic inventories; screenshots contain no customer data.
Failure class (fixes)
Failure-Class: FC-read-in-flight-across-delete-resurrects-row
The existing class covers stale list adoption across a committed mutation. The shared recap read owner fences both deletion and recovery; controllable-future tests cover reads admitted before and during deletion. The orphan-upload and missing-control changes are separate concrete gaps, guarded by their service/UI regression tests.
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2690 -> 2728 | Keep orphan-job reconciliation, snapshot iteration, post-await row revalidation, persistence and session fencing inside the existing WAL lifecycle owner rather than splitting mutation authority.