Skip to content

Report how Following v2 restores, checks and prepends turn out - #11957

Draft
mozzius wants to merge 8 commits into
samuel/app-3352-following-pill-until-topfrom
samuel/app-3158-following-metrics
Draft

mozzius wants to merge 8 commits into
samuel/app-3352-following-pill-until-topfrom
samuel/app-3158-following-metrics

Conversation

@mozzius

@mozzius mozzius commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Fixes APP-3158. Stacked on #11942.

What it does

  • Restores. Home Following reports whether it showed its saved snapshot, fetched instead, or failed to load. It also says whether the snapshot was valid, missing or rejected and why, how old its newest posts were, its size and its page count.
    • restored means the view shows the exact page the read restored, so it's also right after switching back to an account.
    • Two of the reasons, "expired" and "appVersion", mean TanStack threw away the whole saved cache: it has a 24 h maxAge and resets on every app version (APP-3397).
    • What a read found is held per query client, not in a module-level variable.
  • Checks. Each check for new posts reports what started it (focus, return, hop or interval) and how long it's been since the last successful check. What it did comes from the prepend's own check: staged, notStaged, nothing, skipped, joined, found or failed.
  • Prepends. Each fetch of newer posts above the reader reports what started it, whether it staged them, how many posts came back, and whether there were more than fit (a gap). If it wrote nothing, it says why:
    • nothing was newer;
    • the waiting page was already full;
    • a refresh won;
    • or the reader reached the posts first.
  • Refreshes and gaps report whether they wrote, failed, or gave way to newer data. Settles also report how many pages they dropped.
  • Low volume. Interval checks and quick hops can repeat every minute or more often. So they and their prepends are sampled at 10% of app sessions (all of them in internal builds), and each event carries its sampleRate.
  • Gated and private. Only Home Following on iOS and Android with Following v2 on reports anything. Every payload is built field by field, so no feed content, cursors or account data can slip in through a spread. A test checks this across every event. The change to the shared persister only passes the query client and the settings it already used.

Known issues

  • No events yet for Discover/For You batches (milestone F) or for the list losing the reader's place.
  • A snapshot that couldn't be saved shows up as "missing" on the next cold start, without a reason.
  • A failed check makes the next focus check's clock fall back to the top page's age (APP-3396).
  • Following's own restore prepend still decides "restored" by when the process started. So switching back to an account in the same session restores its snapshot without a restore prepend or pill. That's a follow-up.

Test plan

  • pnpm test src/features/followingV2 src/lib/appState (296 tests), pnpm typecheck, pnpm lint.
  • Unit tests:
    • the snapshot rules;
    • what a read reports, once per read and per query client;
    • restore classification, including a restore within the same process;
    • sampling: a session outside the sample, one inside it with sampleRate 0.1, and reporting disabled.
  • Through the renderHome harness, which now runs PostFeed's real wiring:
    • interval checks that stage, and ones that only peek;
    • full pages, and a full page kept;
    • a failed check;
    • a prepend that's dropped;
    • a refresh winning;
    • a cold start reporting restored, with its restore prepend and a joined focus check;
    • no content, cursors or DIDs in any payload;
    • settle outcomes.
  • Device:
    • one followingV2:restore per cold start;
    • check, prepend and refresh events in the debug metrics log;
    • nothing with the flag off or on web.

🤖 Generated with Claude Code

@mozzius
mozzius added this pull request to stack #11943 October 12, 2026 18:09
@linear-code

linear-code Bot commented Oct 12, 2026

Copy link
Copy Markdown

APP-3158

@mozzius mozzius changed the title samuel/app 3158 following metrics Report how Following v2 restores, checks and prepends turn out Oct 12, 2026
@mozzius
mozzius force-pushed the samuel/app-3158-following-metrics branch from 872a33d to c03df74 Compare October 13, 2026 11:55
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Size Old size New size Diff
Uncompressed 9.76 MB 9.77 MB +5.83 KB (0.06%)
Gzip 2.86 MB 2.86 MB +1.98 KB (0.07%)

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

The OTA deployment for this PR was successful! You may now apply it by either scanning the QR code or opening the deep link below in your browser:

QR code for the PR OTA deployment

bluesky://intent/apply-ota?channel=pull-request-11957&releaseVersion=1.138.0&iosBuildNumber=2263&androidBuildNumber=1704

@mozzius
mozzius force-pushed the samuel/app-3158-following-metrics branch from c03df74 to 82c440d Compare October 14, 2026 08:04
@mozzius
mozzius force-pushed the samuel/app-3158-following-metrics branch from 82c440d to b6e0e92 Compare November 3, 2026 15:01
@mozzius
mozzius force-pushed the samuel/app-3158-following-metrics branch from b6e0e92 to e12f35d Compare November 5, 2026 15:16
mozzius and others added 8 commits November 9, 2026 20:05
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it restored

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… payloads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mozzius
mozzius force-pushed the samuel/app-3158-following-metrics branch from e12f35d to 1bc18f1 Compare November 9, 2026 18:11

This branch has not been deployed

No deployments
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