From 13fa10f220ac7adc3db7dbed543a3c2dfacbf588 Mon Sep 17 00:00:00 2001 From: Shubham Date: Thu, 19 Nov 2026 14:38:42 +1300 Subject: [PATCH] Pin both sides of the relative-folder fix, and the CLI's own spelling Arsh's two tests from his #463 review, held back so they would not void that PR's approvals. Mutation there showed two gaps the merged tests do not see: resolving only the before folder (a relative 'after' folder would rewrite the word 'after' in a card), and resolving even without labels (the command line would show a full path instead of the folder as typed). Each test fails against its mutant. --- tests/test_change_impact_no_paths.py | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/test_change_impact_no_paths.py b/tests/test_change_impact_no_paths.py index 440be6a..0c09af7 100644 --- a/tests/test_change_impact_no_paths.py +++ b/tests/test_change_impact_no_paths.py @@ -181,6 +181,39 @@ def test_a_relative_folder_does_not_rewrite_ordinary_text(tmp_path, monkeypatch) assert results[0]["evidence"]["detail"] == finding["evidence"]["detail"] +def test_a_relative_before_or_after_folder_does_not_rewrite_the_words(tmp_path, monkeypatch): + """#463 review (@ARSH871-bot): "." only proves the BEFORE side. A relative + after folder named "after" would rewrite the word "after" in a card if + only the before folder were resolved.""" + monkeypatch.chdir(tmp_path) + (tmp_path / "before").mkdir() + (tmp_path / "after").mkdir() + detail = "The filter was a deny before the edit and a permit after it." + monkeypatch.setattr(change_impact, "_analyse_change", lambda *a, **k: [ + {"summary": "A line moved.", + "evidence": {"detail": detail, "source": "compareFilters"}}]) + + results = change_impact.analyse_change("before", "after", labels=LABELS) + + assert results[0]["evidence"]["detail"] == detail + + +def test_without_labels_a_relative_folder_is_shown_as_typed(tmp_path, monkeypatch): + """#463 review: the command line keeps the user's own spelling. Resolving + without labels would turn "before" into a full path nobody typed.""" + monkeypatch.chdir(tmp_path) + (tmp_path / "before").mkdir() + (tmp_path / "after").mkdir() + + def down(host=None): + raise ConnectionError("down") + monkeypatch.setattr(change_impact, "connect", down) + + results = change_impact.analyse_change("before", "after") + + assert results[0]["evidence"]["source"] == "before -> after" + + def test_without_labels_the_command_line_still_shows_the_paths(tmp_path, monkeypatch): """The user typed these paths, so they are useful there, and not secret.""" before, after = _folders(tmp_path)