Skip to content

Remap relative changed_files to absolute paths in analyze_changes (fixes #848) - #852

Open
asemraza wants to merge 1 commit into
tirth8205:mainfrom
asemraza:fix/cli-affected-flows-relative-paths
Open

Remap relative changed_files to absolute paths in analyze_changes (fixes #848)#852
asemraza wants to merge 1 commit into
tirth8205:mainfrom
asemraza:fix/cli-affected-flows-relative-paths

Conversation

@asemraza

Copy link
Copy Markdown

Fixes #848

Problem

analyze_changes remaps changed_ranges keys to absolute paths, but passes changed_files through raw. The affected-flows lookup (get_node_ids_by_files, exact IN (...) match) and the no-ranges node fallback both compare those repo-relative CLI paths against the absolute nodes.file_path, so CLI detect-changes printed 0 affected flow(s) while detect_changes_tool (which remaps before calling) reported 208 flows on identical input.

Fix

Remap changed_files in analyze_changes exactly the way changed_ranges keys 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_files plus repo_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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CLI detect-changes --brief prints 0 affected flows where detect_changes_tool reports 208 on identical input

1 participant