Repository navigation
修正:處理 #3/#4 的 Codex 審查意見 - #5
Conversation
- 中位數偶數筆取中間兩筆平均(worker 抽出 stats.js 並加測試;模擬模式同步) - 投影片端換頁競態:控制請求排隊、換頁序號擋掉過期的開題 - 手機頁重連:取消排定的重連、已在連線就不再開新 socket - 模擬模式啟動即設定加入頁人數 - qrcode 改為 skill 自帶套件(resolve.mjs SKILL_LOCAL) - README 部署指令改用子 shell;live-poll README 補 cd .. - Live Demo 改為 Node 20+,重新 build docs/index.html - CI 執行 worker 的 node --test
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 87f5554f85
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const control = body => api('/api/control', { | ||
| // 控制請求排隊依序送出,快速換頁時「開題」不會晚於「離開」抵達後端 | ||
| let ctlChain = Promise.resolve(); | ||
| const control = body => (ctlChain = ctlChain.catch(() => {}).then(() => api('/api/control', { |
There was a problem hiding this comment.
Drop obsolete commands before replaying the control queue
When a /api/control request stalls during a network interruption and the presenter advances through several slides or actions, every later command is appended to this chain and starts only after its predecessor; because each request has its own five-second timeout, opening the current poll can be delayed by multiple timeout periods, and obsolete poll states may briefly be broadcast after connectivity returns. Skip or coalesce stale navigation commands using navSeq inside the queued callback rather than blindly replaying the entire backlog.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
已在 fc0af18 修正:control() 多帶一個參數 seq。換頁指令(開題、離開、回到已揭曉的題)排隊輪到時,若 seq !== navSeq 就直接略過、不送請求,所以斷線恢復後只會送出最新狀態,不再重播舊題,也不會一個接一個累積 5 秒逾時。佇列本身維持依序送出,最後停在非投票頁時,離開(poll:null)一樣會送出。揭曉(A)和清空(Shift+R)是講者主動的操作,照常送出。已用 Playwright 模擬 /api/control 卡住時連換多頁:舊版會補送 null、warmup open、null、size open,新版只送 size open。docs/index.html 已重新 build。
斷線時 /api/control 卡住、講者連換多頁,積壓的換頁指令輪到時若已換過頁就略過, 只送最新狀態;不會重播舊題、也不會疊加多次逾時。揭曉/清空照送。 重新 build docs/index.html。
處理已合併的 #3、#4 上 Codex(chatgpt-codex-connector)留下、還沒處理的審查意見。7 則都是 P2,對照 main 後都還存在,這個 PR 全部修正。Codex 的 review 本文和摘要留言沒有額外的待辦,只有下面這些行內意見。
逐則處理
qrcode加進 skill 的package.json/lock,resolve.mjs的SKILL_LOCAL加入qrcode。install.sh本來就會在 skill 目錄npm ci,所以照文件裝完就能直接用;live-poll README 也註明了。實測:簡報目錄沒有node_modules時,poll-slides.mjs可以正常產出onShow遞增換頁序號,enterPoll在await結果回來後如果發現已經換頁,就不送開題;control()改成排隊依序送出,「離開」不會比「開題」先到後端。只檢查current === id擋不住 A→B→A 這種快速來回,所以用序號src/stats.js的median(),並加上test/stats.test.js([0,100]→50 等);投影片端的模擬模式也同步修正connect()先取消已排定的重連;已經在連線中或已連上就直接返回;舊 socket 晚到的close會被忽略README.en.md和README.md(中文版也有同樣問題)的部署指令改在子 shell( cd my-poll && … )裡跑;live-poll/README.md部署區塊最後補上cd ..demo/src/index.html改成 Node 20+,並用npm run build重新產生docs/index.html(diff 只有這行和內嵌的live-poll.js修正)start()就把.lp-phones設成模擬人數,不必先進一次投票頁另外:worker
package.json加了npm test,CI 的 Syntax checks 也會跑node --test;CHANGELOG 的 Unreleased 補一行說明。驗證(本機)
node --check、demo 模擬模式檢查、polls.json、py_compile、bash -n、ruff check都通過node --test test/stats.test.js:3 項通過,Node 20、22 都有跑offline-build-template:npm run all通過;qa-screenshots、print-pdf、render-slides都通過[{poll:null},{poll:"warmup",phase:"open"}](重新開題);修正後只送[{poll:null}]warmup開題;修正後不會請審閱,不要自動合併。