Skip to content

fix(coverage): a parse-error range can end one line past the end of the file #1966

Description

@CaptainMittens

scripts/setup-windows.ps1 has 326 lines. Its parse-coverage report ends the last range at line 327, which does not exist:

113-113,113-113,245-327

Found while building the CI coverage gate in #1941; not fixed there.

What happens

The tree-sitter node for that region is start=(244,2) end=(326,0). An end column of 0 means the node stopped right after the previous line's newline, so it holds no text on the row it points at. cbm_error_regions_push adds 1 to that row to convert to 1-based, which names one line past the end of the file whenever a region runs to EOF.

Why it matters

A reader told to open line 327 of a 326-line file has been given advice that cannot be followed, in a report whose whole job is to say honestly which lines are missing. It also inflates the range's share of the file, which the coverage gate added in #1941 measures against a 25% threshold.

Suggested fix

Clamp the end to the row above when the end column is 0 and the node spans more than one row.

Related: #963, #1941. Sibling finding: the duplicated 113-113 range in the same string.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.windowsWindows-specific issues

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions