Skip to content

Conformance 覆盖审计

审计日期:2026-11-26。范围:conformance/fixtures/**/expect.json 与 特性表 的逐 K-### 对照。只报告现状,不改变特性状态、fixture 或实现。

后续进展(2026-11-26):审计后已补齐 30 个 active K 的双侧 fixture(K-008 deprecated 除外);当前共 82 个 fixture(38 pass / 44 reject / 0 skip)。以下逐 K 表保留审计时点;最新统计见 conformance/README.md。

本文回答一个问题:每个语言特性有多少可执行的一致性证据,缺哪一侧。规范语义仍以 语言规范 为准;特性状态与实现测试证据仍以特性表为准。

口径

  • 通过 fixture:expect.json 的 exit 为 0,即接受用例。
  • 拒绝 fixture:expect.json 的 exit 非 0,即拒绝用例。拒绝用例必须断言具体诊断码,不能只靠非零退出码。
  • 缺口:pass 表示缺接受用例,reject 表示缺拒绝用例,missing 表示该特性没有任何 conformance fixture,— 表示两侧都有。
  • 没有 conformance fixture 不等于没有测试:很多特性由 impl/rust/crates/*/tests/*.rs 的单元/集成测试覆盖,只是没有走 CLI fixture。反过来,有实现测试也不等于满足 ROADMAP.md 的 Gate 要求(每个特性至少一个通过 + 一个拒绝 fixture)。
  • 一个 fixture 只按 expect.json 的 feature 字段归属;parser、check、product 这类阶段名不是 K-###,单独列在后面的“非 K 用例”。

总览(审计时点)

指标 数量
特性总数(K-001–K-031) 31
至少有一个 fixture 的特性 12
完全没有 fixture 的特性 19
同时有通过 + 拒绝 fixture 的特性 6
只有通过 fixture 的特性 6
只有拒绝 fixture 的特性 0
fixture 总数 34
通过 fixture 15
拒绝 fixture 19
其中 K-### fixture / 阶段级 fixture 32 / 2

2026-11-26 实跑 cargo test -p koine-cli --test conformance_cli,结果 total=34 passed=34 skipped=0 failed=0:现有 fixture 全部可执行且断言成立。这只能说明“已有断言成立”,不能推出“覆盖完整”。

逐 K 覆盖(审计时点)

K 编号 特性 features 状态 通过 拒绝 缺口 实现测试证据(来自特性表)
K-001 entity tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-002 value tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-003 alias tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-004 relation tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-005 key tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-006 state tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-007 time tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-008 conversion(已弃用) deprecated 0 0 — —
K-009 operator tested 1 5 — conformance/fixtures/K-009、impl/rust/crates/koine/tests/runtime.rs
K-010 transition tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-011 require tested 1 2 — conformance/fixtures/K-011、impl/rust/crates/koine/tests/runtime.rs
K-012 axiom tested 1 4 — conformance/fixtures/K-012、impl/rust/crates/koine/tests/runtime.rs
K-013 init tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-014 actor tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-015 define tested 1 3 — conformance/fixtures/K-015、impl/rust/crates/koine/tests/runtime.rs
K-016 aggregate tested 1 2 — conformance/fixtures/K-016、impl/rust/crates/koine/tests/runtime.rs
K-017 view tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-018 path tested 1 0 reject impl/rust/crates/koine/tests/runtime.rs
K-019 diff tested 1 0 reject impl/rust/crates/koine/tests/runtime.rs
K-020 find tested 3 0 reject impl/rust/crates/koine/tests/explore.rs、impl/rust/crates/koine-cli/tests/m5_cli.rs
K-021 explore tested 2 0 reject impl/rust/crates/koine/tests/explore.rs、impl/rust/crates/koine-cli/tests/m5_cli.rs
K-022 module tested 0 0 missing impl/rust/crates/koine/tests/multifile.rs、impl/rust/crates/koine/tests/resolve.rs
K-023 scenario tested 1 1 — conformance/fixtures/K-023、impl/rust/crates/koine/tests/runtime.rs
K-024 diagnostic tested 0 0 missing impl/rust/crates/koine-cli/tests/conformance_cli.rs
K-025 doc-comment tested 0 0 missing impl/rust/crates/koine/tests/doccheck.rs
K-026 derived relation tested 1 0 reject impl/rust/crates/koine/tests/derived.rs
K-027 product value tested 1 0 reject impl/rust/crates/koine/tests/runtime.rs
K-028 quantity tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-029 unit tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-030 dimension tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs
K-031 unit literal tested 0 0 missing impl/rust/crates/koine/tests/runtime.rs

逐条说明:

  • K-018 唯一的 fixture 是 K-018/history-basic,它断言的是 history 命令的步骤回放,没有断言 path 的 (start, steps, k) 形状,也没有拒绝用例。按 Gate 口径,path 的真实覆盖仍是 missing 加一个标签错位的接受用例。
  • K-024 没有自己的 fixture,但 CLI runner 对全部 34 个 fixture 比对退出码与诊断 (code, severity),可作为间接证据;它仍不满足“每个特性有专属通过 + 拒绝用例”。
  • K-002 的 koine.resolve.unknown-sort 由阶段级 fixture check/unknown-sort 间接覆盖(未标 K-002),因此“没有 K 标签 fixture”不等于这条诊断完全无测试。
  • K-008 已弃用,不要求 fixture,因此不计入 Gate 缺口。

非 K 用例

fixture feature 命令 结果 说明
parser/unclosed-key parser check 拒绝 断言 koine.parse.unexpected-token 与 span
check/unknown-sort check check 拒绝 断言 koine.resolve.unknown-sort 与 span,间接触及 K-002

这两个用例都带 span.start/end 断言,是 span 稳定性的现成样本;它们不归属任何 K-###,不计入逐 K 表。

缺口分类

没有 fixture 与没有测试

情况 含义 本轮判定
没有 conformance fixture,但有实现测试 覆盖缺口:语义有单元/集成测试,但没走 CLI fixture,外部无法用 fixture 复现 18 个 K(含 K-024 的 runner 间接证据)
没有 conformance fixture,也没有实现测试路径 未测试:特性表证据为空或 — 本轮未发现;K-008 已弃用
有 fixture 但只有一侧 覆盖缺口:Gate 要求两侧 6 个 K(reject 侧)

本轮没有发现“特性表写 tested 但既无 fixture 也无实现测试路径”的特性。反过来,18 个 K 缺 fixture 是真实的 Gate 缺口,不能用“单元测试已覆盖”代替。

P0 核心语义缺口(审计时点)

P0 指 ROADMAP.md 中 M1/M4 明确点名、且语义处于核心路径的特性。

特性 现状 缺口
entity K-001 仅 runtime.rs 单元测试 missing(两侧都缺)
value K-002 仅 runtime.rs;阶段级 check/unknown-sort 间接覆盖未知类型 missing(缺 K 标签 fixture)
relation K-004 仅 runtime.rs missing
key K-005 仅 runtime.rs;parser/unclosed-key 只测语法 missing(key 结构、total/partial 语义均无 fixture)
state K-006 仅 runtime.rs missing
transition K-010 被 K-023 的 run fixture 间接执行,但没有自己的用例 missing
require K-011 2 个拒绝用例都是 check 类型错误,缺“守卫为 false 导致步骤被拒” reject(run 级守卫)
axiom K-012 有 check 拒绝与 init 违反的 run 拒绝,缺“transition 目标违反 axiom” reject(transition 目标)
derived K-026 只有 observe 接受用例 reject(写派生关系、key 违反)
view K-017 仅被 K-026/derived-view 间接观察,无 view 专属 fixture missing(含拒绝)
path K-018 唯一 fixture 实为 history 回放,未断言 path 结果 reject(且缺 path 语义断言)
diff K-019 只有 compare 接受用例 reject(越界下标、未知场景)
find K-020 3 个接受用例(found / not-found / unknown),not-found 与 unknown 的退出码都是 0 reject(非 Bool 谓词、求值失败、未知起点)
explore K-021 2 个接受用例(完整、depth 边界) reject(起点违反 axiom、未知起点)

审计时优先补的 8 条 fixture(已落地)

按“补一条能同时堵住语义缺口与 Gate 缺口”的标准排序。2026-11-26 已落地:第 1–7 条按建议补齐;第 8 条已补拒绝侧 K-021/explore-axiom-start 与通过侧 K-021/explore-axiom-target。

  1. K-001/entity-duplicate(check,拒绝):在 state s0 里对同一实体重复声明 o1: Order,预期 exit 1 且诊断 koine.state.duplicate-entity。
  2. K-004/unknown-relation(check,拒绝):transition 写入未声明的 shipped(order),预期 exit 1 且诊断 koine.resolve.unknown-relation。
  3. K-005/missing-total-key(check,拒绝):声明 key total (order) 的 status,state 里给出 o1 之外的实体 o2: Order 却无 status(o2, ...) 行,预期 exit 1 且诊断 koine.state.missing-total-key。
  4. K-006/duplicate-tuple(check,拒绝):state 里写出两条完全相同的 status(o1, Draft),预期 exit 1 且诊断 koine.state.duplicate-tuple。
  5. K-010/transition-target(run,通过):单步 pay 把 status(o1, Placed) 换成 Paid 并设置 time,预期 exit 0、step accepted: true、final 世界只保留新元组。
  6. K-011/require-false-run(run,拒绝):对 Draft 状态订单执行 pay(o1),预期 exit 1、step accepted: false、诊断含 koine.run.step-rejected,且 final 停在拒绝前的世界。
  7. K-017/view-unknown-relation(check,拒绝):view v = { missing_rel } 指向未声明关系,预期 exit 1 且诊断 koine.resolve.unknown-relation;可同时补一个只含已声明关系的接受用例,断言未列入 view 的关系不出现。
  8. K-021/explore-axiom-target(explore,通过):transition 的唯一目标世界违反 axiom 时不进入探索图,预期 exit 0、worlds_count=1、edges=[];拒绝侧(起点违反 axiom、exit 1)需要 runner 支持无 worlds 的 explore 失败后再补。

未进入前 8、但同样在 P0 缺口表里的 value、derived、path、diff、find 拒绝侧,建议在下一次补 fixture 时成对处理:K-026/derived-not-writable、K-018/path-replay、K-019/diff-range、K-020/find-non-bool。

复现

cd impl/rust
mise x rust@1.97.0 -- cargo test -p koine-cli --test conformance_cli -- --nocapture

输出逐条打印 pass / skip / FAIL 与 total/passed/skipped/failed 汇总,可直接与本页数字对照。

已解决

  • K-018 标签错位:原 K-018/history-basic 断言的是 history 命令的步骤回放,已归入 K-023(conformance/fixtures/K-023/history-basic);K-018 用 observe --at 补 path-prefix(通过)与 path-rejected(拒绝)双侧,按 path(start, steps, k) 重建第 k 步世界/视图关系。
  • 覆盖缺口:30 个 active K 均已具备通过 + 拒绝 fixture;K-008 deprecated,不计。特性表证据列已统一指向 conformance/fixtures/K-###。

状态

  • conformance/README.md 已同步为 82 个 fixture、38 pass / 44 reject、无 pending。
  • 特性表 31 个 K 中,30 个 active K 满足 Gate;K-008 已弃用。

相关

  • 特性表:K-### 状态与实现测试证据。
  • conformance/README.md:fixture 格式与 runner 对照规则。
  • ROADMAP.md:Gate 原则与里程碑。
  • 错误码:拒绝用例应断言的诊断码。

输入关键词开始搜索…

↑↓ 选择↵ 打开Esc 关闭