Skip to content

Tool: benchmark-gate compare, check refactor, and docs #29

Description

@AamiriYouness

What

Wire BenchmarkComparisonEngine and the new reporters into a real
benchmark-gate compare command, refactor CheckCommand into pure
orchestration over the same comparison engine, and update docs.

CLI

benchmark-gate compare \
  --baseline <path> \
  --results <path> \
  [--format console|json|markdown] \
  [--output <path>] \
  [--quiet]

Explicitly absent: --policy, --fail-on-warning, JUnit output, any
threshold arguments.

CheckCommand refactor

Parse results
  → load, validate, and compile baseline
  → load, validate, and compile policy
  → BenchmarkComparisonEngine.Compare
  → RegressionEvaluator.Evaluate
  → decision reporting (unchanged reporters from v0.2/v0.3)
  → exit-code mapping

CheckCommand must not itself calculate percentages, match benchmarks,
match metrics, check units, or derive improvement/degradation direction
— all of that is BenchmarkComparisonEngine's job, called once, from
one place.

CompareCommand

Parse results
  → load, validate, and compile baseline
  → BenchmarkComparisonEngine.Compare
  → comparison reporting
  → exit-code mapping

No policy acquisition anywhere in this path.

Exit code mapping (reuses existing ExitCodes, no new codes)

Condition Code
Comparison completed, regardless of improvement/degradation Passed (0)
Invalid/incomplete CLI arguments InvalidArguments (2)
Baseline could not be loaded/validated/compiled InvalidBaselineOrPolicy (3)
Results could not be parsed UnsupportedSchema (8)
Unexpected internal failure InternalError (10)
Requested report could not be written OutputWriteFailure (11)

ValidationFailed (12) is explicitly excluded — compare produces no
severity-based verdict. A slower benchmark, an added/removed benchmark,
a missing metric, a unit mismatch — none of these are process failures;
they're comparison results. The command fails only when it cannot
construct a trustworthy comparison artifact at all.

Docs

  • README.md — compare usage section, matching the existing
    check/capture/validate section format
  • docs/ARCHITECTURE.md — comparison layer added to the pipeline diagram
  • docs/EXIT-CODES.md — compare's column added to the "Returned by" field
    for each applicable code
  • CLI help text / Program.cs command description

Acceptance criteria

  • CompareCommand.cs and CheckCommand.cs follow the same
    thin-orchestration pattern as existing commands — no comparison
    logic in either command itself
  • Integration tests (CompareCommandTests) covering: valid
    comparison, each --format option, added/removed benchmarks,
    nonexistent baseline/results paths, --output file writing
  • CheckCommand's existing test suite passes unmodified in outcome
    (same SuiteDecision/exit codes for the same inputs) after the
    refactor
  • README/ARCHITECTURE.md/EXIT-CODES.md updated

Depends on #26, #27, #28.

Metadata

Metadata

Assignees

Labels

area:toolsize:mtype:feature

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions