Commit 4b3ec86c2f47

Vincent Demeester <vincent@sbr.pm>
2026-02-19 18:12:30
fix(review-tool): preserve unclassified items in exclude filters
Items without folder metadata (e.g. Jira issues) were incorrectly dropped when any folder exclude filter was active. They now pass through exclude-only filters since they can't match an exclude pattern anyway.
1 parent e057eda
Changed files (3)
tools
tools/review-tool/internal/filter/filter.go
@@ -55,10 +55,11 @@ func (f *Filter) FilterItems(items []activity.ActivityItem) []activity.ActivityI
 func (f *Filter) Match(item activity.ActivityItem) bool {
 	folders := itemFolders(item)
 
-	// Items with no folder metadata are dropped when any folder filter is active.
-	// They can't be classified, so they shouldn't slip through.
+	// Items with no folder metadata (e.g. Jira issues) pass through
+	// exclude filters (they can't match) but are dropped by include
+	// filters (they can't satisfy the constraint).
 	if len(folders) == 0 {
-		return false
+		return len(f.IncludeFolders) == 0
 	}
 
 	// Exclude check: if any folder matches an exclude pattern, reject
tools/review-tool/internal/filter/filter_test.go
@@ -49,7 +49,7 @@ func TestFilter_ExcludeFolder(t *testing.T) {
 		{"excludes home project", item(map[string]string{"project": "~/src/home (homelab)"}), false},
 		{"excludes home dir", item(map[string]string{"directory": "~/src/home"}), false},
 		{"keeps tektoncd", item(map[string]string{"project": "tektoncd/pipeline"}), true},
-		{"no metadata excluded", item(map[string]string{}), false},
+		{"no metadata passes through", item(map[string]string{}), true},
 	}
 
 	for _, tt := range tests {
tools/review-tool/default.nix
@@ -8,7 +8,7 @@
 
 buildGoModule {
   pname = "review-tool";
-  version = "0.1.0";
+  version = "0.3.0";
   src = ./.;
 
   vendorHash = null;