Skip to content

fix: use stable comparator for playground parameter sorting#2381

Open
dan-lee wants to merge 1 commit intomainfrom
claude/fix-slack-issue-ojpkL
Open

fix: use stable comparator for playground parameter sorting#2381
dan-lee wants to merge 1 commit intomainfrom
claude/fix-slack-issue-ojpkL

Conversation

@dan-lee
Copy link
Copy Markdown
Contributor

@dan-lee dan-lee commented Apr 24, 2026

The previous comparator returned 1 for equal-ranked items instead of 0, violating strict weak ordering. This made Array.prototype.sort behavior implementation-defined: Chrome's V8 preserved insertion order while Firefox's SpiderMonkey reversed the non-required tail.

The previous comparator returned 1 for equal-ranked items instead of 0,
violating strict weak ordering. This made Array.prototype.sort behavior
implementation-defined: Chrome's V8 preserved insertion order while
Firefox's SpiderMonkey reversed the non-required tail.
@dan-lee dan-lee requested review from Copilot and mosch April 24, 2026 08:19
@dan-lee dan-lee added the bug label Apr 24, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
zudoku-cosmo-cargo Ready Ready Preview, Comment Apr 24, 2026 8:19am
zudoku-dev Ready Ready Preview, Comment Apr 24, 2026 8:19am

Request Review

@github-actions
Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 60.66%
🟰 ±0%
3029 / 4993
🔵 Statements 59.68%
🟰 ±0%
3204 / 5368
🔵 Functions 49.89%
🟰 ±0%
717 / 1437
🔵 Branches 48.57%
🟰 ±0%
2033 / 4185
File CoverageNo changed files found.
Generated in workflow #5174 for commit 91df4cb by the Vitest Coverage Report Action

@github-actions
Copy link
Copy Markdown

Preview build of published Zudoku package for commit 91df4cb.

See the deployment at: https://e29a63de.cosmocargo-public-package.pages.dev

Note

This is a preview of the Cosmo Cargo example using the Zudoku package published to a local registry to ensure it'll be working when published to the public NPM registry.

Last updated: 2026-04-24T08:22:22.119Z

Copy link
Copy Markdown
Contributor

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

Ensures deterministic ordering of OpenAPI Playground header/query parameters across JS engines by fixing the comparator to satisfy strict weak ordering when sorting by required.

Changes:

  • Replace the previous non-strict comparator with a numeric comparator that returns 0 when two parameters have the same required status.
  • Normalize nullable required flags via ?? false before comparison.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants