Files
awoooi/apps/api/pyproject.toml
OG T 54d6818b8d
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
fix(sensors+rules+dedup): 全景三根因修復 — asyncssh缺失/YAML規則空洞/重複卡片
Fix 1: asyncssh 未安裝 → sensors_succeeded 永遠=0
  - apps/api/pyproject.toml 加入 asyncssh>=2.14.0
  - 根因:ssh_provider.py 的 import asyncssh 在 try/except 外,ImportError 直接噴出
  - 效果:15 個 SSH tool 全部恢復可用

Fix 2: YAML 規則空洞 → HostHighLoadAverage/PostgreSQLDiskGrowthRate 落 generic_fallback → restart
  - 合併 host_cpu_high 為 host_resource_alert,覆蓋 25+ 個主機層 alertname
  - 新增 postgresql_disk_monitoring 規則,覆蓋磁碟增長/exporter/vacuum 類告警
  - 所有主機層/磁碟監控告警 → NO_ACTION,禁止 kubectl restart

Fix 3: 同一 incident 被多 pod 同時處理 → 送出 3 張重複 Telegram 卡
  - decision_manager.get_or_create_decision(): ANALYZING 狀態加入早返回
  - 根因:ANALYZING 不在 (READY/EXECUTING/COMPLETED) 條件 → pod-B/C 各自建新 token

2026-04-16 ogt + Claude Sonnet 4.6 (台北時區)
2026-04-16 22:23:49 +08:00

120 lines
3.7 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[project]
name = "awoooi-api"
version = "0.1.0"
description = "AWOOOI BFF API Gateway"
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"fastapi>=0.115.0", # Upgraded for starlette 1.0.0 compatibility (claude-agent-sdk)
"uvicorn[standard]>=0.27.0",
"pydantic>=2.5.0",
"pydantic-settings>=2.1.0",
"httpx>=0.26.0",
"redis>=5.0.0",
"asyncpg>=0.29.0",
"structlog>=24.1.0",
# CTO-201: Infrastructure Execution Engine
"kubernetes-asyncio>=29.0.0",
"sqlalchemy[asyncio]>=2.0.0",
# NOTE: 禁止 aiosqlite/SQLite (AWOOOI 鐵律 #2),使用 asyncpg + PostgreSQL
# OpenTelemetry (SigNoz Integration)
"opentelemetry-api>=1.20.0",
"opentelemetry-sdk>=1.20.0",
"opentelemetry-exporter-otlp>=1.20.0",
"opentelemetry-instrumentation-fastapi>=0.41b0",
"opentelemetry-instrumentation-httpx>=0.41b0",
"opentelemetry-instrumentation-logging>=0.41b0",
# Sentry (Error Tracking - 補強 SignOzSelf-Hosted @ 192.168.0.110)
"sentry-sdk[fastapi]>=2.0.0",
# Langfuse (LLMOps - Phase 15.1Self-Hosted @ 192.168.0.110:3100)
# 2026-04-02 Claude Code: 鎖定 v2.60.x — v3.x/v4.x 移除 client.trace() API與 langfuse_client.py 不相容
# v2.x 最高版 = 2.60.10,有 client.trace()、trace.generation()、trace.score()
"langfuse>=2.0.0,<3.0.0",
# Prometheus (ADR-037 Wave A.5 監控指標)
"prometheus-client>=0.20.0",
# Phase 6.4g: leWOOOgo Brain - 積木化決策引擎
# NOTE: Local packages 透過 Dockerfile 預先安裝,無需在此列出
# 請參閱 apps/api/Dockerfile Phase 6.4i 註解
# Phase 9: Agent Teams - Claude Agent SDK
"claude-agent-sdk>=0.1.50",
# Sprint 5.1 2026-04-08 Claude Sonnet 4.6: Service Registry YAML 讀取
"pyyaml>=6.0.0",
# Phase 4 ADR-084: 動態異常偵測 (2026-04-15 ogt: 補齊缺失依賴)
"statsmodels>=0.14.0",
"drain3>=0.9.11",
"sse-starlette>=1.8.0",
# 2026-04-16 ogt + Claude Sonnet 4.6: SSH MCP sensor 修復 — asyncssh 缺失導致 sensors_succeeded=0
# 根因: ssh_provider.py 中 import asyncssh 在 try/except 外,所有 15 個 SSH tool 直接 ImportError
"asyncssh>=2.14.0",
]
# [tool.uv.sources]
# lewooogo-brain = { path = "../../packages/lewooogo-brain", editable = true }
[project.optional-dependencies]
dev = [
"pytest>=7.4.0",
"pytest-asyncio>=0.23.0",
"pytest-cov>=4.1.0",
"ruff>=0.1.0",
"mypy>=1.8.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src"]
[tool.ruff]
target-version = "py311"
line-length = 88
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long (handled by formatter)
]
[tool.ruff.lint.isort]
known-first-party = ["src"]
[tool.mypy]
python_version = "3.11"
# 漸進式類型檢查 (業界最佳實踐)
# strict = true # TODO: 當所有模組都完成類型註解後啟用
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false # 暫時關閉,允許部分函數無類型
disallow_incomplete_defs = false
check_untyped_defs = true
ignore_missing_imports = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
# 排除舊代碼 (漸進式遷移)
[[tool.mypy.overrides]]
module = [
"scripts.*",
"tests.*",
]
ignore_errors = true
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
addopts = "-m 'not integration'"
markers = [
"integration: 需要外部服務 (Redis/PostgreSQL/K8s) 的整合測試,需在有外部服務的環境執行",
]