fix(p36): cd.yaml SPA shadow 偵測 bash -e exit bug 修復
Some checks failed
CD Pipeline / deploy (push) Failing after 2m27s

run 280 failure 根因:P34 寫 `[ -n "$XPT" ] && [ "$X" != "0" ] && FLASK_OK=1`
三條 && 串連在 Gitea Actions 的 bash -e 模式下,第一條 -n 判斷 false
就 exit 1(empty XPT 是常態,因 mo.wooo.work /health 不帶 x-process-time)。

改 if/then/fi block — 純條件分支不影響 exit code。

驗證真 prod 已通:
- mo.wooo.work/observability/ai_calls 回 35700 byte Flask login 重導頁
  (session cookie 正常 set,35700 != 7480 SPA shell)
- mo.wooo.work/admin/ai_calls 回 404(P32 改名後正確不存在)
我 27-35 phase 全部活在 prod 上,只是 192.168.0.188 LAN 是別 project 干擾。
This commit is contained in:
OoO
2026-05-04 14:30:18 +08:00
parent 46255720ee
commit 64fe4fb651

View File

@@ -340,9 +340,10 @@ jobs:
CLEN=$(echo "$HDR" | grep -i '^content-length:' | awk '{print $2}' | tr -d '\r')
XPT=$(echo "$HDR" | grep -i '^x-process-time:' | awk '{print $2}' | tr -d '\r')
FLASK_OK=0
[ -n "$XPT" ] && [ "$XPT" != "0" ] && FLASK_OK=1
[ -n "$ETAG" ] && [ "$ETAG" != "$SPA_ETAG" ] && FLASK_OK=1
[ -n "$CLEN" ] && [ "$CLEN" != "$SPA_LEN" ] && FLASK_OK=1
# P36 修:用 if/then 而非 && 串連,避免 bash -e 在第一條 false 就 exit
if [ -n "$XPT" ] && [ "$XPT" != "0" ] && [ "$XPT" != "0.0" ]; then FLASK_OK=1; fi
if [ -n "$ETAG" ] && [ "$ETAG" != "$SPA_ETAG" ]; then FLASK_OK=1; fi
if [ -n "$CLEN" ] && [ "$CLEN" != "$SPA_LEN" ]; then FLASK_OK=1; fi
if [ "$FLASK_OK" != "1" ]; then
echo "❌ SPA Shadow 偵測:/health 看似 200 但 nginx fallback 攔截"
echo " etag=$ETAG (SPA=$SPA_ETAG)"