From 0cae09c206af866a729f8519304134802cc793c5 Mon Sep 17 00:00:00 2001 From: Gavriel-lab <283703506+Gavriel-lab@users.noreply.github.com> Date: Sun, 31 May 2026 23:57:00 +0800 Subject: [PATCH] fix: make gene selector ordering deterministic --- pkg/gene/selector.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/gene/selector.go b/pkg/gene/selector.go index 40e31ef..fa14fe2 100644 --- a/pkg/gene/selector.go +++ b/pkg/gene/selector.go @@ -83,7 +83,13 @@ func SelectGenes(genes []Gene, signals []string, preset StrategyPreset, maxResul // Sort by score descending sort.Slice(candidates, func(i, j int) bool { - return candidates[i].Score > candidates[j].Score + if candidates[i].Score != candidates[j].Score { + return candidates[i].Score > candidates[j].Score + } + if candidates[i].Gene.Confidence != candidates[j].Gene.Confidence { + return candidates[i].Gene.Confidence > candidates[j].Gene.Confidence + } + return candidates[i].Gene.VerifiedBy > candidates[j].Gene.VerifiedBy }) if maxResults > 0 && len(candidates) > maxResults {