Skip to content

Off-by-one line count for added/deleted files in span tracker #483

Description

@pedropaulovc

File: action/src/spantracker/tracker.ts lines 59-85

Summary: Added-file (59-71) and deleted-file (73-85) branches compute line counts with raw content.split('\n').length, off-by-one for any file with trailing newline ('foo\n'.split('\n').length === 2 but file has 1 line) and fabricates phantom line 1 for empty files (''.split('\n').length === 1). countLines() helper in packages/diff-engine/src/line-diff.ts:166-171 handles these correctly.

Fix direction: replace split('\n').length with countLines(); skip inserting mapping when count is 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    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