fix: stabilize generated instructions README ordering#1846
Conversation
Pass an explicit 'en' locale to localeCompare for instruction title sorting in update-readme.mjs. Previously the default OS locale was used, causing String.prototype.localeCompare to produce different orderings on Windows vs Ubuntu (affecting characters like Korean and Japanese CJK titles), which made the validate-readme CI workflow non-deterministic. Fixes the root cause of the locale-dependent sort instability.
|
🔴 Contributor Reputation Check: HIGH risk
Maintainers: please review this contributor before merging. |
|
🔴 Contributor Reputation Check: HIGH risk
Maintainers: please review this contributor before merging. |
|
🔴 Contributor Reputation Check: HIGH risk
Maintainers: please review this contributor before merging. |
|
🔴 Contributor Reputation Check: HIGH risk
Maintainers: please review this contributor before merging. |
|
🔴 Contributor Reputation Check: HIGH risk
Maintainers: please review this contributor before merging. |
The
validate-readmeworkflow failed becausenpm run buildregenerateddocs/README.instructions.mdwith a different row order on the Ubuntu GitHub Actions runner.Pull Request Checklist
npm startand verified that README.md is up to date.stagedbranch for this pull request.Description
String.prototype.localeCompareuses the host OS locale when no locale argument is supplied.The root cause was OS-dependent default locale behavior in
String.prototype.localeCompare. On Windows the generator sorted the Japanese C# instruction before the Korean C# instruction; on Ubuntu the same code sorted them in reverse order, causinggit diff --exit-codeto fail.The fix is a one-line change in update-readme.mjs: pass
'en'as the explicit locale argument to everylocaleComparecall used for title sorting, so the output is identical regardless of the OS the generator runs on.Type of Contribution
eng/update-readme.mjssort deterministic by passing an explicit'en'locale tolocaleCompareAdditional Notes
Only update-readme.mjs is changed (2 lines). No new files, no behaviour change beyond sort determinism. The regenerated README.instructions.md is included in the commit so CI passes immediately.
By submitting this pull request, I confirm that my contribution abides by the Code of Conduct and will be licensed under the MIT License.