Skip to content

docs(ai): have the coverage tool write COVERAGE.md instead of writing it by hand #1270

Done

Description

@steward-warden

Problem

The coverage ratchet measures with the build MCP's coverage tool, but then writes COVERAGE.md by hand. P5 of the AI Coverage Phase Decision Procedure (ai/global/coverage-ratchet.instructions.md) says to "have Code Writer (docs only) write or overwrite COVERAGE.md", and P3 doesn't say which write_report value to use. In practice every coverage run passes write_report: false, and the table is assembled by hand from the job result.

That has two costs:

  • The orchestrating session sometimes tries to write the file itself through a shell heredoc, which is refused, before it delegates the write. That's one denial and an extra sub-agent per ratchet pass.
  • A hand-assembled table can drift from the tool's own format: row order, n/a rows, rounding.

The build MCP already knows how to write the file. Its coverage tool takes write_report, and the server owns the COVERAGE.md format (section order, per-language rows, Overall row).

Proposed change

  • P3: measure with write_report: false, as now, so a failed ratchet leaves COVERAGE.md untouched.
  • P5, on success: regenerate the file with the tool by calling coverage again with write_report: true. Don't hand-write it, and drop "have Code Writer write COVERAGE.md". Rerunning a full coverage job is slow, so the better option, if the tool supports it, is a write_report mode that writes the last measured result. Check which the build MCP offers before wording it.
  • Say explicitly that COVERAGE.md is never written with Bash or by hand.

Acceptance criteria

  • The decision procedure names the coverage tool and the write_report value for both measuring and writing.
  • No transcript shows COVERAGE.md written by a heredoc or an Edit/Write tool after the change reaches the agents.

Activity

  1. added
    AI-Work
    Medium
    Enhancement
    Blocked
    on Nov 24, 2026
  2. steward-warden commented on Nov 24, 2026

    @steward-warden
    CollaboratorAuthor

    Checked the build MCP: coverage with project: all and write_report: true writes the figures into COVERAGE.md at the repository root when the run succeeds (CoverageTool.cs, WriteReportProperty). The default is false, and the ratchet runs all pass false. So no second job is needed. The simplest procedure:

    • P3: measure once with project: all and write_report: true.
    • P4 fail: git restore COVERAGE.md, so the branch keeps main's baseline, then go on to P6 as now.
    • P5 pass: commit the COVERAGE.md the tool wrote. Nothing is assembled or written by hand.
  3. steward-warden commented on Nov 24, 2026

    @steward-warden
    CollaboratorAuthor

    Two build MCP changes now cover the tool side:

    New layout. The first two columns are unchanged, so the Overall extraction keeps reading column 2 of the **Overall (<Language>)** row:

    | Project | Line Coverage | Covered | Coverable |
    | --- | --- | --- | --- |
    | Credfeto.Foo | 82.1% | 1234 | 1503 |
    | **Overall (.NET)** | **82.1%** | **1234** | **1503** |
    

    What this issue's change should cover in the instructions:

    1. Drop every write_report mention, and let the tool write COVERAGE.md. On a ratchet pass, commit the file. On a fail, git restore COVERAGE.md.
    2. Update the format example under "Committed Coverage File" to the four columns, with Overall counts as the sum of the rows.
    3. State that the gate reads only the Line Coverage percentage on the Overall row; the counts exist so one component's row can be updated.
    4. Say that a single-project or single-package run updates its own row and Overall. When older rows have no counts, Overall is left unchanged and the job result's coverageReportNote says so; the next full run fills the counts in.
    5. Optionally note that n/a rows count as 0/0.

    Wait for a build MCP release that includes both PRs before rolling this out.

  4. steward-warden commented on Nov 24, 2026

    @steward-warden
    CollaboratorAuthor

    Implementation Plan

    Build MCP 0.0.10.211 is released with both coverage changes, so the instructions can now rely on the tool writing COVERAGE.md.

    1. ai/global/coverage-ratchet.instructions.md, decision procedure:
      • P3: measure once with the build MCP coverage tool on every component (project: all for .NET, package: all for Node). The run writes that language's section of COVERAGE.md itself.
      • P4 fail: git restore COVERAGE.md so the branch keeps main's baseline, then P6 as now.
      • P5 pass: commit the COVERAGE.md the tool wrote. Drop "have Code Writer (docs only) write or overwrite". Never write or edit the file by hand, with Bash, or with Edit/Write.
    2. Same file, "Committed Coverage File": four-column format example (Line Coverage | Covered | Coverable, Overall counts are the sum of the rows, Node uses Package). The gate reads only the Line Coverage percentage on the Overall row; the counts let one component's row be updated. Describe single-project/single-package row updates, old files without counts (Overall unchanged, coverageReportNote says why, the next full run fills them in), and n/a rows counting as 0/0. The Overall extraction still reads column 2.
    3. Bootstrap, rebase-conflict and the .NET/Node extraction text: the tool writes the file. A coverage run outside the AI Coverage phase that rewrote COVERAGE.md is restored, not committed.
    4. Other files that describe writing COVERAGE.md (git.instructions.md Pre-Work Baseline Check, dotnet.instructions.md Code Coverage, agent-roles.instructions.md Code Tester): align them. Keep every anchor other files link to. No write_report mention anywhere.

    No CHANGELOG entry (template repository).

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

Metadata

Metadata

Labels

AI-WorkBlockedEnhancementMedium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions