Skip to content

修正:處理 #3/#4 的 Codex 審查意見 - #5

Merged
keanu77 merged 2 commits into
mainfrom
fix/codex-followups-3-4
Oct 19, 2026
Merged

keanu77 merged 2 commits into
mainfrom
fix/codex-followups-3-4

Conversation

@keanu77

@keanu77 keanu77 commented Oct 19, 2026

Copy link
Copy Markdown
Owner

處理已合併的 #3、#4 上 Codex(chatgpt-codex-connector)留下、還沒處理的審查意見。7 則都是 P2,對照 main 後都還存在,這個 PR 全部修正。Codex 的 review 本文和摘要留言沒有額外的待辦,只有下面這些行內意見。

逐則處理

# Codex 意見 處理 做法
#3 qrcode 沒安裝就跑產生器 ✅ 修正 qrcode 加進 skill 的 package.json/lock,resolve.mjs 的 SKILL_LOCAL 加入 qrcode。install.sh 本來就會在 skill 目錄 npm ci,所以照文件裝完就能直接用;live-poll README 也註明了。實測:簡報目錄沒有 node_modules 時,poll-slides.mjs 可以正常產出
#3 投票頁開題的競態 ✅ 修正 onShow 遞增換頁序號,enterPoll 在 await 結果回來後如果發現已經換頁,就不送開題;control() 改成排隊依序送出,「離開」不會比「開題」先到後端。只檢查 current === id 擋不住 A→B→A 這種快速來回,所以用序號
#3 偶數筆時中位數算錯 ✅ 修正 改成取中間兩筆的平均。worker 抽出 src/stats.js 的 median(),並加上 test/stats.test.js([0,100]→50 等);投影片端的模擬模式也同步修正
#3 重連時多開一條 socket ✅ 修正 手機頁 connect() 先取消已排定的重連;已經在連線中或已連上就直接返回;舊 socket 晚到的 close 會被忽略
#4 英文 README 部署後還停在 my-poll 目錄 ✅ 修正 README.en.md 和 README.md(中文版也有同樣問題)的部署指令改在子 shell ( cd my-poll && … ) 裡跑;live-poll/README.md 部署區塊最後補上 cd ..
#4 Demo 安裝頁還寫 Node 18+ ✅ 修正 demo/src/index.html 改成 Node 20+,並用 npm run build 重新產生 docs/index.html(diff 只有這行和內嵌的 live-poll.js 修正)
#4 模擬模式加入頁的人數沒有初始化 ✅ 修正 模擬模式在 start() 就把 .lp-phones 設成模擬人數,不必先進一次投票頁

另外:worker package.json 加了 npm test,CI 的 Syntax checks 也會跑 node --test;CHANGELOG 的 Unreleased 補一行說明。

驗證(本機)

  • CI 的 Syntax checks 整段在 Node 20.19.2 下跑過:全部 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 都通過
  • 用 Playwright 測行為,修正前/後對照:
    • 進投票頁後,results 還沒回來就離開。修正前會送出 [{poll:null},{poll:"warmup",phase:"open"}](重新開題);修正後只送 [{poll:null}]
    • 投票頁快速切到下一個投票頁:修正前會多送一次過期的 warmup 開題;修正後不會
    • 模擬模式開在加入頁:修正前顯示 0,修正後顯示 60
    • 手機頁斷線後馬上回到前景:修正前同時開著 2 條 socket,修正後只有 1 條

請審閱,不要自動合併。

- 中位數偶數筆取中間兩筆平均(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
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T00:14:59.692304Z 87f5554 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已在 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。
@keanu77
keanu77 merged commit b511b09 into main Oct 19, 2026
2 checks passed
@keanu77
keanu77 deleted the fix/codex-followups-3-4 branch October 19, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant