Skip to content

±0 delta shown for all unchanged metrics when previous results exist #273

@alexshamrai

Description

@alexshamrai

Description

When previous-results are configured (for reports like fail-rate-report, previous-results-report, etc.), the summary report automatically switches from SummaryTable to SummaryDeltaTable, showing ±0 next to every metric that hasn't changed. This is noisy — in most runs the majority of values are unchanged, resulting in ±0 everywhere.

Reproduction

Workflow config (from integration-listener.yml):

- uses: ctrf-io/github-test-reporter@v1.0.27
  with:
    summary-report: true
    test-report: true
    fail-rate-report: true
    failed-folded-report: true
    previous-results-report: true
    skipped-report: true
    previous-results-max: 10

Note: summary-delta-report is not set. The user only asked for summary-report.

Example run: https://github.com/alexshamrai/junit-ctrf-reporter/actions/runs/23387307150

The summary table renders like:

Tests Passed Failed Skipped Other Flaky Duration
58 ↑2 58 ±0 0 ±0 0 ±0 0 ±0 0 ±0 11.2s ↓2ms

5 out of 7 columns show ±0, which adds visual clutter without conveying useful information.

Root cause

In src/github/core.ts, both the default path (line 34-38) and the summary-report path (line 232-240) auto-switch from SummaryTable to SummaryDeltaTable whenever previousResults exist:

if (hasPreviousResults === false) {
  addViewToSummary('### Summary', BuiltInReports.SummaryTable, report)
} else {
  addViewToSummary('### Summary', BuiltInReports.SummaryDeltaTable, report)
}

This was introduced in PR #240. The SummaryDeltaTable template always renders ±0 for zero-change values because there is no {{#if change}} guard — the {{else}} branch unconditionally outputs ±0.

The same pattern also affects fail-rate-table.hbs and flaky-rate-table.hbs.

Expected behavior(from my perspective)

When change is zero, no delta indicator should be shown. Only actual increases (↑) and decreases (↓) should be displayed. The absence of a delta indicator already communicates "no change."

Suggested fix

In the .hbs templates, wrap each delta snippet with {{#if change}} (Handlebars treats 0 as falsy) and remove the {{else}}±0 branch. Affected templates:

  • src/reports/summary-delta-table.hbs
  • src/reports/github.hbs (has outer guard already, just remove dead {{else}}±0 code)
  • src/reports/fail-rate-table.hbs
  • src/reports/flaky-rate-table.hbs

@Ma11hewThomas Let's discuss it, if I did not get the feature correct. But for me ±0 looks redundant and only adds a lot of noise to the report

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions