Make the order of headers deterministic when recording HAR files#7
Merged
mattt merged 3 commits intomattt:mainfrom Jan 16, 2026
Merged
Make the order of headers deterministic when recording HAR files#7mattt merged 3 commits intomattt:mainfrom
mattt merged 3 commits intomattt:mainfrom
Conversation
I couldn't figure out how to *deterministically* reproduce the issue, so these are stochastic. They fail 100% reliably in my dev environment, but I have no idea whether that will be the case elsewhere. For the record my output of `swift --version` is: swift-driver version: 1.120.5 Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5) Target: arm64-apple-macosx15.0
Owner
|
@tikitu This is absolutely the correct behavior. Thank you for contributing this change! |
mattt
approved these changes
Jan 16, 2026
Owner
|
This is now available in 0.3.1. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Swift dictionarys URLRequest.allHTTPHeaderFields and URLResponse.allHeaderFields do not guarantee a particular order of header keys. This produces unnecessary churn in the HAR files when re-recording requests, as the headers change order nondeterministically. Sorting the headers eliminates the churn.
The tests are stochastic but they failed reliably in my development environment; I couldn't figure out how to produce a deterministic failure however. My
swift --versionoutput:AI disclosure: I used an LLM-based agent (copilot in VSCode, with the model Claude Sonnet 4.5) as part of my development process for this contribution.