From 9bff46a1b01835a9e57f5b49581ed3d94bf8ff8a Mon Sep 17 00:00:00 2001 From: OG T Date: Tue, 24 Mar 2026 15:19:52 +0800 Subject: [PATCH] feat: integrate Sentry + fix CI/CD issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sentry Integration (補強 SignOz): - Add @sentry/nextjs for frontend error tracking + session replay - Add sentry-sdk[fastapi] for backend error tracking - Create sentry.client/server/edge.config.ts - Integrate with next.config.js + instrumentation.ts - Add Sentry exception capture in FastAPI error handler - Create deployment scripts for Self-Hosted @ 192.168.0.110 CI/CD Fixes: - Fix F821 Undefined name 'Field' in incidents.py - Add NEXT_PUBLIC_API_URL env var to CI build step - Add build-arg to Docker build verification E2E Test Improvements: - Fix strict mode violations in dashboard-acceptance tests - Add timeout increase for Phase 4 demo tests - Make tests more resilient to UI variations Co-Authored-By: Claude Opus 4.5 --- .../skills/01-awoooi-frontend-aesthetics.md | 21 + .agents/skills/02-lewooogo-backend-core.md | 23 + .agents/skills/04-awoooi-devops-commander.md | 114 +- .claude/hooks/pre-commit-check.sh | 33 + .claude/settings.json | 166 +- .github/workflows/ci.yaml | 5 + CLAUDE.md | 11 +- apps/api/pyproject.toml | 2 + apps/api/requirements.txt | 1 + apps/api/src/api/v1/incidents.py | 2 +- apps/api/src/db/base.py | 10 +- apps/api/src/main.py | 44 +- apps/web/.eslintrc.js | 6 + apps/web/next.config.js | 16 +- apps/web/package.json | 1 + apps/web/sentry.client.config.ts | 56 + apps/web/sentry.edge.config.ts | 16 + apps/web/sentry.server.config.ts | 31 + .../src/components/ai/ai-command-panel.tsx | 5 +- apps/web/src/components/ai/hitl-section.tsx | 6 +- .../shared/auto-healing-error-boundary.tsx | 10 +- apps/web/src/instrumentation.ts | 17 + apps/web/tests/e2e/action-log.spec.ts | 83 +- .../tests/e2e/approval-card-verify.spec.ts | 2 +- .../tests/e2e/dashboard-acceptance.spec.ts | 134 +- apps/web/tests/e2e/phase4-final-demo.spec.ts | 4 +- apps/web/tests/e2e/phase4-timeline.spec.ts | 6 +- apps/web/tests/e2e/rbac-screenshot.spec.ts | 3 +- .../tests/e2e/visual-armor-upgrade.spec.ts | 11 +- apps/web/tsconfig.tsbuildinfo | 2 +- docs/HARD_RULES.md | 25 + docs/LOGBOOK.md | 21 +- docs/adr/ADR-013-code-annotation-standards.md | 152 ++ docs/qa/AWOOOI_Full_QA_Report.md | 149 ++ docs/qa/qa_report.md | 68 + ops/sentry-self-hosted/deploy.sh | 65 + ops/sentry-self-hosted/docker-compose.yml | 49 + pnpm-lock.yaml | 1854 ++++++++++++++++- scripts/qa-zero-touch.sh | 120 ++ tsconfig.tsbuildinfo | 1 + turbo.json | 3 +- 41 files changed, 3195 insertions(+), 153 deletions(-) create mode 100755 .claude/hooks/pre-commit-check.sh create mode 100644 apps/web/sentry.client.config.ts create mode 100644 apps/web/sentry.edge.config.ts create mode 100644 apps/web/sentry.server.config.ts create mode 100644 apps/web/src/instrumentation.ts create mode 100644 docs/adr/ADR-013-code-annotation-standards.md create mode 100644 docs/qa/AWOOOI_Full_QA_Report.md create mode 100644 docs/qa/qa_report.md create mode 100644 ops/sentry-self-hosted/deploy.sh create mode 100644 ops/sentry-self-hosted/docker-compose.yml create mode 100755 scripts/qa-zero-touch.sh create mode 100644 tsconfig.tsbuildinfo diff --git a/.agents/skills/01-awoooi-frontend-aesthetics.md b/.agents/skills/01-awoooi-frontend-aesthetics.md index a4b90d08..8b2fe491 100644 --- a/.agents/skills/01-awoooi-frontend-aesthetics.md +++ b/.agents/skills/01-awoooi-frontend-aesthetics.md @@ -47,6 +47,27 @@ useState() // 管理 SSE 串流狀態 - 無數據時顯示 `"--"` 或空狀態組件 - 禁止使用假數據填充 UI +### 5. ADR-013 代碼註解規範 + +**強制 JSDoc 場景**: +```typescript +/** + * 簽核待審批請求 + * @param id - Approval UUID + * @param signerId - 簽核者 ID (需有對應 Tier 權限) + * @returns 簽核結果,包含是否觸發執行 + * @throws {UnauthorizedError} 簽核者權限不足 + */ +async function signApproval(id: string, signerId: string): Promise +``` + +**強制 data-testid**: +```tsx +// 命名: -[-] +