实现侧: - 上下文:任务范围拆分为 范围校验/范围授权;索引按可发现口径重建、索引新鲜度改对称差;依赖校验统一快照漂移说明。 - 知识方法:方法与材料读取口径统一;超限方法材料按可选省略,核对路径不再二次计费;删除无合同的读时重算。 - 任务运行:新增 context.usage/tool.denied 事件类型;连接池常驻并在装配生命周期内开关;调用结算与核对分列。 - 效果评测/审校修订/交付连载/作者经验/作品规划:凭据冻结、标定消费、导出补证、事实引文核对等收尾修复。 - 资源加载:能力正文不再夹带索引用的导航注记(该注记此前进入角色与技能的模型提示)。 - 元数据:受保护骨架与代码保护属性对齐;字段校验与内置结构口径同步。 - 基础设施:环境预检进入装配生命周期;数据库连接运行期字段不参与相等比较;索引指纹归一化 jsonb 浮点。 - 删除被替代实现:7 份旧提示词模板与空壳 资料来源 读取器。 用例侧: - 用例身份与导航元信息迁移;夹具补生命周期、同库暴露与模板封存; - 本轮定向修复:方法材料省略、事实引文、迁移回执、额度与暂停用例、慢用例超时预算等。
140 lines
5.1 KiB
Python
140 lines
5.1 KiB
Python
"""同命题分歧与预注册输入审计,不认证模型真值。"""
|
|
|
|
import copy
|
|
import json
|
|
|
|
import pytest
|
|
import test_效果判据 as 判据测试
|
|
|
|
from muse.效果评测.启用判据 import 判定效果
|
|
from muse.效果评测.混淆项 import _分歧, 审计输入, 核对审计声明
|
|
|
|
|
|
def _声明():
|
|
return dict(
|
|
version="writer-input-audit-v1",
|
|
annotation_ref="synthetic:annotation",
|
|
as_of_position=2,
|
|
forbidden_facts=[
|
|
dict(fact_id="future", text="林深在封闭祭坛取出了唯一信物", first_position=3)
|
|
],
|
|
declared_new_entity_ids=None,
|
|
)
|
|
|
|
|
|
@pytest.mark.case_id(
|
|
"NC-w25-25f612",
|
|
environment="离线合同",
|
|
given="本例固定资料与独立边界输入",
|
|
when="运行冻结审计及混淆计算",
|
|
then=["登记事实的机械扫描、范围和不回显秘密"],
|
|
contract="docs/系统架构/新版设计/模块设计/B10-效果评测.md",
|
|
)
|
|
@pytest.mark.parametrize(
|
|
"text,hit",
|
|
[
|
|
("林深在封闭祭坛取出了唯一信物", True),
|
|
("林深,在封闭祭坛,取出了唯一信物。", True),
|
|
("林深静静地守着城门。", False),
|
|
],
|
|
)
|
|
def test_机械审计识别登记片段且不回显秘密__25f612(text, hit):
|
|
audit = 核对审计声明(_声明())
|
|
r = 审计输入(dict(arm="C", user_input=text, system_prompt="合成指令"), audit)
|
|
assert bool(r["finding_count"]) is hit and r["status"] == "measured"
|
|
assert audit["forbidden_facts"][0]["text"] not in json.dumps(r, ensure_ascii=False)
|
|
|
|
|
|
@pytest.mark.case_id(
|
|
"NC-w25-25f613",
|
|
environment="离线合同",
|
|
given="本例固定资料与独立边界输入",
|
|
when="运行冻结审计及混淆计算",
|
|
then=["审计时点、来源及身份声明拒绝"],
|
|
contract="docs/系统架构/新版设计/模块设计/B10-效果评测.md",
|
|
)
|
|
@pytest.mark.parametrize("mutation", ["past", "duplicate", "empty_source", "bad_entity"])
|
|
def test_审计声明不接收错误时点重复或空身份__25f613(mutation):
|
|
from muse.共享.错误 import Muse错误
|
|
|
|
r = _声明()
|
|
if mutation == "past":
|
|
r["forbidden_facts"][0]["first_position"] = 2
|
|
if mutation == "duplicate":
|
|
r["forbidden_facts"] *= 2
|
|
if mutation == "empty_source":
|
|
r["annotation_ref"] = " "
|
|
if mutation == "bad_entity":
|
|
r["declared_new_entity_ids"] = [" "]
|
|
with pytest.raises((Muse错误, ValueError)):
|
|
核对审计声明(r)
|
|
|
|
|
|
@pytest.mark.case_id(
|
|
"NC-w25-25f614",
|
|
environment="离线合同",
|
|
given="本例固定资料与独立边界输入",
|
|
when="运行冻结审计及混淆计算",
|
|
then=["同类型同命题分歧、未知及固定分母"],
|
|
contract="docs/系统架构/新版设计/模块设计/B10-效果评测.md",
|
|
)
|
|
def test_同ID不同命题类型不会串算且未知保留未完__25f614():
|
|
sample = dict(
|
|
literary={
|
|
"A:C": dict(
|
|
status="stable_report",
|
|
execution_verified=True,
|
|
candidates={"a": "A", "c": "C"},
|
|
verdicts=[
|
|
dict(kind=k, candidate_id=c, statement_id="same", verdict=v)
|
|
for k, c, v in [
|
|
("assertion_verdicts", "a", "fail"),
|
|
("constraint_verdicts", "a", "pass"),
|
|
("assertion_verdicts", "c", "pass"),
|
|
("constraint_verdicts", "c", "pass"),
|
|
]
|
|
],
|
|
)
|
|
},
|
|
detections={
|
|
arm: dict(
|
|
report={
|
|
k: [dict(statement_id="same", verdict=v)]
|
|
for k, v in [("assertion_verdicts", av), ("constraint_verdicts", cv)]
|
|
}
|
|
)
|
|
for arm, av, cv in [("A", "pass", "pass"), ("C", "pass", "fail")]
|
|
},
|
|
)
|
|
clean = dict(status="measured", finding_count=0)
|
|
fn, fp = _分歧(sample, ["A", "C"], clean)
|
|
assert fn["finding_count"] == fp["finding_count"] == 1
|
|
assert fn["findings"][0]["kind"] == "assertion_verdicts"
|
|
assert fp["findings"][0]["kind"] == "constraint_verdicts"
|
|
sample["detections"]["C"]["report"]["constraint_verdicts"][0]["verdict"] = "unknown"
|
|
assert _分歧(sample, ["A", "C"], clean)[1]["status"] == "incomplete"
|
|
del sample["detections"]["A"]
|
|
assert _分歧(sample, ["A", "C"], clean)[0]["denominator"] == 4
|
|
assert (
|
|
_分歧(sample, ["A", "C"], dict(status="not_measured", finding_count=None))[1][
|
|
"finding_count"
|
|
]
|
|
is None
|
|
)
|
|
|
|
|
|
@pytest.mark.case_id(
|
|
"NC-w25-25f615",
|
|
environment="离线合同",
|
|
given="本例固定资料与独立边界输入",
|
|
when="运行冻结审计及混淆计算",
|
|
then=["新增观察不改变旧统计凭据依据"],
|
|
contract="docs/系统架构/新版设计/模块设计/B10-效果评测.md",
|
|
)
|
|
def test_新混淆展示不改变既有统计凭据依据__25f615():
|
|
data = 判据测试._输入()
|
|
before = 判定效果(*data)
|
|
changed = copy.deepcopy(data)
|
|
changed[3]["confounders"] = {"version": "evaluation-confounders-v1", "samples": {}}
|
|
assert 判定效果(*changed) == before
|