[refactor] PR3-按页面 URL 区分历史进度#2275
Conversation
- 为单条 Progress 记录 episodePageUrl 并优先按 URL 匹配 - 兼容旧集数进度并在查询、更新、同步路径懒回填 URL - 增加历史仓储、同步和播放恢复定位测试
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental review of the Files Reviewed (5 files)
Previous Review Summary (commit f350b15)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit f350b15)Status: No Issues Found | Recommendation: Merge Reviewed the PR3 change that adds per- Files Reviewed (11 files)
Reviewed by claude-4.8-opus-20260528 · Input: 4.7K · Output: 9.5K · Cached: 472.9K |
|
如果我的理解没有错误,这里的设计可能有一个小问题 假设我们更新了某条规则的 baseURL ,那么在升级之后,历史记录里作为身份凭据的 pageURL 将不再匹配,虽然我们通过 fallback 路径可以正确播放,但是我们将记录新的历史记录 这意味着规则没升级一次,都会产生同一规则的重复历史记录,这符合预期吗 以及一个代码清洁问题 _HistoryEpisodeMatcher 被几乎完全相同地实现了两次 |
我认为规则 baseURL 升级不应污染观看历史,目前是不符合预期的,我还没有比较合适的思路来解决这个问题。 |
|
两种思路:
我想知道你觉得哪种合适? |
|
我觉得第一种方案好一些 因为第二种所谓从根本上解决问题的方案页不靠谱,路径发生变化所以更新规则也是常见的事情 |
When a rule's baseURL changes, history progress entries keep the old normalized pageURL, so playback falls back to episode/road matching but saving allocates a new bucket, creating a duplicate progress per upgrade. Add migrateProgressPageUrls to rewrite stale URLs in place (resolved by the Progress value's road/episode against the current roadList) when the online video page opens, collapsing any duplicate buckets. Subsequent writes then reuse the existing entry instead of duplicating it. Co-authored-by: Cursor <cursoragent@cursor.com>
|
还是有些奇怪 代码在尝试用旧 URL 查找剧集之前,就先用旧的列表位置覆盖了旧 URL 简单说,如果是剧集全部更新完之后的剧集重排 (原来最新集在前,现在第一集在前),最新变更前会进行类似 列表重排 的处理,现在统一理解为 baseURL 已经变化 我总觉得所有问题都来自这一系列设计的前提,也就是以 URL 为判据并非不合理,但是要考虑其变化,不能以其不变为前提进行设计 我们可以先回滚最新变更,前一个变更位置其实不会出现重复历史记录卡片,虽然其内部有记录重复,但是看上去不是那么重要 |
|
我要思考一天 - - 暂时不打算改了,一定有更合适的解决方案。 |
摘要
本 PR 为统一集数身份的 PR3:历史进度记录新增单条
Progress.episodePageUrl,让播放历史在同一集数编号但不同页面 URL 的场景下可以按 URL 精确恢复。主要变更
Progress持久化episodePageUrl,并保持旧数据缺字段时默认为空字符串。episodePageUrl在当前分线路列表中重新定位,源列表重排后仍能恢复到正确条目。episodePageUrl表示单条进度 URL,watch-state 仍表示最后观看 URL;旧 payload 缺字段继续兼容。兼容性
验证
flutter test test/history_repository_test.dart test/history_sync_test.dart test/episode_ref_test.dart test/episode_url_test.dartflutter analyze --no-fatal-infos