From 5fcf4f8e616e9009dba2d23e03f753bf4eec4b4f Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 4 Jun 2026 20:44:45 +0800 Subject: [PATCH] docs(logbook): record source link canary repair [skip ci] --- docs/LOGBOOK.md | 35 +++++++++++++++++++ ...-04-navigation-and-ai-flywheel-workplan.md | 19 +++++++--- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/docs/LOGBOOK.md b/docs/LOGBOOK.md index 7eafc202..2507a627 100644 --- a/docs/LOGBOOK.md +++ b/docs/LOGBOOK.md @@ -37,6 +37,41 @@ - `192.168.0.168` 只能作為開發來源、repo hygiene、dev-only CORS 與 local service exposure 的 scope review;不得讀個人資料、未授權目錄或改 CORS / firewall / service。 - credential / secret 類資料只接受脫敏 metadata pointer;raw value、secret hash、masked token、partial token、截圖或個人憑證一律拒收或隔離。 +## 2026-06-04|Source Link Canary Post-Deploy Gate Repair + +**背景**:`c046b9c8` 已完成部署,但 Gitea CD run `2547` 的 post-deploy checks 因 `Source Link Canary` 失敗而紅燈,錯誤為 `sentry source-link canary failed: Expecting value: line 1 column 1 (char 0)`。當時 API Health、Alertmanager / SigNoz / Sentry webhook、SigNoz、OTEL Collector、Event Exporter 都通過,問題集中在 source-link canary 對 Sentry webhook 回應體的解析過早失敗。 + +**本輪完成**: +- `scripts/alert_chain_smoke_test.py`: + - Source Provider / Source Link canary 改成先判斷 HTTP status,再解析 JSON,避免 4xx / 5xx / HTML / 空 body 被 `JSONDecodeError` 蓋住真正原因。 + - Source Link Canary 對 `2xx` 空 body 改為通過本步,並明確要求後續 source-correlation smoke 驗證 readback;不把空 body 本身當成完整鏈路成功。 + - HTTP error 會回報 status 與 body preview,例如 `sentry HTTP 502: bad gateway`。 +- `apps/api/tests/test_alert_chain_smoke_metric.py`: + - 新增 `204 / empty body` 的 source-link handoff 測試。 + - 新增 `502 / non-JSON body` 必須回報 HTTP status 的測試。 + +**完成度更新**: +- Phase 2 告警資料鏈路:`0% → 12%`。 +- Source Link Canary live issue:`100%`。 +- 告警資料鏈路目標完成度仍為 `90%`;Telegram DB 寫入、dedupe / recurrence、詳情 / 歷史 400、postmortem 重複通知與 Config Drift 重複告警仍待續。 + +**驗證**: +- `python3 -m py_compile scripts/alert_chain_smoke_test.py apps/api/tests/test_alert_chain_smoke_metric.py`:通過。 +- `ruff check scripts/alert_chain_smoke_test.py apps/api/tests/test_alert_chain_smoke_metric.py`:通過。 +- `PYTHONPATH=apps/api pytest apps/api/tests/test_alert_chain_smoke_metric.py apps/api/tests/test_cd_post_deploy_source_link_gate.py -q`:`20 passed`。 +- `git diff --check`:通過。 +- Gitea code-review run `2550`:success。 +- Gitea CD run `2549`:success;tests、build-and-deploy、post-deploy-checks 全部成功。 +- Deploy marker:`65bdfd1d chore(cd): deploy 29a67ec [skip ci]`。 +- Post-deploy log:`Source Link Canary` 回 `recorded sentry source-link canary event for INC-20260505-25E744`;Alert Chain smoke `PASSED — 8/9 checks passed`。 +- Source correlation apply smoke:`status=passed`、`verification_status=applied_link_verified`、`source_event_provider_event_id=sentry:source_correlation_linked:awoooi-source-link-canary-gitea-cd-3668-1`;write flags 維持 `writes_incident_state=false`、`writes_auto_repair_result=false`、`writes_ticket=false`。 +- Production recurrence API:`awoooi-source-link-canary-gitea-cd-3668-1` 顯示 `latest_stage=source_correlation_linked`、`latest_incident_id=INC-20260505-25E744`、`stage_counts={"source_correlation_linked": 1, "upstream_canary": 1}`。 + +**目前邊界**: +- 本段只修 post-deploy smoke 對 response body 的判讀與 source-correlation readback handoff,不新增 webhook endpoint、不讀取 secret 明文、不改 Sentry / SigNoz / Alertmanager 寫入權限。 +- 本段沒有建立 incident、沒有啟動 auto repair、沒有寫入 auto repair result、沒有建立 ticket、沒有批准任何 runtime gate。 +- IwoooS / Source Control / Kali 相關 gate 全部維持既有 0 / false 邊界。 + ## 2026-06-04|IwoooS P1-7 Kali 112 Maintenance Window Draft **背景**:P1-5 rollback owner handoff 已推送;本段接續 P1-7,針對 Kali `192.168.0.112` 已知缺口建立維護窗口草案。既有只讀證據顯示待更新套件 `1994`、`networking.service` failed、scanner service hardening `0 / 4`、reboot required `false`。本段只整理 owner / reviewer 可審的維護 handoff,不登入主機、不更新、不重啟、不 restart、不套 hardening、不 active scan、不呼叫 `/execute`。 diff --git a/docs/workplans/2026-06-04-navigation-and-ai-flywheel-workplan.md b/docs/workplans/2026-06-04-navigation-and-ai-flywheel-workplan.md index a15494f5..1c06ef34 100644 --- a/docs/workplans/2026-06-04-navigation-and-ai-flywheel-workplan.md +++ b/docs/workplans/2026-06-04-navigation-and-ai-flywheel-workplan.md @@ -8,9 +8,9 @@ | --- | --- | | Repo/worktree | `/private/tmp/awoooi-iwooos-next-gate-20260604` | | 推版規則 | 只推 Gitea:`git push gitea HEAD:main`;GitHub 只讀備份 | -| 最新 Gitea main | `291ff925 docs(security): add Kali maintenance window draft [skip ci]` | -| 最新完成 code commit | `8a326338 fix(web): mirror AwoooP operator statuses in Chinese` | -| 最新 deployment marker | `c046b9c8 chore(cd): deploy 8a32633 [skip ci]` | +| 最新 Gitea main | `920c9a2d docs(security): 補開發主機 scope handoff [skip ci]` | +| 最新完成 code commit | `29a67ec7 fix(ci): tolerate empty source link canary response` | +| 最新 deployment marker | `65bdfd1d chore(cd): deploy 29a67ec [skip ci]` | | 正式站驗證 | `https://awoooi.wooo.work/zh-TW/awooop/runs?project_id=awoooi&_v=c046b9c8-runs-status-fallback` | | 首頁產品化入口 | 88% | | AI provider readability | 88% | @@ -141,7 +141,8 @@ Live evidence: | 欄位 | 內容 | | --- | --- | | 優先級 | P0 | -| 狀態 | 待啟動;`c046b9c8` post-deploy checks 已暴露 Source Link Canary 紅燈,需列為 Phase 2 第一個 live issue | +| 狀態 | 已修復第一個 live issue:`29a67ec7` 讓 Source Link Canary 先判 HTTP status、2xx 空 body 交給 source-correlation readback 驗證;`2549` CD / post-deploy checks 已通過。其餘 Telegram / DB / dedupe / history 紅燈待續。 | +| 本階段完成度 | 12% | | 目標完成度 | 告警資料鏈路可判讀性 → 90% | 細項: @@ -149,7 +150,7 @@ Live evidence: - [ ] 告警關聯 Sentry、SigNoz、Alertmanager、K8s、host logs、run timeline。 - [ ] 建立告警 dedupe / fingerprint / recurrence 統計,降低重複轟炸。 - [ ] 修「詳情 / 歷史」HTTP 400 或查不到事件。 -- [ ] 修 `Source Link Canary`:Gitea CD post-deploy run `2547` 顯示 `sentry source-link canary failed: Expecting value: line 1 column 1 (char 0)`;需確認 Sentry source-link API 回應、JSON parse、DB event 對應與錯誤訊息。 +- [x] 修 `Source Link Canary`:Gitea CD post-deploy run `2547` 顯示 `sentry source-link canary failed: Expecting value: line 1 column 1 (char 0)`;`29a67ec7` 已修 smoke script status-first parsing 與 2xx empty response handoff,run `2549` 已成功。 - [ ] 修 postmortem 瞬間大量重複通知。 - [ ] 修 Config Drift 重複告警,確認 PR 已建立後的採納 / 關閉 / baseline / TTL 狀態。 @@ -158,6 +159,14 @@ Live evidence: - [ ] 詳情 / 歷史連結不再 400。 - [ ] 重複通知有 DB 證據與 TTL 判讀。 +Live evidence: +- Gitea code-review run `2550`:success。 +- Gitea CD run `2549`:tests / build-and-deploy / post-deploy-checks success。 +- Deploy marker:`65bdfd1d chore(cd): deploy 29a67ec [skip ci]`。 +- Post-deploy log:`Source Link Canary` 回 `recorded sentry source-link canary event for INC-20260505-25E744`,Alert Chain smoke `PASSED — 8/9 checks passed`。 +- Source correlation apply smoke:`status=passed`、`verification_status=applied_link_verified`、`source_event_provider_event_id=sentry:source_correlation_linked:awoooi-source-link-canary-gitea-cd-3668-1`,write flags `writes_incident_state=false`、`writes_auto_repair_result=false`、`writes_ticket=false`。 +- Production recurrence API:`awoooi-source-link-canary-gitea-cd-3668-1` 顯示 `latest_stage=source_correlation_linked`、`latest_incident_id=INC-20260505-25E744`、`stage_counts={"source_correlation_linked": 1, "upstream_canary": 1}`。 + ## Phase 3 - P0 AI Provider / Agent 主責 | 欄位 | 內容 |