Commit Graph

1444 Commits

Author SHA1 Message Date
Samuel Newman 4cbefaf4b2 roast findings: arm ordering, composer deps, follow-all fallthrough, createdAt clobber
Adversarial review (roast) of the branch, 9 path-scoped passes:
- cross-tab rebuild armed the new session's hooks before the deferred
  bundle dispatch, so an 'expired' event fired in that async window
  would be dropped by the reducer's bundle-identity check; arm now
  happens in the same callback as the dispatch, and the dispatched
  account is re-read from the live session (mirrors snapshot-after-
  prep).
- Composer onPressPublish's dep array omitted appviewClient and
  resolveClients (stale-client hazard after cross-tab rebuild).
- follow-all catch blocks (onboarding starter-pack card, starter pack
  screen) showed the error toast but fell through to dereference the
  undefined followUris map, throwing and showing a bogus success toast.
- contacts createProfileRecord unconditionally overwrote the profile's
  createdAt on every run; now preserved when already set, matching
  StepFinished.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:19:43 +03:00
Samuel Newman ac2309c182 snapshot session after prep, skip no-op cross-tab rebuilds, restore chat proxy env
Review fixes (PR #11182 round 3):
- The session factories snapshotted the account BEFORE the prep awaits
  (moderation config, age-assurance prefetch) with hooks still disarmed.
  A 401 during prep triggers PasswordSession's internal auto-refresh,
  rotating both tokens; the dropped onUpdated meant the stale refreshJwt
  got persisted (dead on next cold start). The returned account is now
  re-snapshotted after prep, right before arm() - matching the old
  BskyAppAgent.prepare ordering. Tests pin the mid-prep rotation case.
- Cross-tab sync rebuilt and killed the active bundle on ANY saved-
  account change; now bails out when the current account's tokens are
  unchanged.
- buildChatClient hard-coded the SDK's prod chat DID, making the env-
  configurable CHAT_PROXY_DID dead code and routing staging DMs to prod
  chat; new CHAT_PROXY_SERVICE constant restores the override.
- The cross-tab labeler reapply was fire-and-forget; the bundle swap now
  defers until the labeler config resolves, matching the factories.

Note: the reviewer's URL.canParse/ReadableStream claim was verified
INCORRECT - Expo 54's WinterCG runtime defines URL.canParse and Metro
injects a ReadableStream polyfill (expo/virtual/streams.js) into dev and
release bundles.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:19:43 +03:00
Samuel Newman 2f2a28f7f9 import client from lex instead of lex-client 2026-07-30 18:19:43 +03:00
Samuel Newman 2696104e6d survive session-bundle rebuild in chat, feeds, prefs, and age assurance
Review fixes (PR #11182 round 2). Client identity is no longer stable
across token refresh - on web, a cross-tab sync rebuilds the bundle and
disposes the old clients (whose fetch now throws) - so anything that
captured a client at construction time must re-point at the live one:

- MessagesEventBus and Convo get updateClient(); providers sync it via
  effect. No remount, so poll cursors and optimistic pendingMessages
  survive.
- FeedAPI implementations get setClient(); the post-feed queryFn and
  pollLatest re-point page-held apis before fetching (Merge/Home apis
  are stateful across pages, so they cannot be rebuilt per fetch).
- usePreferencesQuery applies fetched labeler dids to the live appview
  client (applyLabelersToClient, factored from session/moderation),
  restoring the old BskyAgent.getPreferences header side effect.
- ageAssurance redirect overlay/dialog polling is mount-only with
  render-synced refs; a client swap mid-poll no longer latches the
  unmounted flag and strands the overlay.
- Convo message-failure classification defers to lex's shouldRetry()
  instead of treating all status-less errors as recoverable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:18:56 +03:00
Samuel Newman 4c2771eca3 fix session refresh persistence, 2fa login, bundle disposal, cross-tab labelers
Review fixes (PR #11182 round 1):
- PasswordSession fires onUpdated/onDeleted BEFORE committing its
  session data; thread the hook payload through to the provider instead
  of reading the live getter. Fixes rotated tokens never persisting
  (eventual forced logout) and expiry not logging out.
- getErrorName now gates on LexError, so LexAuthFactorError (a sibling
  of XrpcError) surfaces AuthFactorTokenRequired and email-2fa users
  get the code input.
- disposeBundle was a no-op; add a kill-switch closure around the
  session's injected fetch (covers the internal auto-refresh path) so a
  replaced session can't consume rotated refresh tokens. kill() also
  disarms the hooks so stale bundles can't dispatch into the reducer.
- cross-tab same-did rebuild now reapplies subscribed labelers to the
  fresh appview client (was built with an empty per-instance set).
- isAppLabeler reads Client.appLabelers instead of the hard-coded prod
  did, restoring test-env and regional-authority classification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:18:56 +03:00
Samuel Newman 4c0d99158f route appview state and facet resolution off the pds client
Audit of usePdsClient call sites: the PDS client is for com.atproto.*
account/repo operations. Appview-private state (actor/list/thread mutes,
notification seen-state) and mention/facet resolution now use the
appview-routed client. useRichText also regains logged-out mention
resolution via useLexClient's public fallback (usePdsClient throws when
logged out, silently leaving mentions unresolved on StarterPackLanding
and web ProfileHoverCard).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:18:55 +03:00
Samuel Newman 8ee62d67bd finish phase 4: drop @atproto/api dependency, lex-only errors, delete toLex and legacy validators
oxlint-suppressions.json gains a baseline entry for webpack.config.js: the
file was never previously staged/linted (lint script covers src+modules
only), and editing it exposed its pre-existing violations to lint-staged.
All suppressed counts are pre-existing; this change only removes a line.
2026-07-30 18:18:38 +03:00
Samuel Newman ca5b8b6346 phase 4: delete the session bridge (SessionAgent, agent.ts, agentToLexClient) 2026-07-30 18:17:39 +03:00
Samuel Newman bab2b621a9 phase 4: migrate account flows, trending queries, notifications, and report subjects off the bridge 2026-07-30 18:17:39 +03:00
Samuel Newman 5a099a8db6 phase 4: migrate ageAssurance unit and chat wrapper signatures to lex clients 2026-07-30 18:16:48 +03:00
Samuel Newman d052d14f2b phase 4 foundations: vendor missing lexicons, refreshSession api, toLex no-op purge, de-agent link-meta 2026-07-30 18:16:48 +03:00
Samuel Newman e7d349bc30 finish phase 3: type-only codemod and zero non-bridge @atproto/api imports
Task 8: codemod repointed 150 namespace-type files to #/lexicons
(AppBskyFeedDefs.PostView -> app.bsky.feed.defs.PostView, .Record -> .Main)
plus ~105 hand-fixed consumers (composer/video state, DebugMod, Profile,
onboarding, dialogs). DM_SERVICE_HEADERS deleted; last chat call sites on
the chat client. RichText.tsx flipped to SDK-only. Remaining @atproto/api
importers: the three session bridge files, the deliberate dual-world
matcher in lib/xrpc-error.ts, and test fixtures. toLex boundary casts are
TODO(phase4)-tagged for bridge removal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:15:22 +03:00
Samuel Newman 300a50b69a migrate runtime call sites to lex clients and sdk actions
Phase 3 tasks 3-7 (parallel wave): composer/post pipeline on
pdsClient/appviewClient with structural+instance blob guards and a golden
CID fixture test; chat Convo/EventBus/queries on the dedicated chat client;
preferences sugar to SDK actions on the PDS client; remaining state/queries
producers (usePostThread unspecced flip, video scoped-token clients,
notifications, starter packs, lists) to client.call; UI runtime sweep
(AtUri from @atproto/syntax, moderation fns from @bsky.app/sdk/moderation,
SDK RichText, ozone reason tokens, guard rewrites via #/types/bsky).

Intermediate checkpoint (hooks skipped): ~114 typecheck errors remain in
cross-boundary consumer files, resolved by the type-only codemod next.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:12:10 +03:00
Samuel Newman b1a4e1cd16 flip types/bsky sources to #/lexicons, add chat client and strict hook contracts
Phase 3 task 2: types/bsky sibling modules (post/profile/starterPack) now
source from generated #/lexicons with interim dual-world widening aliases
(TODO(phase4) markers). SessionBundle gains a chatClient proxied to
did:web:api.bsky.chat#bsky_chat via useChatClient(). usePdsClient() and
useChatClient() no longer fall back to the public appview when logged out -
they return a client that throws NotAuthenticatedError before any network
I/O; useMaybePdsClient()/useMaybeChatClient() cover logged-out-aware
callers. RichText pilot: useRichText.ts on @bsky.app/sdk/richtext with
detectFacets(pdsClient); RichText.tsx display sink accepts both worlds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:07:26 +03:00
Samuel Newman bf8b6bc0c7 rework session layer on PasswordSession + three-client pattern
- PasswordSession (@atproto/lex-password-session) is now the single auth
  core; SessionAgent bridges it to the base Agent from @atproto/api so
  the ~148 useAgent() consumer files keep working unchanged
- SessionBundle carries {session, agent, accountClient, appviewClient};
  useLexClient() now returns the authed appview client, new
  useAppviewClient()/usePdsClient() hooks
- reducer: OpaqueSessionBundle, new replaced-current-bundle action for
  network-free cross-tab same-did sync (PasswordSession is immutable, so
  the bundle is rebuilt instead of mutated in place)
- moderation: AtpAgent.configure -> Client.configure + Agent.configure,
  per-account labelers on both the bridge and the appview client
- push-token unregistration uses temporary PasswordSessions
- hard-tail migrations: SignupQueued refresh via resumeSession shim,
  useBeginAgeAssurance scoped-token raw Client, useAccountEmailState
  reads currentAccount
- PDS routing preserved on the no-network resume fast path by
  synthesizing a minimal didDoc from the persisted pdsUrl

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-30 18:06:58 +03:00
Samuel Newman 105e68c12c add lex client seam, types/bsky schema helpers, pilot trending migration 2026-07-30 18:06:12 +03:00
DS Boyce b4bad1187a Indicate if someone followed you via a starter pack (#11320) 2026-07-29 12:11:28 -07:00
DS Boyce 10b027c35b Sort follows and following behind gate (#11237) 2026-07-23 09:02:35 -07:00
Oleksii Bulenok 8d64ab9d4b React Native New Arch (#10980) 2026-07-23 18:25:40 +03:00
DS Boyce 77bbe8d8a0 Add From: Me to advanced search filters (#11126) 2026-07-22 15:01:24 -07:00
DS Boyce 8ca8176eb1 Update presentation of trending feeds (#11206) 2026-07-22 14:35:45 -07:00
DS Boyce c71a4f8360 Create new trending feeds interstitial (#11207) 2026-07-22 14:23:01 -07:00
DS Boyce 0bd6a99613 Pass recId with trending topic click metrics (#11232) 2026-07-22 12:51:49 -07:00
DS Boyce 86f0bedfbe Add new search results tab for starter packs (#11226) 2026-07-21 13:18:12 -07:00
DS Boyce 5b9967b17d Strip leading @ in from: queries (#11158) 2026-07-15 09:23:11 -07:00
DS Boyce 3c5c11c002 Add setting for opting in to beta features (#11123) 2026-07-15 06:06:54 -07:00
Alex Benzer 04ebd02ce3 Prototype: Show known likers on post thread page (#11080)
Co-authored-by: Eric Bailey <git@esb.lol>
2026-07-13 14:55:15 -05:00
DS Boyce 3499d3646e Migrate all search to v2 and remove v1 (#11125) 2026-07-09 15:08:20 -07:00
Samuel Newman 9ff248528b Automatically resolve hosting provider from handle (#11053)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Co-authored-by: Eric Bailey <git@esb.lol>
2026-07-07 04:21:58 -07:00
So Asano e5d2ee3315 Clean up media-upload temp files on iOS (#11007)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 10:18:00 -04:00
DS Boyce b0a40145e9 Special-case 'me' values in search queries (#11043) 2026-07-02 09:35:57 -07:00
Spence Pope c4ce3ce0fb Reduce Sentry noise from logger transport and expected-failure call sites (#10893) 2026-07-01 10:43:01 -04:00
RetroSunstar 0526820506 Fix stale display names for lists/feeds in top bar across restarts/devices (#10651) 2026-06-30 16:10:53 -05:00
surfdude29 251605919f Fix hashtag author filter failing for DIDs (#10772)
Co-authored-by: Claude <noreply@anthropic.com>
2026-06-30 13:27:13 -07:00
DS Boyce cc893028e3 Always set allTime to true for search v2 (#11033) 2026-06-30 10:34:40 -07:00
Samuel Newman ade5d2b783 Cull unused files (#11029) 2026-06-30 19:41:35 +03:00
Christian Schmidt 43d2f939c2 WSOD when trying to create account from starter pack on non-default provider (#10970) 2026-06-30 01:26:20 -07:00
DS Boyce 248290e0b3 Add advanced search UI (#10992) 2026-06-26 16:16:48 -07:00
DS Boyce eae15aca3e Increase unread cap to 99+ (#10985) 2026-06-25 16:57:03 -05:00
DS Boyce 3b2e609761 Add new chat notification preferences (#10972) 2026-06-25 12:01:33 -07:00
DS Boyce da1f637160 Fix issue with stale unread message counts (#10953) 2026-06-24 13:51:06 -07:00
Samuel Newman 2843374ef8 Fix setState-in-render warning from convo cache subscription (#10934)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 11:37:57 -05:00
Samuel Newman 1b5242c1d6 Rip out Modal system completely (#9903) 2026-06-17 02:45:01 -07:00
DS Boyce e057d3bd54 Get unread counts vs counting convos (#10878) 2026-06-16 13:45:07 -07:00
Samuel Newman bb6847f396 Replace Add User to Lists Modal with modern Dialog (#9677)
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Eric Bailey <git@esb.lol>
2026-06-16 12:41:05 -05:00
Samuel Newman b8fdce6478 Message replies in chat (#10903)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 10:26:48 -07:00
Samuel Newman 0204848cc4 [Chat] fix: enforce convo-present invariant for active convo states (#10906)
Co-authored-by: Claude <noreply@anthropic.com>
2026-06-15 02:47:14 -07:00
Samuel Newman cd404023fb Fix chat firehose event handling and error recovery (#10884) 2026-06-13 01:01:00 +03:00
Alex Benzer 581d2b296d Fixes follow buttons inside notification bundles not changing state on follow (#10882) 2026-06-12 11:18:53 -07:00
Samuel Newman bd775070e8 [Chat] Use relatedprofiles for reactions/new message logs (#10875) 2026-06-11 11:12:11 -07:00