t161+t162 修 leo prod 實撞兩病:庫清單靜默空白/「需要更新」假警報迴圈

t162(假警報,實錘):daemon cloudVersionStale() 讀 cypher /health 的 bundle_version
比對 minCloudBuilt(2026-07-28),但 **/health 從來只回 {ok:true}、沒有這個欄位**
⇒ 恆讀到空字串 ⇒ 恆判 stale ⇒ 「知識庫需要更新」永遠不消失,重裝也沒用
(leo:「按下就跳到 install,但重新更新後並不會消失,這個訊息是幹嘛的?」)。
安裝器其實一直有注入 ARCRUN_BUNDLE_VERSION(worker.js:819),只是沒人吐出來。
修:/health 讀該 var 誠實回報(未注入則省略欄位=老實例,daemon 判 stale 是對的)。
新 bundle 注入值 2026-07-31+<commit7> ≥ 2026-07-28 ⇒ 重裝後警報自然消失。

t161(庫清單空白):portal 前端 guard401 → dropSession() **靜默**清 token 跳登入頁,
畫面不說任何原因 ⇒ 用戶看到的是「庫不見了」而非「請重新登入」(leo:「實際上根本
沒連上任何庫,清單空白」)。修:dropSession 帶原因寫進 #login-status——
「你的登入已過期,請重新登入(你的資料都還在,不會遺失)。」
資料側無恙(portal_library records=2 已驗),純讀側 session 過期+靜默 UX 缺陷。

驗:cypher tsc 全綠;vitest 9 failed/187 passed=基線不變。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
uncle6me-web
2026-07-31 15:34:27 +08:00
parent 341bcb13c8
commit 9f777ff43e
3 changed files with 29 additions and 4 deletions
+9 -1
View File
@@ -674,11 +674,19 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return {
if (!location.hash) location.hash = '#/' + HOME;
route();
}
function dropSession() {
// t161leo 07-31 實撞:「實際上根本沒連上任何庫,清單空白」):session 過期時
// 舊行為=靜默清 token 跳回登入頁,**畫面不說任何原因** ⇒ 用戶以為「庫不見了/系統壞了」。
// 友善=前端:踢回登入頁時一定要說「為什麼」,用戶才知道下一步做什麼(重新登入即可,資料都在)。
function dropSession(reason) {
S.token = '';
S.profile = null;
try { localStorage.removeItem('arcrun_portal_session'); } catch (e) { /* noop */ }
showAuth();
var msg = reason || '你的登入已過期,請重新登入(你的資料都還在,不會遺失)。';
try {
var el = $('login-status');
if (el) el.textContent = msg;
} catch (e) { /* 登入殼還沒渲染就算了 */ }
}
function boot() {
if (!S.token) { showAuth(); return; }