Skip to content

Conversation

@lsy357
Copy link
Collaborator

@lsy357 lsy357 commented Nov 6, 2025

What type of PR is this?

Check the PR title.

  • This PR title match the format: [<type>][<scope>]: <description>. For example: [fix][backend] flaky fix
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Add documentation if the current PR requires user awareness at the usage level.
  • This PR is written in English. PRs not in English will not be reviewed.

(Optional) Translate the PR title into Chinese.

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
fix(evaluation): BatchGetExperimentResult panic
zh(optional):

(Optional) Which issue(s) this PR fixes:

Commit Details

  • SHA: 8d21c20eed75b357e87cb4bed83e7bde91d8eade
  • Author: liushengyang [email protected]
  • Date: 2025-09-17 03:16:08

This PR was automatically created from commit 8d21c20eed75b357e87cb4bed83e7bde91d8eade.

Copy link
Collaborator

@CozeLoop CozeLoop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue identified: potential loss of duplicate entries when ordering experiment builders by ExptIDs; see inline comment.

Comment on lines +892 to +898
resultedBuilders := make([]*ExptResultBuilder, 0, len(exptIDToResultBuilder))
for _, exptID := range b.ExptIDs {
if got := exptIDToResultBuilder[exptID]; got != nil {
resultedBuilders = append(resultedBuilders, exptIDToResultBuilder[exptID])
}
}
b.ExptResultBuilders = resultedBuilders
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Potential loss of duplicate entries when ordering builders by ExptIDs. Using a map keyed by ExptID collapses duplicates if b.ExptIDs contains repeated IDs. The previous slice-based approach preserved duplicates; the new logic will drop them silently. If duplicates are possible at input (client/aggregation bugs do happen), this changes behavior and may produce fewer experiment results than expected. Consider preserving duplicates by ordering the existing slice stably according to b.ExptIDs instead of re-building from a map:

rank := make(map[int64]int)
for i, id := range b.ExptIDs { rank[id] = i }
sort.SliceStable(exptResultBuilders, func(i, j int) bool { return rank[exptResultBuilders[i].ExptID] < rank[exptResultBuilders[j].ExptID] })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants