Skip to content

Bug: cobertura-max-hits-update-branch-untested #537

Description

@drmoisan
  • Work Mode: minor-audit

Summary

The max(hits) update assignment in Get-CoberturaClassLineSummary is exercised by no test, so the deduplication rule is pinned only for the first-entry-wins ordering and a regression to first-wins would pass the suite.

Environment

  • OS/version: Windows 11 Pro 10.0.26200
  • Python version: n/a (PowerShell / Pester 5)
  • Command/flags used: Invoke-Pester tests/scripts/vscode/Invoke-MSTestWithCoverage.Helpers.Tests.ps1 -CodeCoverage scripts/vscode/Invoke-MSTestWithCoverage.Helpers.ps1
  • Data source or fixture: scripts/vscode/Invoke-MSTestWithCoverage.Helpers.ps1:220

Steps to Reproduce

  1. Check out the branch that landed Cobertura post-processing double-counts <line> nodes, inflating lines-valid and every coverage rate #441 / Bug: merge-cobertura-classes-blends-union-with-primary-methods #478.
  2. Run the Pester suite for Invoke-MSTestWithCoverage.Helpers.Tests.ps1 with code coverage over Invoke-MSTestWithCoverage.Helpers.ps1.
  3. Inspect coverage of the max(hits) update assignment inside Get-CoberturaClassLineSummary.

Expected Behavior

Every branch of the stated deduplication contract should be pinned by a test. Get-CoberturaClassLineSummary documents max(hits) resolution for duplicate line numbers, so both orderings should be covered: the case where the first entry already carries the larger hits value, and the case where a later entry carries a strictly larger value and must overwrite it.

Actual Behavior

Only the first ordering is tested. Fixture F4 presents line 5 with hits=1 in .ctor () and hits=0 in .ctor (int), so the maximum is established by the first entry encountered and the update assignment at line 220 never executes. Coverage confirms it: new code measures 39/40 covered statements, and the single uncovered statement is that assignment. A regression that replaced max(hits) with first-entry-wins would leave the suite fully green.

Logs / Screenshots

  • Attached minimal logs or snippet
  • Snippet: new-code coverage 39/40 = 97.50%; the one uncovered statement is the max(hits) update at Helpers.ps1:220.

Impact / Severity

  • Blocker
  • High
  • Medium
  • Low

No defect in current behavior - the implementation is correct and the arithmetic oracle (79957 / 56124 / 23109 / 13472) is reproduced exactly. This is a test-adequacy gap on the headline max(hits) semantics of #441, raised in that feature's review as non-blocking finding NF-1. New-code coverage of 97.50% already clears the >= 90% floor, so no gate is failing.

Source

From: docs/features/potential/2026-08-10-cobertura-max-hits-update-branch-untested.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions