harness-audit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

harness-audit — Test Suite & Harness Quality Inspector

harness-audit — 测试套件与 Harness 质量检查器

Domain Rubric

领域准则

1. The Audit Hierarchy

1. 审计层级

Inspect target test suites across progressive architectural layers:
  1. Harness Anchor & Foundation Layer:
    • Inspect the authoritative project harness anchor at
      .agents/harness-anchor.md
      and follow its
      Governing Testing SSOTs
      routes to read project testing standards.
    • If missing: Check for legacy test guides (
      test/AGENTS.md
      ,
      tests/AGENTS.md
      ). If found, use as temporary SSOT and advise running
      /zenforge-init
      to establish canonical
      .agents/harness-anchor.md
      . If absent, mark anchor as
      UNGROUNDED
      and route to
      /zenforge-init
      .
    • Verify existence on disk of registered hermetic primitives (Deterministic Clock, Storage Sandbox, Fixtures / Factories, Transport / Network Mock, Lifecycle / Cleanup).
  2. Smells & Flakiness Traps:
    • Evaluate tests against anti-patterns and flakiness traps detailed in
      references/test-smells.md
      .
  3. Invariant Dimension Blind Spots:
    • Audit test coverage against invariant dimensions detailed in
      references/invariant-dimensions.md
      .
按渐进式架构层级检查目标测试套件:
  1. Harness Anchor 与基础层:
    • 检查位于
      .agents/harness-anchor.md
      的权威项目 Harness Anchor,并遵循其中的
      Governing Testing SSOTs
      路由,以读取项目测试标准。
    • 如果缺失:检查旧版测试指南(
      test/AGENTS.md
      、
      tests/AGENTS.md
      )。如果找到,则将其作为临时 SSOT,并建议运行
      /zenforge-init
      以建立规范的
      .agents/harness-anchor.md
      。如果均不存在,则将 Anchor 标记为
      UNGROUNDED
      ,并路由至
      /zenforge-init
      。
    • 验证已注册的 hermetic 原语(Deterministic Clock、Storage Sandbox、Fixtures / Factories、Transport / Network Mock、Lifecycle / Cleanup)在磁盘上是否存在。
  2. 异味与 Flakiness 陷阱:
    • 根据
      references/test-smells.md
      中详述的反模式和 flakiness 陷阱评估测试。
  3. 不变量维度盲区:
    • 根据
      references/invariant-dimensions.md
      中详述的不变量维度审计测试覆盖情况。

2. Mandatory Reference Grounding

2. 强制参考依据

Before executing audit passes, agents MUST read and ground themselves in:
  • references/test-smells.md
    for concrete smell definitions and remedies.
  • references/invariant-dimensions.md
    for invariant testing vectors.
执行审计前,Agent 必须阅读并依据以下内容:
  • references/test-smells.md
    :具体的异味定义和修复方案。
  • references/invariant-dimensions.md
    :不变量测试向量。

3. Review Verdicts & Citation Rule

3. 审查结论与引用规则

  • PASS
    : Harness anchor active; hermetic foundation verified; zero flakiness smells; balanced invariant dimension coverage.
  • WARN
    : Infrastructure present but maintenance debt observed (duplicate setup, missing assertion messages).
  • CRITICAL
    : Harness anchor absent, foundation missing (no virtual clock/ephemeral storage), or flakiness smells detected (clock leaks, sleeps).
  • Dual-Citation Rule: Every defect must cite both the offending code pointer (
    file:///path/to/test#L<N>
    ) and the violated invariant/remediation.
  • PASS
    :Harness Anchor 已启用;hermetic 基础已验证;不存在 flakiness 异味;不变量维度覆盖均衡。
  • WARN
    :基础设施已到位,但发现维护债务(重复 setup、缺少 assertion message)。
  • CRITICAL
    :Harness Anchor 缺失、基础缺失(无 virtual clock/ephemeral storage),或检测到 flakiness 异味(clock leak、sleep)。
  • 双重引用规则:每个缺陷必须同时引用问题代码指针(
    file:///path/to/test#L<N>
    )以及被违反的不变量或修复方案。

Canonical Output Contract

规范输出契约

markdown
undefined
markdown
undefined

Harness Audit Report: <Target Scope>

Harness Audit Report: <Target Scope>

1. Executive Verdict

