claudetool: add "related files" detection to codereview tool
diff --git a/claudetool/testdata/add_skipped_test.txtar b/claudetool/testdata/add_skipped_test.txtar
index 95000cc..099ebdd 100644
--- a/claudetool/testdata/add_skipped_test.txtar
+++ b/claudetool/testdata/add_skipped_test.txtar
@@ -19,6 +19,8 @@
Add skipped test
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (2cdfdc5009e364add9a263909472f85eb08480ed) and HEAD:
1: sketch.dev.TestP: New test is skipped
diff --git a/claudetool/testdata/empty_testdir_add_file.txtar b/claudetool/testdata/empty_testdir_add_file.txtar
index b754f3d..7c2be2d 100644
--- a/claudetool/testdata/empty_testdir_add_file.txtar
+++ b/claudetool/testdata/empty_testdir_add_file.txtar
@@ -29,6 +29,8 @@
Add non-empty file to testdata
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (cdc9ec6dfb8669c11d8aa0df49c72112627784dc) and HEAD:
1: sketch.dev.TestEmptyTestdata: Was passing, now failing
diff --git a/claudetool/testdata/gopls_issues.txtar b/claudetool/testdata/gopls_issues.txtar
index 56f1557..c0250ac 100644
--- a/claudetool/testdata/gopls_issues.txtar
+++ b/claudetool/testdata/gopls_issues.txtar
@@ -15,6 +15,8 @@
Add file with gopls issues
-- .run_test --
+# Errors
+
Gopls check issues detected:
1. /PATH/TO/REPO/p.go:5:2-22: unreachable code
diff --git a/claudetool/testdata/gopls_new_issue_with_existing.txtar b/claudetool/testdata/gopls_new_issue_with_existing.txtar
index d47fb02..594ea93 100644
--- a/claudetool/testdata/gopls_new_issue_with_existing.txtar
+++ b/claudetool/testdata/gopls_new_issue_with_existing.txtar
@@ -26,6 +26,8 @@
Add a new function with a new gopls issue
-- .run_test --
+# Errors
+
Gopls check issues detected:
1. /PATH/TO/REPO/p.go:9:2-31: unreachable code
diff --git a/claudetool/testdata/mark_test_skipped.txtar b/claudetool/testdata/mark_test_skipped.txtar
index bf887e3..d834ae4 100644
--- a/claudetool/testdata/mark_test_skipped.txtar
+++ b/claudetool/testdata/mark_test_skipped.txtar
@@ -24,6 +24,8 @@
Skip test
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (851ba0628e0e2d93e27e168d6af336f3e4d375c7) and HEAD:
1: sketch.dev.TestP: Was passing, now skipped
diff --git a/claudetool/testdata/multi_commit_review.txtar b/claudetool/testdata/multi_commit_review.txtar
index 2286dee..cbf2464 100644
--- a/claudetool/testdata/multi_commit_review.txtar
+++ b/claudetool/testdata/multi_commit_review.txtar
@@ -36,6 +36,8 @@
Add yet another file
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (a4fd3c2166b35e02a2cde466880e45aea6e6212e) and HEAD:
1: sketch.dev.TestX: New test is failing
diff --git a/claudetool/testdata/new_test_build_error.txtar b/claudetool/testdata/new_test_build_error.txtar
index 2fe1d34..2405c49 100644
--- a/claudetool/testdata/new_test_build_error.txtar
+++ b/claudetool/testdata/new_test_build_error.txtar
@@ -19,6 +19,8 @@
Add test with build error
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (cf75ed70e940ce33a17a70b1894ad053b67731c0) and HEAD:
1: sketch.dev: Previously had no tests, now has build/vet errors
diff --git a/claudetool/testdata/no_tests_to_failing_tests.txtar b/claudetool/testdata/no_tests_to_failing_tests.txtar
index b0cc956..6161586 100644
--- a/claudetool/testdata/no_tests_to_failing_tests.txtar
+++ b/claudetool/testdata/no_tests_to_failing_tests.txtar
@@ -19,6 +19,8 @@
Add failing test
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (cf75ed70e940ce33a17a70b1894ad053b67731c0) and HEAD:
1: sketch.dev.TestP: New test is failing
diff --git a/claudetool/testdata/passing_to_build_error.txtar b/claudetool/testdata/passing_to_build_error.txtar
index 9558862..6c7d1d0 100644
--- a/claudetool/testdata/passing_to_build_error.txtar
+++ b/claudetool/testdata/passing_to_build_error.txtar
@@ -24,6 +24,8 @@
Break test with build error
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (149798f10aaf06bc4700bb62d46ed6d8d88e35ad) and HEAD:
1: sketch.dev: Was passing, now has build/vet errors
diff --git a/claudetool/testdata/passing_to_failing.txtar b/claudetool/testdata/passing_to_failing.txtar
index 31a0556..50afae7 100644
--- a/claudetool/testdata/passing_to_failing.txtar
+++ b/claudetool/testdata/passing_to_failing.txtar
@@ -24,6 +24,8 @@
Break test
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (149798f10aaf06bc4700bb62d46ed6d8d88e35ad) and HEAD:
1: sketch.dev.TestP: Was passing, now failing
diff --git a/claudetool/testdata/passing_to_failing_subdir.txtar b/claudetool/testdata/passing_to_failing_subdir.txtar
index 7649554..1211912 100644
--- a/claudetool/testdata/passing_to_failing_subdir.txtar
+++ b/claudetool/testdata/passing_to_failing_subdir.txtar
@@ -24,6 +24,8 @@
Break test
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (8c6c71d0beac5e27b87dfc3f2fd9d274b62c3d3a) and HEAD:
1: sketch.dev/foo.TestP: Was passing, now failing
diff --git a/claudetool/testdata/related_files_cooccurrence.txtar b/claudetool/testdata/related_files_cooccurrence.txtar
new file mode 100644
index 0000000..b15f325
--- /dev/null
+++ b/claudetool/testdata/related_files_cooccurrence.txtar
@@ -0,0 +1,103 @@
+Tests related files identification based on historical co-occurrence
+
+-- a.go --
+package main
+
+func a() {}
+
+-- b.go --
+package main
+
+func b() {}
+
+-- c.go --
+package main
+
+func c() {}
+
+-- p.go --
+package p
+
+func d() {}
+
+-- .commit --
+Add functions to a.go and b.go
+
+-- a.go --
+package main
+
+func a() {
+ // Update 1
+}
+
+-- b.go --
+package main
+
+func b() {
+ // Update 1
+}
+
+-- .commit --
+Add functions to a.go and b.go again
+
+-- a.go --
+package main
+
+func a() {
+ // Update 2
+}
+
+-- b.go --
+package main
+
+func b() {
+ // Update 2
+}
+
+-- .commit --
+Add functions to a.go and c.go
+
+-- a.go --
+package main
+
+func a() {
+ // Update 3
+}
+
+-- c.go --
+package main
+
+func c() {
+ // Update 1
+}
+
+-- .commit --
+Update file a.go only
+
+-- a.go --
+package main
+
+func a() {
+ x := 42 // new gopls issue to view mixed info/error lines
+}
+
+-- .run_test --
+# Info
+
+Potentially related files:
+
+- p.go (33%)
+
+These files have historically changed with the files you have modified. Consider whether they require updates as well.
+
+
+# Errors
+
+Gopls check issues detected:
+
+1. /PATH/TO/REPO/a.go:4:5-6: declared and not used: x
+
+IMPORTANT: Only fix new gopls check issues in parts of the code that you have already edited. Do not change existing code that was not part of your current edits.
+
+
+Please fix before proceeding.
diff --git a/claudetool/testdata/skipped_to_build_error.txtar b/claudetool/testdata/skipped_to_build_error.txtar
index f648572..671b53b 100644
--- a/claudetool/testdata/skipped_to_build_error.txtar
+++ b/claudetool/testdata/skipped_to_build_error.txtar
@@ -25,6 +25,8 @@
Change skipped test to test with build error
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (3635353dfefb2fa652728318567209ccfc4aba42) and HEAD:
1: sketch.dev: Was passing, now has build/vet errors
diff --git a/claudetool/testdata/skipped_to_failing.txtar b/claudetool/testdata/skipped_to_failing.txtar
index 50348d2..98935e8 100644
--- a/claudetool/testdata/skipped_to_failing.txtar
+++ b/claudetool/testdata/skipped_to_failing.txtar
@@ -25,6 +25,8 @@
Change skipped test to failing test
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (3635353dfefb2fa652728318567209ccfc4aba42) and HEAD:
1: sketch.dev.TestP: Was skipped, now failing
diff --git a/claudetool/testdata/vet_error_test.txtar b/claudetool/testdata/vet_error_test.txtar
index 8c9dc64..0163a81 100644
--- a/claudetool/testdata/vet_error_test.txtar
+++ b/claudetool/testdata/vet_error_test.txtar
@@ -21,6 +21,8 @@
Add vet error
-- .run_test --
+# Errors
+
Test regressions detected between initial commit (656e4d573cb77a30ebce29ebb974533ece282946) and HEAD:
1: sketch.dev: Previously had no tests, now has build/vet errors