Skip to content

feat(home): fold noise clips into one quiet line per day - #23853

Merged
Git-on-my-level merged 9 commits into
mainfrom
lane/home-noise-fold
Oct 28, 2026
Merged

Git-on-my-level merged 9 commits into
mainfrom
lane/home-noise-fold

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What this does

On Home, each day's noise and junk clips (lone "ừ", "Mm-", 2-second fragments) fold into one quiet line at the end of that day: "4 short clips hidden · Show". Tapping it reveals the clips in place, in time order, and "Hide 4 short clips" folds them back. David approved this from real-app renders on 10-28.

Depends on #23851, which adds GET /v1/conversations/hidden-noise-counts. Merge this after #23851 is deployed. Until then the count request fails, and the app keeps showing nothing extra.

How it works

  • Counts: ConversationProvider.refreshFoldedNoiseCounts runs after the initial load. It asks for counts over the loaded days (newest 31 at most) in the device time zone. A failed read keeps what was shown and is never treated as "nothing hidden". With "Show discarded" on, nothing folds, because those rows are already listed.
  • Reveal: fetches that day's include_discarded=true rows and keeps discarded && content_kind in (media, noise), the same rule the server count uses. A clip discarded by hand never appears.
  • Revealed rows: they read like ordinary rows, with their title or transcript and the emoji, instead of the "Discarded · 1m 8s" style.
  • Rebuilds: Home's page snapshot includes the fold state. Without it, tapping never redrew the list; a test caught this.
  • Model: ServerConversation now carries contentKind, which was already on the wire.
  • Copy: three new strings, translated for all locales.

Review follow-up (GLM, FIX-FIRST round 1)

All fixed, with tests:

  • Sign-out and account switch: these reset the fold, and an in-flight reply for the old account is dropped, so another account's rows can never appear.
  • Show discarded: with it on, nothing folds and no folded rows merge in. Before, toggling it caused duplicate rows.
  • Filtered views: search, folder and selection never draw the line or merge revealed rows.
  • Delete and restore: deleting on the phone removes the clip from the fold. A refresh drops cached rows, so a clip unhidden or deleted elsewhere doesn't come back on the next reveal.
  • Load-more: refreshes counts.
  • Double-tap Show: fetches once.
  • Fetch failures: stay silent and keep what's shown.

Not changed: a day whose only content is folded noise still has no row of its own. That's a follow-up if it matters.

UI evidence

Folded Revealed
Folded Revealed

Verification

  • test/widgets/home_noise_fold_test.dart, 5 cases:
    • fold, reveal in time order, and fold back;
    • only noise/media rows reveal;
    • tap target is 44pt or more;
    • count parsing;
    • a failed read keeps the counts;
    • Show discarded folds nothing.
  • 81 related Home, conversation and provider test files: 946 passed, 7 skipped.
  • Not verified on a phone. TestFlight follows the merge.

Line-Count-Exception: app/lib/providers/conversation_provider.dart | 2401 -> 2410 | the fold logic lives in its own mixin; the provider keeps only its import, the mixin clause, two @OverRide markers, and the reset/refresh/delete hooks at its existing sign-out, toggle, delete and load paths

Failure-Class: none

🤖 Generated with Claude Code

Git-on-my-level and others added 9 commits October 28, 2026 10:24
…day's noise rows

Counts come from GET /v1/conversations/hidden-noise-counts for the loaded
window (newest 31 days, device zone); a failed read keeps what was shown.
Show fetches that day's discarded rows and keeps content_kind media/noise,
the same rule the count uses. Revealed clips read like ordinary rows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… views never merge folded rows

GLM review of #23853:
- clearUserData and the show-discarded toggle reset the fold, and a reply
  for the previous account or mode is dropped (no cross-account rows).
- Only the plain default view folds; search, folder, selection and
  show-discarded lists never draw the line or merge folded rows, and a
  revealed row already on the list is not drawn twice.
- A local delete leaves the fold; a refresh drops cached rows so a clip
  unhidden or deleted elsewhere does not come back; load-more refreshes
  counts; a double tap on Show fetches once; fetch failures stay silent.
