Skip to content

feat(app): show each Offline Sync recording as one row, not one per file - #20874

Merged
aryanorastar merged 5 commits into
BasedHardware:mainfrom
aryanorastar:feat/offline-sync-recording-blocks
Oct 11, 2026
Merged

aryanorastar merged 5 commits into
BasedHardware:mainfrom
aryanorastar:feat/offline-sync-recording-blocks

Conversation

@aryanorastar

@aryanorastar aryanorastar commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What changed and why

What a customer sees today. Open Offline Sync and one afternoon of recording is a wall of near-identical rows: 1m 15s, 1m 13s, 9s, 29s, 3m, 3m, 3m… Ten rows from the same afternoon each say "Too old to sync", each with its own Delete button. A real user's history is thousands of these. Someone who doesn't know how capture works reads it as a broken app, not as backup files.

Why it looks like that. Each row is a backup file, not a recording. Capture writes a phone file every 75 s (chunkSizeInSeconds + newFrameSyncDelaySeconds), and the pendant handed storage over in fixed chunks (sdcardChunkSizeSecs, 180 s until it became 60 s). Nothing joined them back together for display.

What this PR does. Offline Sync (AutoSyncPage) now shows one row per recording:

  • Grouping: files from the same device and place (on the device vs on the phone) join when the gap between them is at most 120 s, the backend's default conversation_timeout. A pause short enough not to end a conversation doesn't end a recording either. Each device and place keeps its own open recording, because their files interleave in the newest-first list (the same audio on phone and device, or two devices recording at once).
  • The row: start time, total length, and the status of its most serious file (failed > rejected > unreadable > too old > retrying > backing up > waiting > processing > synced). A recording is never shown healthier than its worst part.
  • One action for the recording: Try again re-sends the files that failed. Delete (only when nothing can move the recording forward) removes all its files after one confirmation.
  • Tap a recording to open a sheet titled with that recording, listing its files with the existing rows, detail page and actions, so nothing is lost for debugging.
  • A one-file recording keeps today's row exactly, including swipe-to-delete.

No new strings: the row and sheet title reuse the existing date, time and duration formatting, and the statuses reuse the existing labels.

Before / after

