Remap relative changed_files to absolute paths in analyze_changes (fixes #848) - #852
Open
asemraza wants to merge 1 commit into
Open
Remap relative changed_files to absolute paths in analyze_changes (fixes #848)#852asemraza wants to merge 1 commit into
asemraza wants to merge 1 commit into
Conversation
The affected-flows lookup and the no-ranges node fallback match changed_files against nodes.file_path, which stores absolute normalized paths. CLI callers pass repo-relative diff paths, so the exact IN (...) match found no nodes and detect-changes reported 0 affected flows while the MCP tool reported hundreds on identical input. Remap changed_files the same way analyze_changes already remaps changed_ranges keys. Already-absolute inputs pass through pathlib joining unchanged, so the MCP path is unaffected. Fixes tirth8205#848
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #848
Problem
analyze_changesremapschanged_rangeskeys to absolute paths, but passeschanged_filesthrough raw. The affected-flows lookup (get_node_ids_by_files, exactIN (...)match) and the no-ranges node fallback both compare those repo-relative CLI paths against the absolutenodes.file_path, so CLIdetect-changesprinted0 affected flow(s)whiledetect_changes_tool(which remaps before calling) reported 208 flows on identical input.Fix
Remap
changed_filesinanalyze_changesexactly the waychanged_rangeskeys are already remapped. Already-absolute inputs pass through pathlib joining unchanged, so the MCP path stays untouched.Test
New regression test stores nodes under absolute paths (as real builds do), passes relative
changed_filesplusrepo_root(as the CLI does), and asserts the flow is found. Verified it fails on main and passes with the fix. Full suite: 2,399 passed, ruff and mypy clean.