P2-8 镜牢局内决策写入审计日志
- 新增 lc_mcp/decisions.py:每个决策追加一行 JSON(time/stage/choice/reason + 细节), 写失败只丢该行;summarize 按 stage/reason 计数 - TaskRunner 用 LCP_DECISIONS 把 task_*.decisions.jsonl 路径交给子进程, task_status 返回 decisions.counts,清理旧日志时一并删除 - 选队/键盘寻路/饰品/事件补丁记录各自决策;商店购买与卡包选择用只观察的补丁记录 (购买按钮点中前的商品;卡包取自上游日志里的选择结果与权重) - 抽出 _override 统一临时替换 auto 方法并在结束时还原 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -207,6 +207,15 @@ class UpstreamEventHandlingTest(unittest.TestCase):
|
|||||||
self.assertIn('事件 梦中的电子羊: 1=你是特别的 | 2=你不是特别的。 | 3=离开; 选第 2 项(选项文字含「你不是特别的」)',
|
self.assertIn('事件 梦中的电子羊: 1=你是特别的 | 2=你不是特别的。 | 3=离开; 选第 2 项(选项文字含「你不是特别的」)',
|
||||||
self.log)
|
self.log)
|
||||||
|
|
||||||
|
def test_decisions_are_recorded_once_per_screen(self):
|
||||||
|
with mock.patch.object(ap.decisions, 'record') as record:
|
||||||
|
self.play('梦中的电子羊', [['你是特别的', '你不是特别的。']])
|
||||||
|
self.play('没见过的事件', [['战斗', '离开']])
|
||||||
|
self.assertEqual(record.call_args_list, [
|
||||||
|
mock.call('event', 2, 'text', event='梦中的电子羊', options=['你是特别的', '你不是特别的。'],
|
||||||
|
why='选项文字含「你不是特别的」'),
|
||||||
|
mock.call('event', None, 'not_in_table', options=['战斗', '离开'])])
|
||||||
|
|
||||||
def test_unknown_event_behaves_like_upstream(self):
|
def test_unknown_event_behaves_like_upstream(self):
|
||||||
options = [['战斗', '离开']]
|
options = [['战斗', '离开']]
|
||||||
self.assertEqual(self.play('没见过的事件', options), self.play('没见过的事件', options, patched=False))
|
self.assertEqual(self.play('没见过的事件', options), self.play('没见过的事件', options, patched=False))
|
||||||
|
|||||||
Reference in New Issue
Block a user