← Foundations Course

FOUNDATIONS PHASE 2 · 24

Architecture Case:一個「課程載不出來」到底可能壞在哪一層?

這一課把 17–23 全部拿來做 incident。你不需要立刻知道答案;你要能用 evidence 把問題空間逐層縮小。

Learning outcomes

1. Incident

Symptom:
Production Course page shows
"Unable to load courses"

Local development:
works

Latest CI:
green

這些資訊還不足以直接判斷是 frontend、network、server、DB 或 production config。

2. Browser Evidence

GET /api/courses
Status: 500

Response:
{"error":"internal_error"}

HTML/JS 至少已執行到送 request;DNS/TLS/route 也已到 server 能回 500。

3. Server Evidence

request_id=abc
route=GET /api/courses
error="column score does not exist"

現在 hypothesis 收斂到 server/database schema mismatch,而不是 CSS 或 DNS。

4. Database Evidence

production schema:
courses(id,title)

application expects:
courses(id,title,score)

Root cause 是 application version 依賴新 schema,但 production migration 尚未完成。

5. Fix Strategy

Option A:
apply compatible migration

Option B:
rollback application

Choose based on:
risk
data migration state
user impact
rollback safety

6. Regression Evidence

DB migration PASS
GET /api/courses → 200
Browser page → course list visible
CI → green
production smoke → PASS

Project checkpoint:Architecture Evidence Chain

UI symptom
  ↓ Network
HTTP 500
  ↓ request id
server log
  ↓
SQL/schema error
  ↓
migration mismatch
  ↓
fix
  ↓
API + UI + smoke PASS

這種 evidence chain 才能讓你 review AI 修法,而不是只接受「我猜是 API 問題」。

7. Root Cause vs Symptom

「畫面顯示錯誤」是 symptom;「API 500」是較接近 failure layer 的 evidence;「production schema 沒 migration」才是 root cause。

Knowledge check

  1. HTTP 500 出現後,CSS 還是第一優先嗎?
  2. request id 如何幫跨層追蹤?
  3. 為什麼 CI green 仍可能 production schema mismatch?
  4. 不看答案,重畫這次 incident 的 evidence chain。