Repository navigation
Sum legacy probability totals in a fixed order in both readers - #5
Open
0xkaushik-ai wants to merge 1 commit into
Open
0xkaushik-ai wants to merge 1 commit into
0xkaushik-ai wants to merge 1 commit into
Conversation
Python used sum(), which is compensated since 3.12, so the same legacy answer passes the 1e-6 total check on 3.11 and fails it on 3.12+. TypeScript added in Object.entries order, which moves integer-like keys first. Both now add sequentially in the reader's existing tie order.
This branch has not been deployed
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.
decision_foranddecisionForcheck that a legacy answer's probabilities sum to 1 within 1e-6. The total was built differently on each side, so the two SDKs disagree on answers that land exactly on that edge, and so does the Python package across interpreter versions.sum(), which has been compensated since 3.12.[0.060817, 0.532085, 0.407097]adds to0.9999990000000001sequentially (accepted) but to0.999999undersum()(rejected). The same wheel accepts this answer on 3.11 and rejects it on 3.12+.Object.entriesorder, which puts integer-like keys first, so{"b", "1", "a"}is summed in a different order than the JSON lists it.Both readers now add sequentially in UTF-8 key order, which the reader already uses for ties. Two legacy fixtures pin the edge: before this change the first fails on Python 3.12+ and the second fails in both SDKs.
Found by feeding the same random answers to both readers and diffing the results. The v1 path is unaffected since those totals are integers.