- Unused perf-harness helpers removed from the test (analyzer ratchet).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review October 28, 2026 05:17
@Git-on-my-level
Git-on-my-level merged commit 6d535d0 into main Oct 28, 2026
46 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/home-noise-fold branch October 28, 2026 05:17
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T05:20:00.410979Z ccf6d8e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Git-on-my-level added a commit that referenced this pull request Oct 28, 2026
…rst build, device perf harness (#23859)

* fix(mobile-perf): physical iOS batches die on macOS bash 3.2 before launch

HOST_GUARD is empty on every physical-device run, and macOS /usr/bin/env bash
(3.2) treats "${HOST_GUARD[@]}" of an empty array as unbound under set -u, so
every physical iPhone batch failed before receipt 1. Expand it only when set.

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

* fix(mobile-perf): frame total spans go negative on iOS 27 devices

On an iPhone 15 Pro Max (iOS 27.0.1) about one frame in seven starts building
~0.85 ms before its recorded vsync, so FrameTiming.totalSpan (raster finish -
vsync) is negative. Total p50/p90 were contaminated in every window, and
cold_start's p50 went negative, failing report validation for every batch.
Measure total from the earlier of vsync and build start. This changes the total
metric: earlier total percentiles are not comparable; qualify a new baseline.

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

* test(mobile-perf): live preview, live episode, Device Settings and On the Way windows

Three heavy-profile windows after the unchanged five, for the changes in
#23819, #23822 and #23853:

- home_live_preview: Home with the live episode row while a scripted on-device
  preview revises its newest line every 200 ms over a ~1,000-segment session
  (LivePreviewCoverage on every update and clock tick).
- live_episode_page: LiveEpisodePage on the transcript tab over the same
  session, scrolled while words arrive.
- device_settings_on_the_way: Device Settings (Catching up) and On the Way
  (day-grouped) over the 6,500-WAL backlog, each opened and scrolled.

The preview controller is installed through CaptureController.installLivePreview
and admitted through LivePreviewController.admit; only the socket admission flag
is asserted, since the fixture runs no listen socket. Device Settings gets an
interface fake: the production DeviceProvider subscribes to ServiceManager,
which this harness never initializes. Reports now require the eight windows;
comparisons list windows absent from the reference instead of failing.

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

* chore(changelog): heavy perf harness windows (internal only)

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

* test(mobile-perf): main-isolate stalls, field-shaped WAL index and an idle sync window

The field lag log that matters (iPhone 15 Pro Max, 10-26) is 133 main-isolate
stalls, mostly on idle Home and around sync phases, with a 71,536-record WAL
index. Drawn-frame timings could not see any of it.

- HeavyStallProbe: every window reports stalls over 50/100 ms, blocked time and
  the worst stall from a 20 ms timer's late ticks; reported, never variance-gated.
- --synced-wals N (0..80000): adds synced history on top of the pending
  backlog; such a batch changes the dataset and is never baseline-eligible.
- home_idle_sync_refresh: Home left alone while SyncProvider refreshes the
  inventory five times, as sync phase ends and upload callbacks do.
- Runner preflight: refuses a phone that is not on a wired USB connection
  before the multi-minute build.

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

* perf(home): live row computes uncovered preview once per clock tick

The Semantics label called previewText() twice per 1 s rebuild; each call runs
LivePreviewCoverage.uncovered over every final segment.

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

* perf(mobile): live transcript opens at the newest rows; Tasks first frame stays cheap

Measured on an iPhone 15 Pro Max (heavy profile harness):
- Opening LiveEpisodePage on the transcript tab took one 153 ms layout with
  1,775 builds (140-157 ms every run) and peaked RSS at 612 MB: following the
  latest jumped to maxScrollExtent on a variable-height lazy list, laying out
  every row. TranscriptWidget now anchors layout at the newest segment; a
  1,000-segment open builds 9 rows and lands on the newest.
- Preview revisions (every ~200 ms) no longer rebuild the transcript or rescan
  final history: LivePreviewCoverage prepares merged final spans once per
  transcript snapshot and answers each line by binary search, same results.
- The first Tasks tab switch spent 128 ms in one build (240-319 ms frame):
  ActionItemsPage now uses one lazy delegate across date sections, deferring
  offscreen sorting, headers and rows.

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

* perf(sync): WAL index work scales with what changed, not with every record ever kept

A heavy phone's index held 71,536 records (66,222 synced). Its lag watchdog
logged 133 main-isolate stalls over ~10 h (24 s blocked, worst 1.6 s), mostly
on idle Home and ~20x more often right after sync phases and uploads. Every
index save copied, keyed and fingerprinted every record on the main isolate
and copied the full List<Wal> into an encoding isolate; sync screens rescanned
the inventory on every notify; reconcile polled ~2/s after a reconnect.

- Saves: Wal persisted-field setters mark dirty identities; a long-lived index
  worker owns the serialized rows and receives only changed JSON maps and
  removed tokens. Durable is acknowledged only after flush + atomic rename;
  failed deltas are retained and retried. No whole-index fingerprint.
- Load: decode and Wal construction run off-isolate; the worker seeds
  unchanged rows from disk, so the first save sends zero unchanged records.
- Format: unchanged version-1 wals.json, backup and quarantine recovery;
  retired/foreign/synced records and upload-order tie-breaks preserved.
- Views: SyncProvider derives pending/uploaded/attention/refusal lists and
  per-day totals incrementally (WalDerivedViews); Home, On the Way and Device
  Settings read them. Integration and widget fakes derive the same views from
  their raw inventory (WalDerivedSyncViews).
- Reconcile: visits uploaded rows only, joins an active pass, spaces passes by
  20 s; job backoff, fairness and acknowledgement unchanged.

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

* perf(mobile): newest-anchored transcript renders short lists on the first frame

The newest-anchored layout needed extra frames for its anchor correction, so a
short live transcript (even one segment) was blank on its first frame;
capturing_empty_state_test failed 20 of 23. The viewport now measures its anchor
and initial latest position during layout, before paint. Short transcripts show
immediately; a 1,000-segment open still builds about one screen of rows. The
extra pumps added to episodes_ui_test are removed.

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

* fix(mobile): live transcript keeps the reader's row fixed when rows above grow

Review finding (GLM): on a short scrollable live transcript, a photo group or
an older row growing during a drag or fling changed the newest-anchored
viewport's anchor with pixels unchanged, moving every visible row by the
inserted height under the reader's finger, and the correction bailed for the
whole gesture. The viewport now compensates the leading-edge shift with
offset.correctBy in the same layout pass. Regression tests cover short and
long histories, photo insertion/growth and older-row growth across drag, fling
and idle; first-frame rendering and 1,000-segment laziness still hold.

Failure-Class: none

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

* fix(sync): WAL index worker death, backup seeding and repair writes recover in-session

Review findings (GLM) on the delta index worker:
- A dead worker isolate (OOM/VM kill) left apply() awaiting forever, wedging
  every later save and the capture flush queue. Exit/error listeners now fail
  pending requests and release the queue; the replacement worker is seeded from
  a full snapshot of the in-memory index, preserving tokens, admitted deltas
  and every custody bucket.
- After loading from the backup because wals.json was corrupt and could not be
  quarantined, the worker seeded from the corrupt main file and every save
  failed for the session. Workers now receive the exact source the loader
  validated; a failed startup retries from memory.
- The load-time invalid-entry repair used the legacy whole-file writer on the
  same wals.json(.tmp) as the live worker with no shared lock. Loading,
  quarantine/repair, worker seeding and writes now share one lock.

Every failure fails closed: no durable acknowledgement before flush + rename.

Failure-Class: none

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

* test(mobile-perf): field-shaped synced WALs survive the startup retention sweep

Dated syncedAt stamps were older than the synced-copy retention cutoff, so the
startup sweep removed all seeded synced records and Home saw only the pending
backlog. Legacy syncedAt 0 is never auto-removed, matching a long-lived phone.

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

* refactor(mobile): move transcript row highlight and live viewport into a part file

Keeps transcript.dart under its line-count ratchet (1590) after the
newest-anchored viewport landed; no behavior change.

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

* chore(dead-code): allowlist the derived sync views shared by SyncProvider stand-ins

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

* test(mobile-perf): timeline runs name each widget build

Attribution-only runs (never baselines) enable debugProfileBuildsEnabled so a
slow first build, such as the first Tasks switch, names its widget in the trace.

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

* fix(mobile): transcript scroll reporting stays bounded by the visible rows

Device regression (iPhone 15 Pro Max, 3 runs before/after): opening a saved
conversation's transcript and flinging it went from 0/101/100 ms of main-isolate
stalls per run to 223/257/116 ms. The trace put ~15% of samples in
_TranscriptPlaybackScrolling._reportTopVisibleSegment, which walked the sliver
tree on every scroll notification. Sliver discovery is now cached, each sliver
needs one reveal calculation, and remaining row positions use existing layout
offsets; first-frame layouts and reveal calls per frame are unchanged from 120
to 1,200 rows (test).

Failure-Class: none

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

* feat(mobile): kill switch for the delta WAL index writer

PostHog mobile-wal-delta-index-off (ops_kill, default false). True makes
the next launch save every index change through the pre-delta
full-snapshot writer; both writers produce the same version-1 file, so
flipping either way needs no migration. Read once per process with a 1 s
bound; offline or failed reads keep the delta writer on.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant