Skip to content

fix(app): count only union of positive audio intervals in RecordingBlock (#23561) - #23566

Merged
aryanorastar merged 1 commit into
BasedHardware:mainfrom
ocakciomursel-pixel:fix/offline-sync-exclude-chunk-gaps-23561
Oct 25, 2026
Merged

aryanorastar merged 1 commit into
BasedHardware:mainfrom
ocakciomursel-pixel:fix/offline-sync-exclude-chunk-gaps-23561

Conversation

@ocakciomursel-pixel

@ocakciomursel-pixel ocakciomursel-pixel commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #23561

Behavior

  • Count the union of positive [timerStart, timerStart + seconds] audio intervals in RecordingBlock.seconds, excluding gaps and counting overlapping copies once.
  • Keep recording grouping, source files, ownership, retry and upload state unchanged.
  • Cover gaps, overlapping device/phone copies, zero/negative lengths, and the rendered On the Way summary, day header and recording row. Include the required mobile changelog fragment.

This is a display-accounting correction. It does not retry or transcribe a backlog, change audio storage, establish recovery, or prove that a reported backlog contains no useful audio. Startup/recovery work remains tracked separately in #23223. No backend deployment is needed for this fix; customers need a mobile release containing it.

Maintainer verification at 3967e717b44f76a9b4acd4346b017013c6c1443b

  • Current-head Dart Analyze & Tests CI passed: 7,339 tests passed and four skipped. Formatting, Hygiene and Mobile Release Eligibility passed. Cubic was neutral because it did not automatically review the rewritten history; that is not an approval.
  • Independently reran 26 committed model/widget tests with Flutter 3.44.5, Dart 3.12.2, and TZ=UTC:
    flutter test --no-pub test/pages/conversations/recording_blocks_test.dart test/pages/conversations/offline_sync_recording_blocks_test.dart test/widgets/on_the_way_days_test.dart
  • Replacing only the model with current main in an isolated test snapshot reproduces all four new failures; the PR implementation passes them.
  • make preflight: all 26 selected checks passed in a clean detached worktree at the reviewed head. Metadata-only preflight also passed.
  • Additional scratch-only reviewer checks exercised 2,000 seeded interval sets against an independent covered-seconds oracle, repeated reads without WAL metadata/order changes, and the Offline Sync grouped-row → individual-files sheet. These checks use synthetic WALs and fake sync boundaries, not customer audio, live uploads or physical hardware.

UI-Evidence: none -- Isolated duration calculation; production widgets are exercised by rendering and interaction regressions. No layout, controls or native behavior changed.

Failure-Class: none

@ocakciomursel-pixel
ocakciomursel-pixel force-pushed the fix/offline-sync-exclude-chunk-gaps-23561 branch from ff363b5 to 95c206e Compare October 25, 2026 07:05

@Git-on-my-level Git-on-my-level left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The duration fix is correct and well-tested; one blocking item — the required mobile changelog fragment is missing (this is what fails the Hygiene check on this head).

Findings on all three changed files:

  • app/lib/pages/conversations/recording_blocks.dart — RecordingBlock.seconds now builds positive [timerStart, timerStart + seconds] intervals and returns their union via sort + merge sweep, replacing maxEnd - startSeconds. I verified the sweep handles gaps between grouped chunks, overlapping phone/device copies (counted once), containment, touching intervals, and the all-zero/negative case (returns 0 instead of an inflated span). O(n log n) on a small per-recording list — no performance concern.
  • app/test/pages/conversations/recording_blocks_test.dart — the three new tests (15s not 2m 5s gap exclusion; 120s overlap + gap; zero/negative lengths) match the sweep's semantics, and the _wal helper's new originalStorage parameter is used only to construct realistic device-copy joins. Good coverage.
  • app/test/widgets/on_the_way_days_test.dart — pins the rendered summary, day header, and row to 15s and asserts the old 2m 5s value no longer appears. Good end-to-end pin.

Blocking:

  • The app/ production change ships without a mobile changelog fragment, so Hygiene (mobile-changelog-entry) fails. Per app/changelog/README.md, please add one JSON file under app/changelog/unreleased/, e.g. 20261025-recording-duration-gaps.json with {"change": "Recording durations no longer count pauses between consecutive chunks"} (feel free to adjust the wording).

USER IMPACT: recordings captured in consecutive chunks with short pauses will now show their actual audio length (e.g. 15s instead of 2m 5s) in the on-the-way list.

Once the fragment lands I have no further changes to request — the code change itself is ready for maintainer merge.


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 the flutter flutter work label Oct 25, 2026
@ocakciomursel-pixel

Copy link
Copy Markdown
Contributor Author

Added the mobile changelog fragment (app/changelog/unreleased/20261025-recording-duration-gaps.json) in 3967e717b4.

@ocakciomursel-pixel
ocakciomursel-pixel force-pushed the fix/offline-sync-exclude-chunk-gaps-23561 branch from 95c206e to 3967e71 Compare October 25, 2026 10:21

@aryanorastar aryanorastar 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.

Reviewed the final diff at 3967e71. No merge-blocking code findings. The positive-interval union covers #23561 while retaining grouping, source files and sync metadata; the changelog fragment requested in the earlier review is present.

Independently verified 26 committed model/widget regressions and all 26 local preflight checks. Current-main negative control reproduces all four new failures. Additional synthetic reviewer checks passed for 2,000 interval sets, stable repeated reads with unchanged WAL metadata/order, and Offline Sync recording-row to original-file-sheet interaction. Current-head CI reports 7,339 tests passed with four skipped; Formatting, Hygiene and Mobile Release Eligibility pass. Cubic's neutral result is not counted as a review approval.

This completes the duration-accounting defect only. It needs a mobile release; backlog processing and customer audio recovery remain separate from this fix.

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

Labels

flutter flutter work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(app): Offline Sync counts gaps between chunks as pending audio

3 participants