@@ -1013,6 +1013,46 @@ def test_cli_baseline_generate_then_scan_round_trip(tmp_path: Path) -> None:
10131013 assert data ["risk_assessment" ]["score" ] == 0
10141014
10151015
1016+ def test_cli_baseline_round_trip_suppresses_every_occurrence_of_a_repeated_match (
1017+ tmp_path : Path ,
1018+ ) -> None :
1019+ """A match compacted across files is fingerprinted once per occurrence (#633)."""
1020+ skill = tmp_path / "demo"
1021+ (skill / "references" ).mkdir (parents = True )
1022+ (skill / "SKILL.md" ).write_text (
1023+ "---\n name: demo\n description: A demo skill for the baseline reproduction.\n ---\n \n "
1024+ "# Demo\n \n "
1025+ "The upstream service deletes unused files, and the link dies with no warning.\n " ,
1026+ encoding = "utf-8" ,
1027+ )
1028+ (skill / "references" / "notes.md" ).write_text (
1029+ "# Notes\n \n The mirror drops stale entries with no warning.\n " ,
1030+ encoding = "utf-8" ,
1031+ )
1032+ baseline_file = tmp_path / "baseline.yaml"
1033+
1034+ plain = runner .invoke (app , ["scan" , str (skill ), "--no-llm" , "--format" , "json" ])
1035+ assert plain .exit_code == 0 , plain .output
1036+ reported = [
1037+ (issue ["id" ], issue ["location" ]["file" ]) for issue in json .loads (plain .stdout )["issues" ]
1038+ ]
1039+ assert sorted (reported ) == [("AR2" , "SKILL.md" ), ("AR2" , "references/notes.md" )]
1040+
1041+ gen = runner .invoke (app , ["baseline" , str (skill ), "--no-llm" , "--output" , str (baseline_file )])
1042+ assert gen .exit_code == 0 , gen .output
1043+
1044+ scan = runner .invoke (
1045+ app ,
1046+ ["scan" , str (skill ), "--no-llm" , "--format" , "json" , "--baseline" , str (baseline_file )],
1047+ )
1048+ assert scan .exit_code == 0 , scan .output
1049+ data = json .loads (scan .stdout )
1050+ assert data ["issues" ] == []
1051+ assert sorted ((item ["id" ], item ["location" ]["file" ]) for item in data ["suppressed" ]) == sorted (
1052+ reported
1053+ )
1054+
1055+
10161056def test_cli_baseline_regeneration_excludes_in_tree_output (tmp_path : Path ) -> None :
10171057 """Regeneration cannot fingerprint findings created by the old output file."""
10181058 skill = tmp_path / "skill"
@@ -6163,6 +6203,7 @@ def test_cli_baseline_command_excludes_filtered_out_findings(tmp_path: Path) ->
61636203 "findings" : [Finding (rule_id = "SQP-1" , message = "one" , file = "SKILL.md" )],
61646204 "filtered_findings" : [],
61656205 "suppressed_findings" : [],
6206+ "active_findings" : [],
61666207 "file_cache" : {"SKILL.md" : source },
61676208 "risk_score" : 0 ,
61686209 }
@@ -6188,6 +6229,7 @@ def test_cli_baseline_uses_local_cache_for_provider_excluded_findings(tmp_path:
61886229 "findings" : [finding ],
61896230 "filtered_findings" : [finding ],
61906231 "suppressed_findings" : [],
6232+ "active_findings" : [finding ],
61916233 "file_cache" : {"SKILL.md" : "# Baseline helper\n " },
61926234 "local_file_cache" : {
61936235 "SKILL.md" : "# Baseline helper\n " ,
0 commit comments