Codex/audit tmp migration - #93
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. 结构化阅读笔记
旧分支在
tmp/js/bundles/reading-page.bundle.js中实现了:note = { id, title, body, quote, outlineId, order, createdAt, updatedAt };noteId。目标源码:
js/runtime/unifiedReadingPage.jsjs/runtime/readingHighlightShared.js2. 草稿与提交后注释持久化
旧分支保存以下阅读上下文:
answershighlightsnoteTextnotesnoteOutlinesmarkedQuestionsscrollY并在
pagehide/visibilitychange时强制 flush。Review 模式会尝试按原记录 id 更新笔记和标注。该行为值得迁移,但旧实现把草稿和 autosaved record 直接写入
practice_records,不符合当前架构。阅读练习运行在 iframe 内,不能假设其中存在主窗口的PracticeRecordAPI;迁移后应通过带 window/session token 校验的父子窗口消息分流:PRACTICE_COMPLETE,由父窗口调用PracticeRecordAPI.saveCompletion;getById后合并,并以原 id 调用saveRecord({ updateStats: false })。3. 结果题号回跳原文证据
旧分支把结果表题号变为跳转按钮,并根据 explanation locator snippet 或段落标签建立原文定位;无法精确匹配时使用 overlap fallback。
该功能可独立于数据层迁移,但锚点必须在文本或 DOM 改动时无损降级,不能错误绑定到其他段落。
4. 阅读显示控制
旧分支在 header 中动态加入:
这些属于 settings/UI preference,不应写入练习记录。可继续走当前设置仓库或明确的 UI preference key。
5. 旧分支的补偿逻辑
旧分支还实现了:
practice_records合并迁移。这些是旧写入模型造成的补偿,不应原样迁移。当前数据层已经集中处理 canonical record 和 id 去重;应修复生产端,不应依赖展示层掩盖重复记录。
数据接口重定向
当前硬规则:
practice_records和user_stats只能通过PracticeRecordAPI写入。dataRepositories.practice已不再公开,PracticeCore.store也是只读 public store,raw storage 与simpleStorageWrapper对受保护 key 的写入会抛错。dataRepositories.practice.list()PracticeRecordAPI.list()/listSummary()practice.getById(id)PracticeRecordAPI.getById(id)practice.upsert(record)/PracticeCore.store.savePracticeRecordPracticeRecordAPI.saveRecord(record, options)examIdPracticeRecordAPI.saveCompletion(...)storage.set('practice_records')PracticeRecordAPI.replace(...)updateStatsdeleteById、deleteMany、clearuser_stats读写readStats、writeStats、mergeStats、resetStatsBackupAPILibraryManager+ResourceCoreVocabStore/VocabDataIO