Repository navigation
fix: parse on-file JSON floats exactly - #1605
Merged
Merged
Conversation
serde_json's default float parser is not correctly rounded, so 123456789.12345679 lands one ULP off and both tests fail.
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.
Fixes #1586
serde_json's default float parser is fast but not correctly rounded, so a JSON float from an
on-filehook could be stored one ULP off (123456789.12345679became123456789.1234568). This PR enables serde_json'sfloat_roundtripfeature in the workspaceCargo.toml. Every JSON number dirsql reads now parses to the exact double: hook rows, inferred path tables, and worker-function replies.Red
The test-only commit
a6df2e9cfailed CI for the reason the test asserts: https://github.com/thekevinscott/dirsql/actions/runs/41879125994/job/126746720725(
left: [Real(123456789.1234568), ...]/right: [Real(123456789.12345679), ...])Tests:
packages/rust/tests/on_file_float.rs: integration test with a declaredv REALtablepackages/rust/tests/on_file_float_e2e.rs: CLI e2e test of the issue's repro with an inferred path tableChecked by hand with the release binary: the issue's repro prints
[{"v":123456789.12345679,"eq":1}]. A run of 20,000 random doubles from Pythonjson.dumpscame back with 0 mismatches.E2E Verification
packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)testing-conventions e2e attest 'uv run python -m pytest tests/e2e/on_file_query_test.py tests/e2e/jsonl_parse_speed_test.py tests/e2e/use_case_transcripts_test.py tests/e2e/query_contract_test.py -x -q'(aftermaturin develop --releaseandcargo build --release --features cli)testing-conventions e2e attest 'pnpm exec vitest run --dir tests/e2e query-contract query-params'(afterpnpm build)cargo test -p dirsql --features cli --test on_file_float_e2e --test on_file_e2e --test path_table_on_file_e2e --test json_text_e2e --test functions_e2e(plus the on-file, schema-inference and functions integration tests)Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/for each changed package (every subsection but Summary_None._when nothing breaks)