Skip to content

test: parser conformance ratchet — cover the code that actually carries risk #104

Description

@pitimon

Test coverage in this repo is inverted relative to risk.

Verified

  • 118 test files, of which 12 test scripts/graph/ — a SCIP code-graph indexer for the maintainer's own agent tooling, not part of the product. It runs in every ci:local.
  • Parsers in the 8,816-line src/lib/rollout.js with no test file at all: hermes, codebuddy, craft, kimi. (droid, goose, kilo, roocode, zed, cursor, codex, claude are covered.)

CLAUDE.md:169-172 records the historical failure modes: dedup failures, cached-input semantics, snapshot-vs-cumulative confusion — 1.6× to 7× magnitude errors in the numbers the whole product exists to report. That is the class with no gate.

README:116 tells contributors "a new provider is usually one parser file away". Today that is true and unguarded: a new parser can land with no test and no CI objection.

Why a ratchet rather than a split

Splitting rollout.js is deferred by explicit decision, and splitting it would not have caught any of the recorded bugs — line count is not the risk, silent per-parser regression is. A conformance harness addresses the actual failure mode with zero churn to that decision.

Proposal

One table-driven test that enumerates every parse*Incremental export and, for each, requires a fixture directory whose parse output satisfies:

  • Column sum: total = input + output + cache_creation + cache_read + reasoning
  • No negative counts; model present (or the unknown placeholder, which fix(pricing): stop reporting the "unknown" placeholder as an unpriced model #94 defined)
  • Buckets aligned to 30-minute UTC boundaries
  • Idempotence: parsing the same fixture twice produces identical rows — the "run sync twice" lesson from CLAUDE.md:172, and the one that catches dedup-key instability

Parsers without a fixture go on an explicit allowlist, and CI fails if the allowlist grows. New parsers cannot opt out; existing gaps get closed as anyone touches them.

The ratchet assertion is the entire point. An allowlist that can grow is a TODO list, and this repo already has evidence about what happens to those.

Definition of done

  • Harness enumerates parsers from source, not from a hand-written list — a parser added without a fixture must fail, not be silently skipped
  • Allowlist committed with today's uncovered parsers and a count assertion that may only decrease
  • At least the four uncovered parsers get fixtures, or a recorded reason they cannot (e.g. no obtainable sample log)
  • Documented in CONTRIBUTING.md step 4 for adding a tool

Separately

scripts/graph/ (11 source + 12 test files) is personal tooling that pays rent in every ci:local run and inflates the coverage picture. Worth extracting to its own repo — filed as a separate chore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions