Skip to content

fix(mobile): invalidate DM directory providers at the community boundary#2842

Merged
brow merged 1 commit into
mainfrom
gated/directory-provider-invalidation
Jul 25, 2026
Merged

fix(mobile): invalidate DM directory providers at the community boundary#2842
brow merged 1 commit into
mainfrom
gated/directory-provider-invalidation

Conversation

@brow

@brow brow commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What changed?

Made the mobile new-message directory providers (relayDirectoryUsersProvider, relayDirectorySearchProvider) autoDispose, and both now watch relayConfigProvider so they refetch when the active relay/community configuration changes.

Why?

Follow-up to #2810 (Codex P1 review flag: "Invalidate the directory when the community changes").

Both providers previously cached results for the whole app session. They watched only the relay-session notifier (a stable instance that survives dependency rebuilds) and the current pubkey, which keeps its value when two communities share a signing key. Switching between such communities could reopen the New message sheet showing the previous relay's people, and submit their pubkeys to the current relay. The search provider was also a non-autoDispose family keyed by raw query strings, so every distinct typed query leaked a cached provider entry for the session.

Watching relayConfigProvider (which rebuilds on every community switch via activeCommunityProvider) invalidates cached browse and search results at the community boundary, and autoDispose releases the cache when the sheet closes.

How is it tested?

Full mobile suite green (585 passed / 1 skipped), flutter analyze clean.

Added tests:

  • channel_management_provider_test.dart — browse and search refetch on relay-config change with an unchanged session notifier and pubkey; cached search families are released once unlistened.

The new-message directory providers cached their results for the whole app
session: relayDirectoryUsersProvider watched only the stable relay-session
notifier instance plus the current pubkey, and relayDirectorySearchProvider
was a non-autoDispose family keyed by unbounded query strings. Switching to
a community that shares the same signing key therefore kept serving the
previous relay's people, and every distinct search query leaked a cached
provider entry for the session.

Make both providers autoDispose and watch relayConfigProvider so a community
switch (relay URL change) refetches browse and search results, and cached
entries are released when the sheet closes.

Follow-up to #2810 (Codex P1: invalidate the directory when the community
changes).

Co-authored-by: npub1kqarnt4re38nuttqnml3mrqp8cnm6wzpywl2kesc2ejasp0luc5q275nkx <b03a39aea3cc4f3e2d609eff1d8c013e27bd384123beab66185665d805ffe628@buzz.block.builderlab.xyz>
Signed-off-by: npub1kqarnt4re38nuttqnml3mrqp8cnm6wzpywl2kesc2ejasp0luc5q275nkx <b03a39aea3cc4f3e2d609eff1d8c013e27bd384123beab66185665d805ffe628@buzz.block.builderlab.xyz>
@brow

brow commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@brow

brow commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@builderbot review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@brow
brow marked this pull request as ready for review July 25, 2026 14:20
@brow
brow requested a review from a team as a code owner July 25, 2026 14:20

@wesbillman wesbillman 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 exact head 64356f7f42edce1361a02490788ea4f734391d5d.

The explicit relayConfigProvider dependency correctly invalidates browse and search results across same-signing-key community switches, while autoDispose bounds both the sheet cache and search-family cardinality. I traced the sole production consumer, relay-config/session sequencing, retry/loading behavior, and Riverpod generation behavior for late futures. The tests isolate config invalidation with a stable session notifier and pubkey, and prove both refetching and family disposal.

No blocking findings. Exact-head Mobile CI is green: analyzer clean, 585 passed / 1 skipped, and Android debug build succeeded.

@brow
brow merged commit edaec99 into main Jul 25, 2026
25 checks passed
@brow
brow deleted the gated/directory-provider-invalidation branch July 25, 2026 14:31
wpfleger96 pushed a commit that referenced this pull request Jul 25, 2026
…chive

* origin/main: (112 commits)
  docs(contributing): trim to goose-scale minimal intake surface (#2780)
  fix(relay): preserve reconnect backoff (#2759)
  refactor(relay): expose reconnect timing policy (#2310)
  fix(desktop): clear stale working badges on agent stop/restart (#2803)
  fix(desktop): surface agent rename relay profile sync failure as a warning toast (#2279)
  fix(docker): create /data/git so the compose volume inherits buzz ownership (#2840)
  fix(mobile): invalidate DM directory providers at the community boundary (#2842)
  feat(relay): make per-owner community limit configurable via BUZZ_MAX_COMMUNITIES_PER_OWNER (#2599)
  fix(discovery): inject PATH into Codex adapter planning (#2767)
  chore(release): release Buzz Desktop version 0.4.26 (#2808)
  Refine mobile navigation and creation flows (#2810)
  feat(relay): add author-only-unless-shared read gate for kind 30175 (#2768)
  fix(core): block IPv6 transition SSRF targets (#2801)
  Style mobile pairing QR codes (#2775)
  Refine community management flows (#2738)
  fix(workflow): bypass system proxies for webhooks (#2800)
  docs: replace VPN-vendor references with generic wording (#2805)
  docs: point readme at deploy compose bundle (#2363)
  fix(desktop): explain macOS local network access (#2263)
  fix(desktop): clarify CLI runtime setup (#2680)
  ...
wpfleger96 added a commit that referenced this pull request Jul 25, 2026
…chive

* origin/main: (112 commits)
  docs(contributing): trim to goose-scale minimal intake surface (#2780)
  fix(relay): preserve reconnect backoff (#2759)
  refactor(relay): expose reconnect timing policy (#2310)
  fix(desktop): clear stale working badges on agent stop/restart (#2803)
  fix(desktop): surface agent rename relay profile sync failure as a warning toast (#2279)
  fix(docker): create /data/git so the compose volume inherits buzz ownership (#2840)
  fix(mobile): invalidate DM directory providers at the community boundary (#2842)
  feat(relay): make per-owner community limit configurable via BUZZ_MAX_COMMUNITIES_PER_OWNER (#2599)
  fix(discovery): inject PATH into Codex adapter planning (#2767)
  chore(release): release Buzz Desktop version 0.4.26 (#2808)
  Refine mobile navigation and creation flows (#2810)
  feat(relay): add author-only-unless-shared read gate for kind 30175 (#2768)
  fix(core): block IPv6 transition SSRF targets (#2801)
  Style mobile pairing QR codes (#2775)
  Refine community management flows (#2738)
  fix(workflow): bypass system proxies for webhooks (#2800)
  docs: replace VPN-vendor references with generic wording (#2805)
  docs: point readme at deploy compose bundle (#2363)
  fix(desktop): explain macOS local network access (#2263)
  fix(desktop): clarify CLI runtime setup (#2680)
  ...

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
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.

2 participants