Skip to content

Conversation

@felixge
Copy link
Owner

@felixge felixge commented May 2, 2025

No description provided.

@felixge felixge requested a review from Copilot May 2, 2025 11:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to address flaky tests by stabilizing the order of stack outputs.

  • Added a sorting step to order the wallclock stacks by their count.

Comment on lines +209 to +210
sort.Slice(stacks, func(i, j int) bool {
return stacks[i].count < stacks[j].count
Copy link

Copilot AI May 2, 2025

Choose a reason for hiding this comment

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

Consider using sort.SliceStable or adding a secondary tie-breaker when counts are equal to ensure a fully deterministic order, which may further reduce flakiness in tests.

Suggested change
sort.Slice(stacks, func(i, j int) bool {
return stacks[i].count < stacks[j].count
sort.SliceStable(stacks, func(i, j int) bool {
if stacks[i].count != stacks[j].count {
return stacks[i].count < stacks[j].count
}
// Secondary tie-breaker: compare memory addresses of the stack objects
return fmt.Sprintf("%p", stacks[i]) < fmt.Sprintf("%p", stacks[j])

Copilot uses AI. Check for mistakes.
@felixge felixge merged commit 80d4e40 into master May 2, 2025
1 check passed
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.

2 participants