Skip to content

[skill] 拒收类用例必须断言 code+status,不能只断言「它抛了」—— 否则在裸 Error 的驱动上恒绿(#6142 实测) #6144

Closed

Description

@os-zhuang

来自 PR #6142(#6050 实施)的反向验证实测,值得写进 os-dev / pm-dispatch 的验证纪律条款。unassigned,交 devx 车道分诊。

事实

#6142 给 undefined 比较数装拒收闸时做反向验证(删掉闸、看哪些用例转红),实测结果分两种机制:

  • driver-sql 侧 22 红中,多数红在「抛出 knex 的裸 Undefined binding(s)」——那是一个 code / status 均为 undefined 的 Error;
  • driver-turso remote 侧 20 红全部红在「本该拒收却编译出了 SQL」(该 transport 从不抛)。

推论(PR 原文):一个只断言「它抛了」的拒收用例,会在本 issue 所针对的那个驱动上保持绿色——因为未修的驱动本来就抛,只是抛的是没有信封的裸错。这类用例看似钉住了拒收,实则对「缺 ADR-0112 信封」这一族缺陷完全失明。

建议条款(不代裁决,供 devx 定稿)

拒收/错误类用例的最低断言集:错误的 code 与 status(ADR-0112 信封),而不是 expect(...).toThrow() 或 rejects.toThrow() 单独使用;若措辞是契约的一部分(#5240「一个条件一种措辞」),再加首句断言。

关联:#6142 / #6050(出处)、#1116 / #4436(信封清点的历史单)、#5240(措辞一致)、#5347(拒收先例)。

Activity

  1. claude commented on Aug 7, 2026

    @claude
    Contributor

    Findings triage: PROMOTE — finding → pm:queue + domain:devx.

    Stale-premise check. Source PR #6142 (#6050) is the origin of the measurement and is recent; the reverse-verification numbers it reports (22 red in driver-sql, 20 red in driver-turso remote) are the evidence, and nothing on main has since changed the assertion style being critiqued.

    Why promote rather than hold. This is not an observation about code that might drift — it is a verified test-methodology defect with a demonstrated false-green, and the demonstration is unusually clean: on driver-sql the majority of cases went red by throwing knex's bare Undefined binding(s), an Error with code and status both undefined. So a rejection test written as expect(...).toThrow() passes on the very driver the fix targets, because the unfixed driver already throws — just without an ADR-0112 envelope. A test that cannot fail on the defect it names is worse than no test: it reads as coverage. The driver-turso remote side is the control that makes the point airtight (that transport never throws, so all 20 went red for the right reason).

    Landing site. skills/** ⇒ domain:devx per the SKILL domain table. The body asks for a clause in the os-dev / pm-dispatch verification discipline, which is exactly that surface. Concrete location, and an acceptance criterion statable in one sentence: rejection-class cases assert the error's code and status, not toThrow() alone; add first-sentence assertions only where wording is itself contract (#5240).

    Scope guard for whoever claims it — do not over-reach. The clause belongs in the skill text; it is not a licence to rewrite existing suites in the same PR. Retrofitting live rejection tests across the driver families is separate work with its own serialization constraints, and bundling it would turn a discipline change into a repo-wide diff.

    Dedup (full enumeration; search API unavailable to this seat). #6142/#6050 are the origin, #1116/#4436 the historical envelope-inventory cards, #5240 the wording-consistency rule this clause defers to. None of them state the assertion-floor rule; no duplicate.

    Not target:v17 — internal verification discipline, no shipped surface.

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


    Generated by Claude Code

  2. self-assigned this
    on Aug 7, 2026
  3. hotlong commented on Aug 7, 2026

    @hotlong
    Contributor

    ⛔ 认领(claim)

    派 1 名 os-dev。


    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