实现侧: - 上下文:任务范围拆分为 范围校验/范围授权;索引按可发现口径重建、索引新鲜度改对称差;依赖校验统一快照漂移说明。 - 知识方法:方法与材料读取口径统一;超限方法材料按可选省略,核对路径不再二次计费;删除无合同的读时重算。 - 任务运行:新增 context.usage/tool.denied 事件类型;连接池常驻并在装配生命周期内开关;调用结算与核对分列。 - 效果评测/审校修订/交付连载/作者经验/作品规划:凭据冻结、标定消费、导出补证、事实引文核对等收尾修复。 - 资源加载:能力正文不再夹带索引用的导航注记(该注记此前进入角色与技能的模型提示)。 - 元数据:受保护骨架与代码保护属性对齐;字段校验与内置结构口径同步。 - 基础设施:环境预检进入装配生命周期;数据库连接运行期字段不参与相等比较;索引指纹归一化 jsonb 浮点。 - 删除被替代实现:7 份旧提示词模板与空壳 资料来源 读取器。 用例侧: - 用例身份与导航元信息迁移;夹具补生命周期、同库暴露与模板封存; - 本轮定向修复:方法材料省略、事实引文、迁移回执、额度与暂停用例、慢用例超时预算等。
104 lines
4.3 KiB
Python
104 lines
4.3 KiB
Python
"""跨章作者改稿同事务生成B05候选,逐章审阅和采纳仍归B05。"""
|
||
|
||
from dataclasses import replace
|
||
from uuid import uuid4
|
||
|
||
import pytest
|
||
import test_定稿与导出 as 定稿测试
|
||
|
||
from muse.交付连载.接口 import 全书修订, 章节修订
|
||
from muse.共享.错误 import Muse错误
|
||
from muse.正文写作.接口 import 候选定位, 选段修改
|
||
|
||
pytestmark = pytest.mark.数据库
|
||
候选环境 = 定稿测试.候选环境
|
||
交付环境 = 定稿测试.交付环境
|
||
|
||
|
||
def _请求(face):
|
||
chapters = []
|
||
for chapter in face["chapters"]:
|
||
p = chapter["paragraph_locations"][0]
|
||
chapters.append(
|
||
章节修订(
|
||
chapter["chapter_id"],
|
||
chapter["revision"],
|
||
chapter["document_hash"],
|
||
(选段修改(p["paragraph_id"], p["paragraph_hash"], 0, 2, p["text"][:2], "新稿"),),
|
||
)
|
||
)
|
||
return 全书修订(str(uuid4()), face["work_id"], tuple(chapters))
|
||
|
||
|
||
@pytest.mark.case_id(
|
||
"NC-w27-27c001",
|
||
environment="隔离PG",
|
||
given="本作者完整目录、确切正文版本与独立隔离数据",
|
||
when="通过定稿、S02导出、跨章候选或连载反馈实际入口执行并检查失败恢复",
|
||
then=["全书跨章候选原子保存且单章采纳不批准其他章"],
|
||
contract="docs/系统架构/新版设计/模块设计/B08-交付连载.md",
|
||
)
|
||
def test_全书跨章候选原子保存且单章采纳不批准其他章__27c001(交付环境):
|
||
app, author, _, req = 交付环境
|
||
svc, body = app.要求交付(), app.要求正文()
|
||
batch = _请求(svc.全书回看(author, req.work_id))
|
||
result = svc.提出跨章修订(author, "book-patches", batch)
|
||
assert svc.提出跨章修订(author, "book-patches", batch) == result
|
||
assert len(result["results"]) == 2
|
||
candidates = [body.列出候选(author, c.chapter_id)[0] for c in req.chapters]
|
||
for c in candidates:
|
||
row = body.读取候选(author, c["candidate_id"])
|
||
assert row["decision"] == "undecided" and row["visible_text"].startswith("新稿")
|
||
first = body.读取候选(author, candidates[0]["candidate_id"])
|
||
point = 候选定位(
|
||
first["candidate_id"],
|
||
1,
|
||
first["candidate_hash"],
|
||
first["document_id"],
|
||
1,
|
||
)
|
||
review = body.打开候选审阅(author, point)
|
||
定稿测试.正文测试.决定(body, author, "one-adopt", point, review)
|
||
assert body.读取正文(author, req.chapters[0].chapter_id)["revision"] == 2
|
||
assert body.读取正文(author, req.chapters[1].chapter_id)["revision"] == 1
|
||
assert body.读取候选(author, candidates[1]["candidate_id"])["decision"] == "undecided"
|
||
|
||
|
||
@pytest.mark.case_id(
|
||
"NC-w27-27c002",
|
||
environment="隔离PG",
|
||
given="本作者完整目录、确切正文版本与独立隔离数据",
|
||
when="通过定稿、S02导出、跨章候选或连载反馈实际入口执行并检查失败恢复",
|
||
then=["末章依据不符不留下前章候选且例外不能跨版本沿用"],
|
||
contract="docs/系统架构/新版设计/模块设计/B08-交付连载.md",
|
||
)
|
||
def test_末章依据不符不留下前章候选且例外不能跨版本沿用__27c002(交付环境):
|
||
app, author, _, req = 交付环境
|
||
svc = app.要求交付()
|
||
face = svc.全书回看(author, req.work_id, names={"原句": "新句"})
|
||
finding = face["copyedit"][0]
|
||
assert finding["quote"] == "原句" and finding["start"] == 0
|
||
kept = svc.全书回看(author, req.work_id, names={"原句": "新句"}, exceptions=[finding["id"]])
|
||
assert kept["copyedit"][0]["disposition"] == "preserved"
|
||
batch = _请求(face)
|
||
bad = replace(batch.chapters[1], document_hash="0" * 64)
|
||
with pytest.raises(Muse错误):
|
||
svc.提出跨章修订(author, "bad-book", replace(batch, chapters=(batch.chapters[0], bad)))
|
||
assert app.要求正文().列出候选(author, req.chapters[0].chapter_id) == []
|
||
app.要求正文().保存人工(
|
||
author,
|
||
"change-version",
|
||
req.chapters[0].chapter_id,
|
||
1,
|
||
定稿测试.正文测试.草稿(尾句="改后"),
|
||
)
|
||
changed = svc.全书回看(
|
||
author,
|
||
req.work_id,
|
||
names={"原句": "新句"},
|
||
exceptions=[finding["id"]],
|
||
)
|
||
assert changed["copyedit"][0]["disposition"] == "review"
|
||
with pytest.raises(Muse错误):
|
||
svc.提出跨章修订(author, "stale-book", batch)
|