Objective-C: follow-ups from the WPLog migration (#26259)

オープン
#26,260 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
ios, objective-c, swift
領域
mobile

調査の方向性

Start with CommentService.m and inspect setHierarchyAndDepthOnComment:withParentComment: and its two callers to confirm when the placeholder ID is assigned. Then review the listed -Wnonnull call sites in MediaService, SafariActivity, MenuPostService, and MenusViewController; build the app target with -Werror=format to check the warnings are resolved. Done when posted replies use their real IDs, new replies sort after existing IDs, and the listed warnings are addressed.

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

説明

[Type] Task Observability

Problems found while moving Objective-C logging to WPLog* in #26259. None of them block that PR. They're existing bugs outside the logging change, found by a -Werror=format build and by reading CommentService.

  • setHierarchyAndDepthOnComment:withParentComment: always uses the placeholder comment ID.
    In CommentService.m, if (commentID != 0) compares the NSNumber object to 0, not its value, so the check is always true. The comment above it says only new, unsent comments (ID 0) should get the placeholder 9999999, so they sort last among their siblings. Instead every comment going through this method gets it.

    Two callers are affected:

    • createHierarchicalCommentWithContent:withParent:postID:siteID:inContext:, for a new local reply. Here the placeholder is intended.
    • updateHierarchicalComment:withRemoteComment:, after the server returns the posted reply with its real ID. Here the real ID should be used.

    So a posted reply probably keeps a …0009999999 ordering key until the next full sync (hierarchyFromAncestors:andCommentID:) recomputes it. Separately, 9999999 has only 7 digits, so it doesn't sort last on sites whose comment IDs have 8 or more digits.

    Found by reading the code only. Not reproduced in the app: the effect on comment thread order hasn't been checked. Likely fix: compare the value (comment.commentID == 0) and use a placeholder that sorts after any Int32 ID, for example INT32_MAX (2147483647, still 10 digits).

  • Pre-existing: five -Wnonnull warnings (nil passed where a value is required).
    These show up when building with -Wformat warnings as errors (-Wnonnull is in that group):

    • MediaService updateMedia:success:failure: and updateMedia:overallSuccess:failure: pass fieldsToUpdate:nil.
    • SafariActivity.performActivity passes options:nil to openURL:options:completionHandler:. Should be @{}.
    • MenuPostService passes withOptions:nil.
    • MenusViewController sets self.headerViewController.blog = nil.

    For each, either pass an empty value, or mark the parameter nullable if nil is meant to be allowed. After that, the app target could build with -Werror=format permanently, so format-string mistakes fail CI instead of producing wrong log lines.

主要言語
Swift
スター
3.9k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
136

環境構築

はじめの一歩

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

wordpress-mobile/WordPress-iOS のほかの issue

wordpress-mobile/WordPress-iOS の issue をすべて見る

似ている issue

Swift の issue をもっと見る

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

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