fix(awooop): Phase 2 初批 P0 修正 + Phase 1 Task 1.7 integration tests
## P0 安全 / 架構修正
### P0-08 telemetry.py — 移除硬碼 IP assert(ADR-121)
- config.py:新增 OTEL_ALLOWED_ENDPOINTS(預設 192.168.0.188)+ OTEL_FORBIDDEN_ENDPOINTS
- telemetry.py:_validate_endpoint() 改為 config-driven allowlist/forbidlist
- EwoooC 可用 env 覆寫 OTEL_ALLOWED_ENDPOINTS 指向自己的 SigNoz host
### P0-13 mcp_bridge.py — K8s namespace 由 settings 提供
- config.py:新增 AWOOOI_K8S_NAMESPACE(預設 "awoooi-prod")
- mcp_bridge.py:5 處 parameters.get("namespace", "awoooi-prod") → settings.AWOOOI_K8S_NAMESPACE
- EwoooC/Tsenyang 可設自己的 namespace
### P1-24 decision_manager.py — silence key 常數統一
- 新增 from src.services.telegram_gateway import SILENCE_KEY_PREFIX
- f"telegram_silence:{target}" → f"{SILENCE_KEY_PREFIX}{target}"
- 消除跨兩處重複定義(ADR-118 No Island Coding 原則)
## Phase 1 Task 1.7 Integration Tests
- tests/integration/test_awooop_phase1_schema.py:31 個測試案例
- awooop_projects CHECK 約束(4 cases)
- revision 不可變性 trigger(5 cases:draft 可改、published 鎖住、身份欄不可改、非法流轉、DELETE 禁止)
- awooop_published_revisions VIEW draft/published 隔離(2 cases)
- active_pointer_guard(3 cases:不可指向 draft、可指向 active、跨租戶 mismatch)
- RLS fail-closed(3 cases:未設/錯設/正確設 project_id)
- outbox FK + dedup(2 cases)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -429,7 +429,8 @@ class Settings(BaseSettings):
|
||||
|
||||
# ==========================================================================
|
||||
# OpenTelemetry (可觀測性鐵律)
|
||||
# 四主機架構強制校驗: OTEL 必須指向 192.168.0.188
|
||||
# 四主機架構強制校驗: OTEL 必須指向 192.168.0.188(AWOOOI 主站)
|
||||
# ADR-121 + P0-08 修正:改為 config-driven,允許 EwoooC 指向不同 host
|
||||
# ==========================================================================
|
||||
OTEL_ENABLED: bool = Field(
|
||||
default=True,
|
||||
@@ -439,6 +440,18 @@ class Settings(BaseSettings):
|
||||
default="192.168.0.188:24317",
|
||||
description="SigNoz OTLP gRPC endpoint (Host port 24317 -> Container 4317) - NO http:// prefix for gRPC",
|
||||
)
|
||||
OTEL_ALLOWED_ENDPOINTS: list[str] = Field(
|
||||
default=["192.168.0.188"],
|
||||
description="允許的 OTEL endpoint host 列表(逗號分隔可用 env 覆寫)。EwoooC 可設自己的 SigNoz host。",
|
||||
)
|
||||
OTEL_FORBIDDEN_ENDPOINTS: list[str] = Field(
|
||||
default=["192.168.0.110", "192.168.0.112", "192.168.0.120", "192.168.0.121"],
|
||||
description="明確禁止的 OTEL endpoint host 列表(不允許誤指向非 SigNoz 主機)",
|
||||
)
|
||||
AWOOOI_K8S_NAMESPACE: str = Field(
|
||||
default="awoooi-prod",
|
||||
description="K8s namespace(P0-13 修正:不再硬碼,EwoooC/Tsenyang 可設自己的 namespace)",
|
||||
)
|
||||
OTEL_SERVICE_NAME: str = Field(
|
||||
default="awoooi-api",
|
||||
description="Service name for tracing",
|
||||
|
||||
Reference in New Issue
Block a user