1. Executive Verdict

  • Verdict: <PASS | WARN | CRITICAL>
  • Target Inspected: <Directory or Test Files>
  • Harness Anchor (SSOT): <Cited anchor pointer or 'UNGROUNDED (Missing .agents/harness-anchor.md)'>
  • Flakiness Risk: <LOW | MEDIUM | HIGH>
  • Summary: <Single-sentence technical judgment>
  • Verdict: <PASS | WARN | CRITICAL>
  • Target Inspected: <Directory or Test Files>
  • Harness Anchor (SSOT): <Cited anchor pointer or 'UNGROUNDED (Missing .agents/harness-anchor.md)'>
  • Flakiness Risk: <LOW | MEDIUM | HIGH>
  • Summary: <Single-sentence technical judgment>

2. Infrastructure & Anchor Gaps

2. Infrastructure & Anchor Gaps

(If clean: 'Harness anchor verified; foundational hermetic primitives active.')
  • [<Anchor / Primitive>] <Gap Title>: <Deficit description>
    • Impact: <Why this causes flakiness or maintenance debt>
    • Recommendation: <Architecture fix or seed anchor pointer>
(If clean: 'Harness anchor verified; foundational hermetic primitives active.')
  • [<Anchor / Primitive>] <Gap Title>: <Deficit description>
    • Impact: <Why this causes flakiness or maintenance debt>
    • Recommendation: <Architecture fix or seed anchor pointer>

3. Findings & Invariant Blind Spots

3. Findings & Invariant Blind Spots

  • [<Smell / Dimension>] <Title>: <Defect description>
    • Offending Code: <file>#L<N>
    • Remediation: <Exact architectural correction required>
undefined
  • [<Smell / Dimension>] <Title>: <Defect description>
    • Offending Code: <file>#L<N>
    • Remediation: <Exact architectural correction required>
undefined

Routing

路由

  • Missing harness anchor requires setup → (via /zenforge-init).
  • Missing foundational hermetic primitives requiring architectural trade-off deliberation → (via /clarify).
  • Discovered gaps or invariant blind spots ready for remediation planning → (via /changeset).
  • A supported changeset authorizes localized test remediation and its acceptance criteria/verification → (via /forge).
  • 缺少 Harness Anchor,需要初始化 →(通过
    /zenforge-init
    )。
  • 缺少需要权衡架构取舍的基础 hermetic 原语 →(通过
    /clarify
    )。
  • 发现可供修复规划使用的缺口或不变量盲区 →(通过
    /changeset
    )。
  • 已支持的 changeset 可授权局部测试修复及其验收标准与验证 →(通过
    /forge
    )。

Execution Protocol

执行协议

  1. Grounding & Scope Intake:
    • Inspect
      .agents/harness-anchor.md
      if present.
    • Read
      references/test-smells.md
      and
      references/invariant-dimensions.md
      .
  2. Scale-Adaptive Audit Dispatch:
    • In-Turn Execution (< 10 test files or localized suite): Inspect test suite against Audit Hierarchy directly in-turn.
    • Subagent Fan-Out (broad multi-package test suites): Launch concurrent
      research
      subagents dynamically scaled to partitioned directories or caller-declared budget, seeding with anchor and reference paths (offload raw test traces to
      .agents/scratch/harness-<slice>-dossier.md
      ).
  3. Synthesis & Turn-Halt Gate (Fan-in):
    • Deduplicate findings into the Canonical Output Contract with pointers to any offloaded dossiers.
    • Present completed report into conversation stream and halt turn immediately.
  1. 依据与范围接收:
    • 如果存在
      .agents/harness-anchor.md
      ,则检查该文件。
    • 阅读
      references/test-smells.md
      和
      references/invariant-dimensions.md
      。
  2. 规模自适应审计调度:
    • 轮内执行(少于 10 个测试文件或局部套件):直接在本轮中依据审计层级检查测试套件。
    • Subagent 扇出(广泛的多包测试套件):按目录分区或调用方声明的预算,动态调整并启动并发
      research
      Subagent,并向其提供 Anchor 和参考路径(将原始测试跟踪结果卸载到
      .agents/scratch/harness-<slice>-dossier.md
      )。
  3. 综合与轮次停止门(Fan-in):
    • 将发现去重并整合为规范输出契约,同时指向任何已卸载的 dossier。
    • 将完成的报告呈现在对话流中,并立即停止本轮。