Commit Graph

6 Commits

Author SHA1 Message Date
OG T
89f0bae3f2 feat(safety-net): complete wave 1 atomicity (adr-038, adr-039, debounce, graceful degrade, xclaim)
Some checks failed
E2E Health Check / e2e-health (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
2026-03-29 23:55:38 +08:00
OG T
d89f0520f9 fix(api): 修復 34 個 Ruff lint 錯誤
- 自動修復 import 排序、unused imports
- 手動修復 raise from、isinstance union、unused variable
- scripts/ 暫時保留 (非 CI 阻擋)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-29 15:27:49 +08:00
OG T
a470a514e6 refactor(api): Phase 17 P0 Router 層違規全部修復
消除 Router 層直接存取 Redis/DB 的違規:

incidents.py (6 處):
- 改用 IncidentService.get_active_incidents()
- 改用 IncidentService.get_from_working_memory()
- 改用 IncidentService.update_outcome()
- 改用 IncidentService.resolve_incident()
- 改用 IncidentService.find_by_proposal_id()

stats.py (8 處):
- 新增 StatsService 封裝快取邏輯
- 移除直接 Redis 存取

audit_logs.py (7 處):
- 新增 AuditLogRepository 封裝 DB 操作
- Router 改用 Repository 層

webhooks.py (2 處):
- 新增 SignalProducerService 封裝 Redis Stream
- 改用 IncidentService.save_to_working_memory()

符合 leWOOOgo 積木化規範:
Router → Service → Repository → DB/Redis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-26 13:06:47 +08:00
OG T
c0ad8f8686 fix(api): 方案 C - Incident 解析相容舊格式 Enum
問題: Redis 存有舊 Enum 值 (status='open', severity='critical')
      導致 Pydantic 驗證失敗

解法:
- normalize_status(): 'open' → 'investigating'
- normalize_severity(): 'critical' → 'P0' 等
- 應用於 get_from_working_memory, get_active_incidents, _record_to_incident

優點:
- 零資料風險 (不動 Redis)
- 回滾 = git revert (秒級)
- 新舊格式都能讀

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-25 14:14:58 +08:00
OG T
6f049877fc fix(lint): ruff auto-fix + lewooogo-core src 加入 git
- Python: ruff --fix 修復 280 個 lint 錯誤
- lewooogo-core: src/ 目錄未追蹤,導致 CI eslint 失敗

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-23 23:51:37 +08:00
OG T
196d269b92 feat: add all application source code
- apps/api: FastAPI backend with Dockerfile
- apps/web: Next.js frontend with Dockerfile
- apps/sensor: Signal collection agent
- packages: shared packages

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-22 18:57:44 +08:00