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>
This commit is contained in:
Samuel Newman
2026-07-17 02:08:48 +03:00
parent 300a50b69a
commit e7d349bc30
283 changed files with 2029 additions and 1806 deletions
@@ -8,7 +8,6 @@ import Animated, {
SlideInRight,
SlideOutLeft,
} from 'react-native-reanimated'
import {type ComAtprotoServerCreateAppPassword} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
@@ -25,6 +24,7 @@ import {ChevronRight_Stroke2_Corner0_Rounded as ChevronRight} from '#/components
import {SquareBehindSquare4_Stroke2_Corner0_Rounded as CopyIcon} from '#/components/icons/SquareBehindSquare4'
import {Text} from '#/components/Typography'
import {IS_WEB} from '#/env'
import {type com} from '#/lexicons'
import {CopyButton} from './CopyButton'
export function AddAppPasswordDialog({
@@ -70,7 +70,7 @@ function CreateDialogInner({passwords}: {passwords: string[]}) {
error: validationError,
isPending,
} = useMutation<
ComAtprotoServerCreateAppPassword.AppPassword,
com.atproto.server.createAppPassword.AppPassword,
Error | DisplayableError
>({
mutationFn: async () => {
@@ -10,7 +10,6 @@ import Animated, {
SlideOutLeft,
SlideOutRight,
} from 'react-native-reanimated'
import {type ComAtprotoServerDescribeServer} from '@atproto/api'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
@@ -46,6 +45,7 @@ import {InlineLinkText} from '#/components/Link'
import {Loader} from '#/components/Loader'
import {Text} from '#/components/Typography'
import {useSimpleVerificationState} from '#/components/verification'
import {type com} from '#/lexicons'
import {CopyButton} from './CopyButton'
export function ChangeHandleDialog({
@@ -147,7 +147,7 @@ function ProvidedHandlePage({
serviceInfo,
goToOwnHandle,
}: {
serviceInfo: ComAtprotoServerDescribeServer.OutputSchema
serviceInfo: com.atproto.server.describeServer.$OutputBody
goToOwnHandle: () => void
}) {
const {_} = useLingui()
@@ -4,11 +4,15 @@ import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
import {DM_SERVICE_HEADERS} from '#/lib/constants'
import {useCleanError} from '#/lib/hooks/useCleanError'
import {sanitizeHandle} from '#/lib/strings/handles'
import {logger} from '#/logger'
import {useAgent, useSession, useSessionApi} from '#/state/session'
import {
useAgent,
useChatClient,
useSession,
useSessionApi,
} from '#/state/session'
import {atoms as a, useTheme} from '#/alf'
import {Admonition} from '#/components/Admonition'
import {type DialogOuterProps} from '#/components/Dialog'
@@ -24,6 +28,7 @@ import {Loader} from '#/components/Loader'
import * as Prompt from '#/components/Prompt'
import * as toast from '#/components/Toast'
import {Span, Text} from '#/components/Typography'
import {chat} from '#/lexicons'
import {resetToTab} from '#/Navigation'
const WHITESPACE_RE = /\s/gu
@@ -73,6 +78,7 @@ function DeleteAccountDialogInner({
const {_} = useLingui()
const cleanError = useCleanError()
const agent = useAgent()
const chatClient = useChatClient()
const {currentAccount} = useSession()
const {removeAccount} = useSessionApi()
@@ -112,13 +118,9 @@ function DeleteAccountDialogInner({
throw new Error('Invalid did')
}
const token = confirmCode.replace(WHITESPACE_RE, '')
// Inform chat service of intent to delete account.
const {success} = await agent.chat.bsky.actor.deleteAccount(undefined, {
headers: DM_SERVICE_HEADERS,
})
if (!success) {
throw new Error('Failed to inform chat service of account deletion')
}
// Inform chat service of intent to delete account. The chat client is
// proxied to the chat service; a failure throws.
await chatClient.call(chat.bsky.actor.deleteAccount)
await agent.com.atproto.server.deleteAccount({
did: currentAccount.did,
password,
@@ -2,7 +2,6 @@ import {useCallback, useState} from 'react'
import {View} from 'react-native'
import {Trans, useLingui} from '@lingui/react/macro'
import {DM_SERVICE_HEADERS} from '#/lib/constants'
import {saveBytesToDisk} from '#/lib/media/manip'
import {logger} from '#/logger'
import {useAgent} from '#/state/session'
@@ -14,6 +13,7 @@ import {InlineLinkText} from '#/components/Link'
import {Loader} from '#/components/Loader'
import * as Toast from '#/components/Toast'
import {Text} from '#/components/Typography'
import {CHAT_PROXY_DID} from '#/env'
export function ExportCarDialog({
control,
@@ -58,9 +58,11 @@ export function ExportCarDialog({
setLoading('chat')
// Using raw fetch because the XRPC client incorrectly tries to JSON-parse
// application/jsonl responses (substring match on application/json).
// The chat-service proxy header is inlined here (the endpoint is proxied
// to `did:web:api.bsky.chat`); this raw path bypasses the lex client.
const res = await agent.sessionManager.fetchHandler(
'/xrpc/chat.bsky.actor.exportAccountData',
{headers: DM_SERVICE_HEADERS},
{headers: {'atproto-proxy': `${CHAT_PROXY_DID}#bsky_chat`}},
)
if (!res.ok) {
throw new Error(`HTTP ${res.status}`)
@@ -1,6 +1,6 @@
import {useCallback} from 'react'
import {View} from 'react-native'
import {type $Typed, type ComAtprotoLabelDefs} from '@atproto/api'
import {type $Typed} from '@atproto/lex'
import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro'
@@ -36,7 +36,7 @@ export function PwiOptOut() {
profile,
updates: existing => {
// create labels attr if needed
const labels: $Typed<ComAtprotoLabelDefs.SelfLabels> = bsky.matches(
const labels: $Typed<com.atproto.label.defs.SelfLabels> = bsky.matches(
com.atproto.label.defs.selfLabels,
existing.labels,
)
@@ -70,9 +70,7 @@ export function PwiOptOut() {
return existing
},
checkCommitted: res => {
const exists = !!res.data.labels?.some(
l => l.val === '!no-unauthenticated',
)
const exists = !!res.labels?.some(l => l.val === '!no-unauthenticated')
return exists === wasAdded
},
})