Repository navigation
fix(desktop): 界面检查的结果没送到程序时重新发送,悬浮窗的检查不再漏进日志 - #250
Merged
Merged
Conversation
托管 macOS 上悬浮窗的界面检查结果两次没有进日志(CI 42546063667、42772486837), 同一文档的其他调用都送到了:悬浮窗照常显示了被拒的修改。ui_guard.js 原先只发一次报告, 被拒收或没有回应都不再发;页面的事件监听被拒时会重试(§33.2),报告没有。 - ui_guard.js:报告发到程序收下为止。被拒收的隔 250 ms 再发、间隔加倍到最长 5 s, 5 秒没有回应的立刻再发,最多 8 次;每次发送带着文档的标识。 - ui_guard.rs:晚到的回应和之后的发送都到了时,每个文档只记一行(记得最近 64 个文档)。 - 测试先写、在原代码上失败:ui-guard.test.ts 新增 5 个,ui_guard.rs 的 regression_a_document_whose_report_came_twice_is_logged_once。
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #250 +/- ##
==========================================
+ Coverage 93.56% 93.58% +0.02%
==========================================
Files 489 489
Lines 85860 85908 +48
Branches 4909 4909
==========================================
+ Hits 80338 80401 +63
+ Misses 4853 4838 -15
Partials 669 669
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
问题
托管 macOS(Apple 芯片)上,菜单栏冒烟测试的悬浮窗界面检查失败过两次(CI 42546063667、42772486837):Voltip 的日志里始终没有悬浮窗那一行
the window runs the interface the program carries window="overlay"。第二次失败时悬浮窗照常显示了被拒绝的修改,说明同一个文档的其他调用(事件监听、状态)都送到了程序,只有界面检查的报告没有。原因在
ui_guard.js:检查结果只发一次,程序拒收或一直没有回应时直接丢掉,也不留记录。页面的事件监听被拒时会重试(docs/dictation.md §33.2),这份报告没有。改动
apps/desktop/src-tauri/src/ui_guard.js:报告发到程序收下为止。被拒收的隔 250 ms 再发,间隔加倍到最长 5 s(和事件监听的重试相同);5 秒没有回应的立刻再发;最多发 8 次,8 次都没送到时控制台说明一句。每次发送带着这个文档的标识。apps/desktop/src-tauri/src/ui_guard.rs:晚到的回应和之后的那次发送可能都到,程序按文档标识每个文档只记一行(记得最近 64 个文档)。docs/dictation.md§33.4、§33.6 和docs/acceptance.md对应更新。用户看不到变化:检查本身不变,日志里每个窗口仍是一行。
测试
按仓库规定先写测试、在原代码上确认失败,再改代码:
apps/desktop/src/ui-guard.test.ts新增 5 个(被拒收后再发、没有回应时再发、收到后不再发(包括晚到的回应)、一直被拒收时最多 8 次、每个文档的标识不同),实现之前 5 个都失败。ui_guard.rs的regression_a_document_whose_report_came_twice_is_logged_once:同一文档的报告到了两次,实现之前记了两行。另加the_program_remembers_the_latest_documents_it_logged。make verify通过(见下)。这个失败大约 3% 的运行出现一次(之前 70 次左右的运行里 2 次),一两次 CI 证明不了修好,只能看之后 main 上的运行。合并前在分支上手动跑一次 CI,让两台 Mac 都跑菜单栏冒烟测试。