fix(agents): accept monitoring coverage source fallback
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m12s
CD Pipeline / build-and-deploy (push) Successful in 4m53s
CD Pipeline / post-deploy-checks (push) Successful in 1m49s

This commit is contained in:
Your Name
2026-07-03 09:39:38 +08:00
parent 7093dae3b8
commit 80dae85eb2
3 changed files with 53 additions and 4 deletions

View File

@@ -1082,15 +1082,23 @@ def _inspect_source_contract(repo_root: Path) -> dict[str, bool]:
"apps/api/src/services/telegram_alert_learning_context_post_apply_verifier.py",
"telegram_alert_learning_context_post_apply_verifier_v1",
),
"awooop_coverage_surface_present": (
"apps/web/src/components/awooop/autonomous-runtime-receipt-panel.tsx",
"telegram-alert-monitoring-coverage-readback",
),
}
result: dict[str, bool] = {}
for key, (relative_path, marker) in checks.items():
text_value = _read_source_contract_text(repo_root, relative_path)
result[key] = marker in text_value
web_surface_text = _read_source_contract_text(
repo_root,
"apps/web/src/components/awooop/autonomous-runtime-receipt-panel.tsx",
)
api_endpoint_text = _read_source_contract_text(
repo_root,
"apps/api/src/api/v1/agents.py",
)
result["awooop_coverage_surface_present"] = (
"telegram-alert-monitoring-coverage-readback" in web_surface_text
or "/telegram-alert-monitoring-coverage-readback" in api_endpoint_text
)
return result

View File

@@ -323,3 +323,42 @@ def test_telegram_alert_monitoring_coverage_source_contract(tmp_path):
proof = _inspect_source_contract(tmp_path)
assert proof == _source_contract()
def test_telegram_alert_monitoring_coverage_source_contract_accepts_api_container_layout(
tmp_path,
):
(tmp_path / "apps/api/src/api/v1").mkdir(parents=True)
(tmp_path / "apps/api/src/repositories").mkdir(parents=True)
(tmp_path / "apps/api/src/services").mkdir(parents=True)
(tmp_path / "apps/api/src/api/v1/webhooks.py").write_text(
"get_alert_operation_log_repository\n"
'"TELEGRAM_SENT"\n',
encoding="utf-8",
)
(tmp_path / "apps/api/src/repositories/alert_operation_log_repository.py").write_text(
"ALERT_EVENT_TYPES\n",
encoding="utf-8",
)
(tmp_path / "apps/api/src/services/telegram_gateway.py").write_text(
"_mirror_outbound_message\n"
"record_outbound_message\n",
encoding="utf-8",
)
(tmp_path / "apps/api/src/services/platform_operator_service.py").write_text(
"list_ai_alert_card_delivery_readback\n"
"ai_alert_card_learning_writeback_refs_v1\n",
encoding="utf-8",
)
(tmp_path / "apps/api/src/services/telegram_alert_learning_context_post_apply_verifier.py").write_text(
"telegram_alert_learning_context_post_apply_verifier_v1\n",
encoding="utf-8",
)
(tmp_path / "apps/api/src/api/v1/agents.py").write_text(
'"/telegram-alert-monitoring-coverage-readback"\n',
encoding="utf-8",
)
proof = _inspect_source_contract(tmp_path)
assert proof == _source_contract()

View File

@@ -53996,10 +53996,12 @@ production browser smoke:
- `/api/v1/agents/telegram-alert-monitoring-coverage-readback` 從單純 gap summary 升級為可操作 readback新增 required tag dimensionsproject / product / website / service / package / tool / log / alert / playbook / rag / mcp / schedule、monitoring asset rollups、runtime event type counts、alert receipt pipeline、work item progress 與 AI controlled gap queue。
- operator answer 現在可直接回答:是否完成 Telegram 監控告警全量清查、是否都有 DB/log receipt、是否已可被 AI Agent automation 使用、是否仍有 AI controlled gap queue。
- AwoooP 共用 `AutonomousRuntimeReceiptPanel` 已接入新欄位完整模式顯示整體完成度、收據流水線、AI controlled queue 與貼標維度Runs / Work Items / Alerts / Approvals 共用同一 readback surface。
- production API container 若沒有 web source 檔,`awooop_coverage_surface_present` 會改用 `/telegram-alert-monitoring-coverage-readback` API endpoint marker 作為 source-contract fallback避免 deploy 後 false blocker。
- 保持 metadata-only 邊界:沒有送 Telegram、沒有呼叫 Bot API、沒有改 receiver、沒有保存 raw payload、沒有讀 secret、沒有 workflow dispatch。
**本地驗證結果**
- `DATABASE_URL=postgresql+asyncpg://test:test@localhost/test PYTHONPATH=apps/api python3.11 -m pytest apps/api/tests/test_telegram_alert_monitoring_coverage_readback_api.py apps/api/tests/test_telegram_alert_ai_automation_matrix_api.py apps/api/tests/test_ai_agent_log_controlled_writeback_consumer_readback_api.py -q -p no:cacheprovider``11 passed`
- source-contract fallback focused test`DATABASE_URL=postgresql+asyncpg://test:test@localhost/test PYTHONPATH=apps/api python3.11 -m pytest apps/api/tests/test_telegram_alert_monitoring_coverage_readback_api.py -q -p no:cacheprovider``4 passed`
- `pnpm --dir apps/web typecheck``NEXT_PUBLIC_API_URL=https://awoooi.wooo.work pnpm --dir apps/web build`、i18n JSON parse、`pnpm --dir apps/web audit:ui-density``python3.11 ops/runner/guard-gitea-runner-pressure.py --root .``git diff --check`:通過。
- UI density guard 仍指出既有大型債務:`:locale/iwooos``:locale/awooop/work-items``:locale/awooop/runs` 仍是下一批 UI/UX 主線壓縮對象。