Crash opening the classic editor for a post that was just deleted (precondition in AztecPostViewController.init)

未关闭
#26,319 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
ios, swift
领域
mobile-dev

调研方向

Start with EditPostViewController.swift and AztecPostViewController.swift, then trace the candidate flow through PostListEditorPresenter and PostRepository.paginate. Build the Jetpack scheme and try the repro steps with a site containing more than 40 posts. Done means reporting whether you reproduced a deleted post reaching the editor precondition and, if so, what cause or fix approach you found.

由索引模型根据 Issue 内容生成。

描述

[Status] Needs Plan [Status] Needs Repro [Type] Crash Core Data Posting/Editing

Likely shares a root cause with #26316, #26317, #26318, #26320. See #26323: posts are deleted locally by a first-page list sync while still in use.

Sentry: JETPACK-IOS-1GFE

Not actually new in 27.3. On 27.3 these events land in JETPACK-IOS-1GFE, but the same crash (same title, culprit and stack) was grouped as JETPACK-IOS-1HPP and JETPACK-IOS-1HQY on 26.9 to 27.2. Sentry regrouped it on 27.3, possibly because 27.3 was the first build made with Xcode 27 (#26018); that's unconfirmed. The 27.2→27.3 window has no editor or post-list change that explains it.

Sentry snapshot (as of Oct 30, 2026)

Users by release (all three groups, last 90 days): 27.3: 46 · 27.2: 43 · 27.1: 42 · 27.0: 10 · 26.9: 4. 27.3 has about 4.2× as many users reporting any error as 27.2, so per user this is lower on 27.3, not a regression.

Devices: mostly recent iPhones (iPhone 14 to 17 Pro), plus a few iPads. iOS 26.5 to 27.2. App in the foreground.

Stack (fatal, EXC_BREAKPOINT):
EditPostViewController.viewDidAppear → showEditor() (EditPostViewController.swift:128) → EditorFactory.instantiateEditor (EditorFactory.swift:23) → AztecPostViewController.init (AztecPostViewController.swift:450) → precondition(post.managedObjectContext != nil).
The post handed to the editor has already been deleted from Core Data.

Breadcrumb patterns (3 events read)

  • 3 of 3: the user closes an editor (closeWasPressed, sometimes with the discard/save alert) while a POST …/posts/…?context=edit save is still in flight, then opens an editor again within ~1–2 seconds. The new EditPostViewController crashes as it appears.
  • 2 of 3: the Posts list (Drafts tab) is open and its first page re-syncs (status=draft,pending&offset=0) repeatedly while the editor is up.
  • 1 of 3: iPad split view.

Candidate code (hypotheses, not confirmed)

  1. Stale rows while an editor is open. PostListEditorPresenter.openEditor posts .postListEditorPresenterWillShowEditor, and AbstractPostListViewController responds by setting fetchResultsController.delegate = nil until the editor closes. Meanwhile, a first-page sync (PostRepository.paginate with offset == 0 → deleteOtherLocalPosts: true → PostHelper.merge(purgeExisting:)), or the post save itself, can delete a Post that a visible row still references. Tapping that row right after closing passes the deleted object to EditPostViewController.
  2. No guard. Neither PostListEditorPresenter.handle nor EditPostViewController.showEditor checks post.managedObjectContext == nil || post.isDeleted before building the editor.
  • Same root cause as the new mustUseGutenberg crash issue, which shows the same symptom through a different code path. The two could be fixed together.

Repro to try

  1. Use a site with more than 40 posts, so the first page doesn't hold everything. Open My Site › Posts.
  2. Open a post that will use the classic editor (content with no <!-- wp: blocks), make an edit, then close and save.
  3. Immediately, within a second, tap the same post (or one just below it) again.
  4. In parallel, change or trash posts from the web so the next first-page sync purges something. Toggle the network to trigger networkStatusDidChange → automaticallySyncIfAppropriate.
  5. Set a breakpoint on AztecPostViewController.init and check post.isDeleted / post.managedObjectContext.

Pass: the precondition hits, or you can show a row whose post.managedObjectContext is nil.

Representative events

  • de586a8fa25c4e4d8b1827419669bbd1
  • 24365c1b9f13436780e6e8eacffc4d21
  • 42b1534daaa749fb9f20dfc8e8c12e9b (iPad, split view)
  • 70393420835f4750966abde0e6d390fd

Build the Jetpack scheme and sign in using docs/simulator-sign-in.md, with bundle ID com.automattic.jetpack.

When you're done: post the results here. If you now have reliable steps, remove [Status] Needs Repro. If you found the cause and a fix approach, remove [Status] Needs Plan and add [Status] Ready for Dev. Remove Simulator Testable when you're finished.


Generated by Claude Code

主要语言
Swift
星标
3.9k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
136

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

wordpress-mobile/WordPress-iOS 的其他 Issue

查看 wordpress-mobile/WordPress-iOS 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。