合入期 3 反方审稿(后端):报告里的关键结论各派只读 agent 主动找反例,给出经受住、被削弱、被推翻、无法判断和有出处的理由;被推翻的计入出具缺口;审批卡附反方审稿概况

# Conflicts:
#	backend/tests/test_issuance_upstream_gaps.py
This commit is contained in:
ThearchyHelios
2026-10-05 18:08:39 +08:00
7 changed files with 2142 additions and 33 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,35 @@
"""助手的节点手册要教反方审稿节点:什么时候加(多个来源汇总的分析报告、要正式出具的报告),接在哪里,各配置项怎么写。
手册里没写的节点,助手就不会用;写错的键名、取值,画布校验会一直把图打回来。所以这里不只查关键词,还拿校验认的那一份
配置项和取值来对。
"""
from __future__ import annotations
from app.api.copilot import NODE_REFERENCE
from app.engine.schema import CHALLENGE_LABEL, CHALLENGE_ON_REFUTED
def _challenge_entry() -> str:
start = NODE_REFERENCE.index("- challenge:反方审稿")
return NODE_REFERENCE[start:NODE_REFERENCE.index("\n\n", start)]
def test_the_guide_names_every_setting_the_validator_knows():
entry = _challenge_entry()
assert all(key in entry for key in CHALLENGE_LABEL), [k for k in CHALLENGE_LABEL if k not in entry]
assert all(value in entry for value in CHALLENGE_ON_REFUTED)
def test_the_guide_says_when_to_add_it_and_where():
entry = _challenge_entry()
# 什么时候加:多个来源汇总的分析报告、要正式出具的报告;串在报告和成果之间(降档靠成果节点收上游的缺口,
# 接在侧枝上不生效),审批节点在后面时引用报告正文
assert "多个来源" in entry and "正式出具" in entry and "report → challenge → output" in entry
assert "侧枝" in entry
assert "{{ nodes.报告节点id.text }}" in entry
# 「报错并停止运行」配「出错时:记录错误并继续」画布校验会挡:助手别这么配
assert "on_error: continue" in entry
# 反方模型建议和写作模型不同:同一个模型等于自己审自己
assert "自己审自己" in entry
# 不写上限就取设置里的默认:助手不要替人把核查的花费写死
assert "取设置里的默认" in entry
@@ -85,22 +85,6 @@ async def test_upstream_gap_degrades_issuance_and_names_the_node():
assert (await issuance_event(row.id))["gaps"] == issuance["gaps"]
async def test_stub_gate_nodes_pass_through_without_touching_issuance():
"""反方审稿目前是占位:放在图里照样能运行,出具不受影响。双盲复算已经实现,没有可复算的指标时直接放行、
不碰出具,见 test_dual_check_node.py"""
for kind in ("challenge",):
row = await finish(graph(node("gate", kind)))
issuance = row.output["_issuance"]
assert issuance["tier"] == "formal", (kind, issuance)
assert issuance["gaps"] == []
async with SessionLocal() as session:
logs = (await session.execute(
select(RunEvent).where(RunEvent.run_id == row.id, RunEvent.type == "log", RunEvent.node_id == "gate")
)).scalars().all()
assert [e.data.get("level") for e in logs] == ["info"]
assert "开发中" in logs[0].data["message"]
async def test_without_issuance_gaps_nothing_changes():
"""没写 issuance_gaps 的节点,和别的支路上写了的节点,都不影响这份成果"""
plain = node("recheck", "transform", "复核销售额", mode="json", template='{"ok": true}')