fix(scope-b): 修评审 4 HIGH + 同步 T6 工具数(15)

1. T6 e2e 工具数同步:list 断言 11→15(含 continue/expand/de-ai/teardown),
   测试名 ...eleven→fifteen;保留 legacy/ingestable 意图。
2. teardown 书名(body.kind)前置入原文 → 进 text_input context(拆书 prompt 期待书名)。
3. text_input 工具(扩写/降AI/拆书)空原文 → 422 VALIDATION,不让 LLM 空跑。
4. 链 UI:busy 守卫加 awaiting,裁决期间禁止重复发起链。

测试:扩 teardown 断言书名入 context + 新增 expand 空原文 422;后端 642 passed,
前端 294 passed,两门禁全绿。
This commit is contained in:
Yaojia Wang
2026-06-23 19:38:56 +02:00
parent e2d798627a
commit 8c7d4e2169
4 changed files with 50 additions and 6 deletions

View File

@@ -492,6 +492,31 @@ async def test_generate_teardown_returns_structured() -> None:
assert body["output_kind"] == "BookTeardownResult"
assert body["preview"]["themes"] == ["逆袭"]
assert body["preview"]["structure"] == "黄金三章立钩"
# 书名body.kind前置入原文 → 进了喂网关的 context拆书 prompt 期待书名)。
assert gateway.last_input is not None
assert "书名:某爆款" in gateway.last_input
assert "样本章节正文" in gateway.last_input
@pytest.mark.asyncio
async def test_generate_text_input_empty_text_422() -> None:
# text_input 工具(扩写/降AI/拆书)原文为空/空白 → 422不触达网关不让 LLM 空跑)。
repo = FakeProjectRepo()
pid = await _seed_project(repo)
gateway = _CaptureGateway(PolishResult(text="不应被调用。"))
app, session, *_ = _make_app(project_repo=repo, gateway=gateway)
async with _client(app) as client:
resp = await client.post(
f"/projects/{pid}/skills/expand/generate",
json={"text": " ", "brief": "加强描写"},
)
assert resp.status_code == 422
assert resp.json()["error"]["code"] == ErrorCode.VALIDATION
# 校验在生成前拦下:网关未被调用、未 commit。
assert gateway.last_input is None
assert session.commits == 0
# ---- POST .../ingestworld_entities gate----