Skip to content

fix(analyze): renamed files keep their removed symbols in branch analysis #901

Closed

Description

@dan-petty

Context & Rationale

Found in #787's review, with the same symptom. git diff --name-status reports renames as R<score>\told\tnew (a scratch repo printed R050\tmod.py\tmoved.py). analyze_branch (src/devops_cli/commands/analyze.py:504-508) splits each line with split(maxsplit=1), so the path becomes mod.py\tmoved.py. That path does not exist, so the file is treated as deleted, and _fetch_git_file_content rejects the tab. A symbol removed during a rename never reaches symbols_removed.

Scope & Deliverables

  • Deliverable: R and C lines are parsed into an old and a new path, and the base is read from the old path; or the diff runs with --no-renames (proposed: parse, so renames stay visible).
  • Acceptance criteria: a real repository under tmp_path renames mod.py to moved.py and removes gone(); branch analysis reports gone in symbols_removed for moved.py. uv run devops ci passes.

Strategic Alignment

Activity

  1. added
    type/bug
    scope/review
    priority/p2-medium
    on Oct 1, 2026
  2. dan-petty commented on Oct 4, 2026

    @dan-petty
    OwnerAuthor

    Fixed by #593 (PR #932, merged 2026-10-02 into release/v0.2.25, shipped in v0.2.25 via 7911941). list_changed_files runs git diff --name-status -z --find-renames (src/devops_cli/git/operations.py:378), and _parse_name_status (:387-398) gives an R or C entry its old path, so branch analysis reads a renamed file's base at that old path. The acceptance case was re-run on release/v0.2.26 at 8ab87de: a real tmp_path repo renames mod.py to moved.py and removes gone(), and analyze branch feature --base main --no-enhanced saves [('moved.py', 'renamed', ['gone'])] as the symbols removed. The behaviour is pinned by tests/test_git_operations.py:447 and tests/test_analyze.py:707.

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

    priority/p2-mediumscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions