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>
This commit is contained in:
Samuel Newman
2026-07-16 21:04:44 +03:00
parent b1a4e1cd16
commit 300a50b69a
296 changed files with 4507 additions and 3903 deletions
+21 -16
View File
@@ -1,7 +1,8 @@
import {type AppBskyFeedDefs} from '@atproto/api'
import {type Client} from '@atproto/lex-client'
import {type AtUriString} from '@atproto/syntax'
import {PROD_DEFAULT_FEED} from '#/lib/constants'
import {type SessionAgent} from '#/state/session'
import {type app} from '#/lexicons'
import {CustomFeedAPI} from './custom'
import {FollowingFeedAPI} from './following'
import {type FeedAPI, type FeedAPIResponse} from './types'
@@ -14,7 +15,11 @@ import {type FeedAPI, type FeedAPIResponse} from './types'
// we use this fallback marker post to drive this instead. see Feed.tsx
// for the usage.
// -prf
export const FALLBACK_MARKER_POST: AppBskyFeedDefs.FeedViewPost = {
/*
* A sentinel post whose fields intentionally violate the branded lexicon
* formats (`uri`, `did`, `indexedAt`), so it is asserted into the view type.
*/
export const FALLBACK_MARKER_POST: app.bsky.feed.defs.FeedViewPost = {
post: {
uri: 'fallback-marker-post',
cid: 'fake',
@@ -25,10 +30,10 @@ export const FALLBACK_MARKER_POST: AppBskyFeedDefs.FeedViewPost = {
},
indexedAt: new Date().toISOString(),
},
}
} as unknown as app.bsky.feed.defs.FeedViewPost
export class HomeFeedAPI implements FeedAPI {
agent: SessionAgent
client: Client
following: FollowingFeedAPI
discover: CustomFeedAPI
usingDiscover = false
@@ -37,32 +42,32 @@ export class HomeFeedAPI implements FeedAPI {
constructor({
userInterests,
agent,
client,
}: {
userInterests?: string
agent: SessionAgent
client: Client
}) {
this.agent = agent
this.following = new FollowingFeedAPI({agent})
this.client = client
this.following = new FollowingFeedAPI({client})
this.discover = new CustomFeedAPI({
agent,
feedParams: {feed: PROD_DEFAULT_FEED('whats-hot')},
client,
feedParams: {feed: PROD_DEFAULT_FEED('whats-hot') as AtUriString},
})
this.userInterests = userInterests
}
reset() {
this.following = new FollowingFeedAPI({agent: this.agent})
this.following = new FollowingFeedAPI({client: this.client})
this.discover = new CustomFeedAPI({
agent: this.agent,
feedParams: {feed: PROD_DEFAULT_FEED('whats-hot')},
client: this.client,
feedParams: {feed: PROD_DEFAULT_FEED('whats-hot') as AtUriString},
userInterests: this.userInterests,
})
this.usingDiscover = false
this.itemCursor = 0
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
async peekLatest(): Promise<app.bsky.feed.defs.FeedViewPost> {
if (this.usingDiscover) {
return this.discover.peekLatest()
}
@@ -81,7 +86,7 @@ export class HomeFeedAPI implements FeedAPI {
}
let returnCursor
let posts: AppBskyFeedDefs.FeedViewPost[] = []
let posts: app.bsky.feed.defs.FeedViewPost[] = []
if (!this.usingDiscover) {
const res = await this.following.fetch({cursor, limit})