From 393201ac23707dff38037f4961f955db7e413b67 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 12 Jan 2026 22:47:10 +0100 Subject: syz-cluster: prioritize blob-based base commits Consider Cc'd mailing lists when selecting the exact base commit. Among the base commits determined based on blob sha value from the git patch, first select the ones that match both the trees of the Cc'd subsystems and their primary branches. If it gives no exact match, select a base commit that comes from a tree of a Cc'd subsystem. As fallback, take any subsystem tree. This should prevent valid, but suprising patch series triage results. --- syz-cluster/pkg/triage/commit_test.go | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'syz-cluster/pkg/triage/commit_test.go') diff --git a/syz-cluster/pkg/triage/commit_test.go b/syz-cluster/pkg/triage/commit_test.go index d510d5b9b..80f6b99b2 100644 --- a/syz-cluster/pkg/triage/commit_test.go +++ b/syz-cluster/pkg/triage/commit_test.go @@ -87,6 +87,80 @@ func TestCommitSelector(t *testing.T) { } } +func TestFromBaseCommits(t *testing.T) { + trees := []*api.Tree{ + { + Name: "A", + Branch: "master", + EmailLists: []string{"list_A"}, + }, + { + Name: "B", + Branch: "master", + EmailLists: []string{"list_B"}, + }, + { + Name: "C", + Branch: "main", + EmailLists: []string{"list_C"}, + }, + { + Name: "D", + Branch: "main", + EmailLists: nil, + }, + } + commits := []*vcs.BaseCommit{ + { + Commit: &vcs.Commit{Hash: "first"}, + Branches: []string{"C/main"}, + }, + { + Commit: &vcs.Commit{Hash: "second"}, + Branches: []string{"A/other", "B/other"}, + }, + { + Commit: &vcs.Commit{Hash: "third"}, + Branches: []string{"A/master", "A/other"}, + }, + } + t.Run("best branch", func(t *testing.T) { + tree, commit := FromBaseCommits(&api.Series{ + Cc: []string{"list_A"}, + }, commits, trees) + assert.Equal(t, "A", tree.Name) + assert.Equal(t, "third", commit) + }) + t.Run("best tree", func(t *testing.T) { + // Even though C/main matches perfectly, there's a commit + // in the higher prio tree B. + tree, commit := FromBaseCommits(&api.Series{ + Cc: []string{"list_B", "list_C"}, + }, commits, trees) + assert.Equal(t, "B", tree.Name) + assert.Equal(t, "second", commit) + }) + t.Run("any tree", func(t *testing.T) { + // If no trees matching by Cc'd list are in the base commit list, + // consider all trees. + commits := []*vcs.BaseCommit{ + { + Commit: &vcs.Commit{Hash: "first"}, + Branches: []string{"B/main"}, + }, + { + Commit: &vcs.Commit{Hash: "second"}, + Branches: []string{"C/main"}, + }, + } + tree, commit := FromBaseCommits(&api.Series{ + Cc: []string{"list_A"}, + }, commits, trees) + assert.Equal(t, "B", tree.Name) + assert.Equal(t, "first", commit) + }) +} + func date(date string) time.Time { t, err := time.Parse("2006-Jan-02", date) if err != nil { -- cgit mrf-deployment