Same synthetic history (shaped on a customer's real Offline Sync) rendered by app/scripts/visual_audit.sh on main and on this branch: six 75 s files today, ten 3 min files too old to sync, twelve 9 s–75 s synced files, and fourteen 3 min synced files.

Before (main), 42 rows across three screens
After (this branch), 4 rows Tap a recording

In the running app (iOS Simulator, iPhone 16 Pro, iOS 26.5, local emulator backend, 43 seeded files):

Offline Sync, All One recording's files

Product invariants affected

none

How it was verified

  • Running app, iOS Simulator: I seeded 43 files into the app's real recording store (wals.json + placeholder audio, via WalFileManager.saveWals over the VM service) and hot-restarted so the real load path picked them up. Offline Sync showed 5 rows (the lone 40 s recording stays a plain single row).
    • Tapping the 12:56 PM recording opened its 12 files; tapping a file opened its Recording Details page.
    • Delete on the "too old" recording, after one confirmation, removed all 10 files from wals.json (43 → 33) and their audio files from disk (43 → 33), and the "10 recordings need attention" card cleared.
  • Visual audit: app/scripts/visual_audit.sh --base origin/main --head HEAD --only conversations-offline-sync-history,conversations-offline-sync-recording-files (images above). The files scenario fails on main by design, since there is no recording row to tap there.
  • Not covered: the legacy SyncPage (devices without multi-file sync) still lists one row per file. It has the same clutter, and I left it out to keep this change reviewable. Happy to follow up with the same grouping there.
  • Overlap: feat(app): v2 cleaner UX 4/9 — Offline Sync in grouped lists by day #20715 restyles this page (grouped by day, still one row per file). The grouping lives in its own file (recording_blocks.dart) and the page change is small, so whichever lands second merges simply.

Tests

  • test/pages/conversations/recording_blocks_test.dart: back-to-back 75 s files make one recording; 3 min chunks join and a pause longer than the gap splits; a different device, or the device copy of phone audio, never merges; interleaved phone/device copies and two devices recording at once each group into their own recording (2 rows, not 4); a recording reports its most serious file.
  • test/pages/conversations/offline_sync_recording_blocks_test.dart (page level): ten too-old files render as one row with one Delete; that Delete removes all ten; tapping a recording lists its files. All three fail with grouping switched off (checked by replacing the grouping with one block per file).
  • Severity is an exhaustive switch, so a new sync state cannot compile without a rank.
  • New visual-audit scenarios conversations-offline-sync-history and conversations-offline-sync-recording-files pass test/visual_audit/visual_audit_smoke_test.dart (113 scenarios).
  • 128 tests across the 11 related suites passed; app/scripts/analyze_ratchet.sh passed.

Failure class (fixes)

Failure-Class: none

Review in cubic

aryanorastar and others added 2 commits October 7, 2026 07:56
Capture backs audio up every 75 s and the pendant hands storage over in
fixed chunks, so Offline Sync listed one continuous recording as dozens of
identical 1-3 minute rows, and an afternoon the server refused as too old
was ten rows with ten Delete buttons.

Consecutive files from the same device and place (on the device vs on the
phone) with gaps up to 120 s, the backend's default conversation_timeout,
now read as one recording: start, total length and the status of its most
serious file. Its one action covers the recording (Try again re-sends the
failed files, Delete removes a recording nothing can move forward); tapping
it lists the files, each with its own row, detail page and actions. A
one-file recording keeps today's swipe-to-delete row.

Adds a visual-audit scenario built from a customer's history for the
before/after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aryanorastar
aryanorastar marked this pull request as ready for review October 7, 2026 02:56
@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed the full diff — all six files. This is a careful, display-only change with real test coverage. Notes per file:

  • app/lib/pages/conversations/recording_blocks.dart (new): the grouping predicate is sound — same device, same storage side (_onDevice partitions sdcard/flashPage vs phone disk, so the device copy of phone audio never merges with the phone copy), overlap-tolerant gap check (next.timerStart - (wal.timerStart + wal.seconds) <= 120), and an out-of-order guard (wal.timerStart <= next.timerStart). _rank being an exhaustive switch over all 10 WalSyncDisplayState values is a nice touch: a future state fails compilation instead of silently reading as healthiest. seconds as max-end minus oldest start (wall-clock span) is the right meaning for "how long was I recording".
  • app/lib/pages/conversations/auto_sync_page.dart: single-file blocks keep the exact prior row including swipe-to-delete; multi-file rows get Try again (re-sends only failed/retrying files) or Delete (only when every file is unsyncable) with the same destructive confirmation, and mixed/healthy blocks open the file sheet. _showBlockFiles rebuilds from the live provider via ListenableBuilder, so deletions inside the sheet propagate. _rowLabel is a faithful extraction of the previous inline waiting+on-device phase-label logic — no behavior change there. Shared row styles/divider keep file and recording rows from drifting.
  • app/test/pages/conversations/recording_blocks_test.dart (new): covers the core contract — back-to-back 75 s files → one block, 3-minute chunks join / >120 s pause splits, different device or storage side never merges, and the representative is the worst piece.
  • app/test/pages/conversations/offline_sync_recording_blocks_test.dart (new): good widget-level coverage — ten too-old files render as one row with one Delete, confirming removes all ten, tapping a synced recording lists its files.
  • app/integration_test/visual_audit/scenarios/conversations.dart: the _HistorySyncProvider history (75 s phone files, 3 min pendant chunks, mixed statuses) is a realistic stand-in for the customer case; the two scenarios exercise both the grouped list and the opened sheet.
  • app/changelog/unreleased/20261007-offline-sync-recording-blocks.json: accurate one-liner.

Two observations, neither blocking:

  1. The 120 s gap matches the backend default conversation_timeout (backend/routers/listen/contracts.py:74), and the doc comment says so — but it's a client-side copy of a backend default, not a shared constant. Fine for a display heuristic; just worth remembering if the backend default ever moves.
  2. On this head the app CI lanes (Dart Analyze & Tests, Android JVM Unit Tests, Android Compile Smoke) are all skipped, so the new tests haven't run in CI here. Could you re-run the app checks (or push any update that retriggers them) so the two new test files get a green run before merge?

No new l10n keys, no sync/auth/protocol changes, all mutations go through existing SyncProvider APIs. Leaving for human maintainer review — the product semantics (120 s grouping gap, worst-file status representation, whole-recording delete) deserve a maintainer sign-off before this lands.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added flutter flutter work needs-maintainer-review Needs a human maintainer to sign off before merge labels Oct 7, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile feature (Offline Sync recording-grouping UX), not a bug fix — per policy approve-only for mobile/community features (no 4/5 confidence gate applies since it's not a bug/issue fix). CI clean, no abuse signal, well-tested with before/after visual evidence. needs-maintainer-review label present so left for Nik's own merge call.

@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up to my earlier review of this head: @kodjima33's approval covers the product-semantics sign-off I asked for (120 s grouping gap, worst-file status, whole-recording delete), so I've removed needs-maintainer-review.

The one outstanding item from that review still stands: the app CI lanes are skipped on this head, so the two new test files (recording_blocks_test.dart, offline_sync_recording_blocks_test.dart) haven't had a green run. Please retrigger the app checks (or push any update that does) before merge.


AI-generated maintainer feedback on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level removed the needs-maintainer-review Needs a human maintainer to sign off before merge label Oct 8, 2026
@aryanorastar

Copy link
Copy Markdown
Collaborator Author

Pushed 8a4af49f:

  • Merged main (clean; the PR still changes the same 6 files).
  • Tracked the before/after screenshots under .agent-artifacts/ui-evidence/20874/ with evidence.json, and pointed the PR body at them, for the new ui-evidence check. scripts/pr-preflight passes locally (23 checks).
  • This push also re-runs the app checks, so the two new test files get a CI run.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified on the current head (8a4af49): since the approval on 6236c6d, the branch only picked up a merge of current main plus the UI-evidence artifacts under .agent-artifacts/ui-evidence/20874/ — no feature-code changes, and the manifest's source values pass the evidence contract.

Re-checked the substance of the change: recording_blocks.dart joins files into one recording only when they share a device, sit in the same place (on-device vs on-phone), and sit within the 120 s gap; the exhaustive severity switch means a future WalSyncDisplayState cannot compile without an explicit rank, so a recording can't silently read healthier than its worst part. auto_sync_page.dart keeps single-file rows exactly as before (including swipe-to-delete), gives multi-file recordings one confirmed Delete that removes all files (widget test asserts all 10 go), and the files sheet re-reads from the provider so it stays live. The unit and widget tests cover the grouping edge cases (back-to-back 75 s, 3 min chunks, gap split, different device/storage, worst-state representative).

One small observation, non-blocking: _buildRecordingsHeader takes a total parameter it no longer uses (auto_sync_page.dart:431) — fine to drop whenever the file is next touched.

The evidence-only delta since the approval is safe from my side; the merge call stays with a human maintainer.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

Files were compared only with the last block, so phone and device copies of
the same recording, or two devices recording at once, alternated in the
newest-first list and each file started a new row (4 rows instead of 2).
Keep one open block per device and location so interleaved files still join
their own recording. Drop the unused header count parameter.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aryanorastar

Copy link
Copy Markdown
Collaborator Author

Pushed 54f2b88: a grouping fix for interleaved files.

  • Bug: groupRecordingBlocks compared each file only with the last block. The same audio can exist on the phone and on the device, and two devices can record at once, so in the newest-first list their files alternate and every file started a new row. Two copies of one recording showed as 4 rows instead of 2.
  • Fix: each (device, place) pair keeps its own open recording, and a file joins the open recording for its own pair under the same 120 s gap rule. Rows still appear in newest-first order.
  • Regression tests in recording_blocks_test.dart: interleaved phone/device copies give 2 recordings of 2 files, and two devices recording at once give 2 recordings of 3 files. Both failed before the fix.
  • Also dropped the unused total parameter from _buildRecordingsHeader, from the earlier review.
  • Checks: the test/pages/conversations/ suite passes (30 tests). flutter analyze and dart format are clean on the changed files. The PR description's grouping and test lines are updated.

I did not re-run the simulator for this change: it only affects grouping logic, which the unit tests cover.

@Git-on-my-level Git-on-my-level added the positive-signal Automation verified a genuine fix/quality contribution label Oct 10, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Follow-up on the new head (54f2b88): the unused total parameter I flagged earlier is gone (_buildRecordingsHeader() now takes none), and this commit reworked the grouping to keep one open block per (device, on-device vs on-phone) — which is the right fix for interleaved newest-first lists, since phone and device copies of the same audio (or two devices recording at once) would otherwise chain into one block. The new tests in recording_blocks_test.dart cover exactly those interleavings, plus the gap boundary (a pause of exactly recordingBlockGapSeconds joins, one second more splits) and the worst-piece representative picking the exhausted-retry file.

Re-walked the row behavior in auto_sync_page.dart at this head: single-file blocks still keep the exact swipe-to-delete row; multi-file blocks get one Try again (re-sends only failed/retrying files), a Delete only when every file is terminal (_isUnsyncableState, with failed deliberately keeping its retry), and a files sheet that re-reads displaySortedWals through a ListenableBuilder, so deletions inside it propagate. offline_sync_recording_blocks_test.dart pumps the real AutoSyncPage and asserts the ten-too-old-files case end to end: one 30 m row, one Delete, all 10 files removed, tap lists the pieces. The 120 s gap stays anchored to the backend default (conversation_timeout: int = 120, backend/routers/transcribe.py:86), and the exhaustive severity switch still forces any new WalSyncDisplayState to carry an explicit rank.

No concerns with the grouping rework; positive signal. The human approval (kodjima33, Oct 7) predates this commit, so the merge call stays with a maintainer who has seen the interleaved-grouping behavior. (AI-generated feedback on behalf of the maintainers.)


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile Flutter UX feature (Offline Sync one-row-per-recording grouping) — feature not bug fix, approve-only per area policy; CI clean, re-confirmed on new commits.

@Git-on-my-level

Copy link
Copy Markdown
Member

Reviewed all 14 changed files against the merge base. This is a clean, cohesive fix for a real UX problem — one afternoon of recording reading as dozens of identical 1–3 min rows.

What I verified:

  • app/lib/pages/conversations/recording_blocks.dart — groupRecordingBlocks() keys open blocks on (device, on-device?) so interleaved phone/device copies and two simultaneous devices group separately, and joins files within a 120 s gap. Grouping is read-only over the WAL list. The worst-state representative uses an exhaustive switch over WalSyncDisplayState, so a future state can't silently read as healthiest — nice touch.
  • app/lib/pages/conversations/auto_sync_page.dart — one-file recordings keep the exact previous swipe-to-delete Dismissible path; multi-file rows expose a single action (Try again re-syncs only failed/retrying wals; Delete appears only when every file is terminal-unsyncable, one confirmation, then deletes all files). The per-recording sheet reuses _walRow and listens to the page's SyncProvider, so rows can't drift and state updates propagate.
  • Tests: recording_blocks_test.dart covers the back-to-back join, the >120 s split, interleaved phone/device and two-device grouping, and representative selection; offline_sync_recording_blocks_test.dart covers one-row rendering of ten too-old files, Delete removing all 10 wals, and the files sheet. All hermetic.
  • app/integration_test/visual_audit/scenarios/conversations.dart seeds a realistic history (75 s upload run, ten too-old 3 min files, ragged synced runs) and adds two scenarios; changelog fragment and .agent-artifacts/ui-evidence/20874/ evidence are in order.

Two non-blocking notes:

  1. _confirmDeleteWals awaits deleteWal sequentially — fine at this scale, Future.wait if it ever feels slow.
  2. On this head most CI checks are skipped, including "Dart Analyze & Tests" and the Kiritimati timezone run, so the new tests haven't run in CI on this SHA. Worth a local flutter test test/pages/conversations/ or a CI retrigger before merge — the grouping tests are timezone-sensitive by construction (DateTime.now()-seeded), which is exactly what the skipped Kiritimati run guards.

Thanks @aryanorastar — the evidence screenshots before/after make the customer impact easy to see.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

On the skipped Dart checks: I ran the suite locally on this head (54f2b88), using the same TZ= mechanism as the CI timezone jobs.

  • flutter test test/pages/conversations/: 30 passed (default timezone)
  • TZ=Pacific/Kiritimati (UTC+14): 30 passed
  • TZ=Pacific/Pago_Pago (UTC−11): 30 passed

This includes the interleaved phone/device and two-device grouping tests. I'm leaving _confirmDeleteWals sequential, as you suggested, until it measurably needs Future.wait.

@aryanorastar

Copy link
Copy Markdown
Collaborator Author

Ran the new tests locally on 54f2b88, since CI skips them on a fork PR: flutter test test/pages/conversations/ test/visual_audit/visual_audit_smoke_test.dart passed 143/143 in the local timezone, TZ=Pacific/Kiritimati and TZ=Pacific/Pago_Pago, the same zones the skipped CI runs use. Kept deletes sequential since a recording holds at most a few dozen files and sequential keeps provider updates ordered.

@aryanorastar
aryanorastar merged commit d3d08a6 into BasedHardware:main Oct 11, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants