From 4079f1c0ac94a1fb6db335384b1a97ddc67074a6 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 11:22:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=88=E4=BD=8F=20CD=20migration=20=E5=85=A8?= =?UTF-8?q?=E7=AF=84=E5=9C=8D=E5=9F=B7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../claude_inventory_validation_20260513.md | 2 ++ tests/test_cd_health_check.py | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/docs/memory/claude_inventory_validation_20260513.md b/docs/memory/claude_inventory_validation_20260513.md index c31c4d7..fe9e729 100644 --- a/docs/memory/claude_inventory_validation_20260513.md +++ b/docs/memory/claude_inventory_validation_20260513.md @@ -35,6 +35,7 @@ - Cron 盲區清單多數已補 `_notify_scheduler_failure()`;ROI 月報已避開 09:00 改 09:05,AI smoke 已是 09:10。 - V2 指出的 9 個 cron 盲區已補回歸守門:8 個 `run_scheduler.py` wrapper 必須呼叫 `_notify_scheduler_failure()`,`scheduler.py::run_promo_event_task` 必須呼叫 `notify_failure()`。 - 09:00 排程衝突已有回歸守門:`daily_report=09:00`、`roi_monthly_report=09:05`、`ai_smoke_daily_summary=09:10` 必須保持錯開。 +- CD migration 全範圍冪等已有回歸守門:`.gitea/workflows/cd.yaml` 必須維持 024-099 pattern、`sort | uniq` 與 `for m in $V5_MIGRATIONS` apply loop。 - 0-byte `database/momo*.db` 迷惑檔已不存在;真實 SQLite 僅在 `data/momo_database.db`。 - `.gitignore` 已涵蓋 `.claude/worktrees/`、`.tmp_*`、`MOMO Pro/`、uploads/screenshots。 - `cache_service.py` 已成為 `cache_manager.py` 的相容 shim,`_SALES_CACHE_TTL` 單一來源有測試鎖住。 @@ -100,3 +101,4 @@ - `b24241f` 守住 migration blocker 修補 - `6c86839` 守住盤點誤判依賴 - `2e2b775` 守住 V2 import 清理狀態 +- `58ba95b` 守住月結匯入 append 路徑 diff --git a/tests/test_cd_health_check.py b/tests/test_cd_health_check.py index 970776e..48c27a9 100644 --- a/tests/test_cd_health_check.py +++ b/tests/test_cd_health_check.py @@ -68,3 +68,22 @@ def test_cd_rebuild_builds_image_before_stopping_running_containers(): up_index = workflow.index("docker compose up -d --no-deps --force-recreate momo-app scheduler telegram-bot") assert build_index < stop_index < up_index + + +def test_cd_applies_full_v5_migration_range_idempotently(): + workflow = CD_WORKFLOW.read_text(encoding="utf-8") + + assert "024-099 範圍" in workflow + for pattern in [ + "migrations/02[4-9]_*.sql", + "migrations/03[0-9]_*.sql", + "migrations/04[0-9]_*.sql", + "migrations/05[0-9]_*.sql", + "migrations/06[0-9]_*.sql", + "migrations/07[0-9]_*.sql", + "migrations/08[0-9]_*.sql", + "migrations/09[0-9]_*.sql", + ]: + assert pattern in workflow + assert "sort | uniq" in workflow + assert "for m in $V5_MIGRATIONS" in workflow