fix(playbook+flywheel): 修復 PlaybookSource enum + repair_steps 相容 + KM stats raw SQL
Some checks failed
CD Pipeline / build-and-deploy (push) Successful in 14m58s
Type Sync Check / check-type-sync (push) Failing after 1m17s

修復三個串聯 bug,讓 Playbook seed 能正常執行:

1. PlaybookSource 新增 YAML_RULE enum(alert_rules.yaml 匯入專用)
2. playbook_seed_service: source=YAML_RULE,dedup 改用 raw SQL by name,
   不再呼叫 list_playbooks(舊格式 repair_steps 會 validation error)
3. playbook_repository._orm_to_pydantic: 舊格式 repair_steps 補齊
   step_number/action_type 必填欄位(向下相容)
4. flywheel_stats_service: embedding IS NULL 改用 raw SQL,
   修復 KnowledgeEntryRecord ORM 無 embedding 屬性的 AttributeError

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-15 23:31:56 +08:00
parent 4bee14ae08
commit 800ab1685f
4 changed files with 34 additions and 8 deletions

View File

@@ -39,6 +39,7 @@ class PlaybookSource(str, Enum):
EXTRACTED = "extracted" # 從 Incident 自動萃取
MANUAL = "manual" # 人工建立
YAML_RULE = "yaml_rule" # 從 alert_rules.yaml 匯入2026-04-15 ogt
class ActionType(str, Enum):