[Bug]: `updateProfileRecord` drops the profile's `links` on every update

オープン 初心者向け
#344 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
swift

調査の方向性

UpdateProfileRecord.swiftを読み、特に69~77行付近の既存フィールドのコピーと、189~200行付近のProfileRecordイニシャライザを確認してください。replaceが値をどのように選択し、putRecordがプロフィールをどのように書き込むかを追ってください。別のフィールドを更新しても既存のlinksが保持されれば完了です。利用可能であれば、該当するプロフィール更新テストを実行してください。

索引モデルが issue の本文から書いたものです。

説明

bug
Summary

ATProtoBluesky.updateProfileRecord(profileURI:replace:) reads the existing profile record, rebuilds it as a new AppBskyLexicon.Actor.ProfileRecord, and writes it back with putRecord. The rebuilt record never carries over links, so any update — even one that only changes pinnedPost or labels — removes all of the profile's links (app.bsky.actor.profile#links, the ordered strongRefs to app.bsky.actor.link records).

Reproduction Steps
  1. Use an account whose app.bsky.actor.profile/self record has a non-empty links array (e.g. one set from the official Bluesky app).
  2. Call updateProfileRecord(profileURI:replace:) with any field, e.g. replace: [.pinnedPost(with: someReference)].
  3. Fetch the profile record again with getRepositoryRecord, or the profile with getProfile.
Expected Results

Fields not listed in replace are preserved, including links.

Actual Results

links is removed from the profile record, and getProfile no longer returns any links.

What operating systems did you experience this bug?

macOS

Operating System Version

macOS Golden Gate 27.2

ATProtoKit Version

0.34.1

Additional Context

The app.bsky.actor.link records themselves remain in the repo but are no longer referenced by the profile.

In UpdateProfileRecord.swift, the existing values are copied for every other field (lines 69–77), but links is not, and the ProfileRecord initializer is called without it, so it falls back to its default of nil (lines 189–200):

let profileRecord = AppBskyLexicon.Actor.ProfileRecord(
    displayName: newDisplayName,
    description: newDescription,
    pronouns: newPronouns,
    websiteURL: newWebsiteURL,
    avatarBlob: newAvatarImage,
    bannerBlob: newBannerImage,
    labels: newLabels,
    joinedViaStarterPack: newJoinedViaStarterPack,
    pinnedPost: newPinnedPost,
    createdAt: Date()
)

Because putRecord replaces the whole record, the omitted field is deleted.

主要言語
Swift
スター
226
フォーク
40
平均マージ
5時間 8分
マージ済み PR(30日)
3

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MasterJ93/ATProtoKit のほかの issue

MasterJ93/ATProtoKit の issue をすべて見る

似ている issue

Swift の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。