将角色与 Skill 从 .claude 迁入 .agent,移除 Claude CLI 运行时并接入固定 Opus 角色 profile、完整 schema、预算 deadline、raw 与回执证据链。 同步拆分 Skill 职责、复利 lesson、Gate 回放、Dashboard 人审入口、数据库登记和机械门禁;候选设计正文不包含在本提交中。
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
||
"""plan-story:规划执行 lesson 离线钉死。"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import pathlib
|
||
import sys
|
||
import unittest
|
||
from unittest.mock import patch
|
||
|
||
ROOT = pathlib.Path(__file__).resolve().parents[3]
|
||
SCRIPT = ROOT / ".agent" / "skills" / "plan-story" / "scripts"
|
||
EVIDENCE = ROOT / ".agent" / "skills" / "record-run-evidence" / "scripts"
|
||
for path in (SCRIPT, EVIDENCE):
|
||
if str(path) not in sys.path:
|
||
sys.path.insert(0, str(path))
|
||
|
||
from record_planning_execution import _propose_planning_lesson # noqa: E402
|
||
|
||
|
||
class PlanningLessonOfflineTest(unittest.TestCase):
|
||
def test_registers_win_with_section_type(self):
|
||
calls: list[dict] = []
|
||
|
||
def fake(**kwargs):
|
||
calls.append(kwargs)
|
||
return {"status": "proposed", "lesson_id": 5, "deduped": False}
|
||
|
||
with patch("record_planning_execution.propose_lesson_dedup", side_effect=fake):
|
||
out = _propose_planning_lesson(
|
||
run_id="planning-1", work_id=2, sid=88,
|
||
section_type="assembly", schema_type="assembly",
|
||
version=1, state="shadow",
|
||
)
|
||
self.assertEqual(out["lesson_id"], 5)
|
||
self.assertEqual(calls[0]["kind"], "win")
|
||
self.assertEqual(calls[0]["title"], "规划 section 已持久化:assembly")
|
||
self.assertEqual(calls[0]["detail"]["section_id"], 88)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
unittest.main()
|