Skip to content

发现型闸门在「什么都没发现」时静默通过:check-doc-authoring 与 check-driver-conformance 缺非空断言 #4932

Closed

Description

@os-zhuang

模式

两个闸门都靠「扫描发现目标 → 逐个检查」工作,而发现环节的失败被吞成空集合,空集合又天然通过所有检查。目录一旦被改名或移走,闸门就变成永远为绿的装饰品,且没有任何信号。

scripts/check-doc-authoring.mjs:45

const files = [];
for (const r of ROOTS) { try { walk(r, files); } catch {} }

某个 ROOT 不存在 → 静默少扫一批文件。极端情况 files 为空 → 「215 files clean」变成「0 files clean」,仍然退出 0。

scripts/check-driver-conformance.mjs:150

const listDir = (dir) => { try { return readdirSync(dir); } catch { return []; } };
…
function discoverDrivers() { return listDir(DRIVERS_DIR).filter(…) }

DRIVERS_DIR 不存在 → 发现 0 个 driver → 一致性检查无事可做 → 通过。模块头写着「An empty ledger is the intended steady state」,那说的是账本(LEDGER)可以为空;发现结果为空是完全不同的一件事,不该同样放行。

仓库里已有正例

temporal-conformance 那次(#4081)加过一条明确的非空守卫:「both TZ-skewed steps carry a non-vacuity guard that fails the job if the process zone is UTC or the offset is zero, so the coverage cannot silently evaporate」。这里缺的就是同一件东西。

建议

两处各加一条下限断言:发现数为 0(或显著低于上次)时 ::error:: 退 1,而不是打印一句「clean」。check-doc-authoring 已经在打印文件数,把那个数变成断言即可,成本极低。

相关

优先级不高 —— 这两处目前都在正常发现到目标(实测 check-doc-authoring 报 215 个文件)。记录的是可蒸发性,不是当前已蒸发。

Activity

  1. os-zhuang commented on Aug 5, 2026

    @os-zhuang
    ContributorAuthor

    分诊:入队 pm:queue,域 domain:devx。

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  2. self-assigned this
    on Aug 6, 2026
  3. os-zhuang commented on Aug 6, 2026

    @os-zhuang
    ContributorAuthor

    Claim(PM devx 车道):本单由本 PM 会话派发实现。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions