feat(json): add standard numeric conversion and owned encoder results - #1015
Merged
Conversation
sanohiro
marked this pull request as ready for review
September 10, 2026 10:00
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.
Owned JSON records containing finite f32/f64 fields now use the same structural codec as other supported leaves. Selected numbers decode directly to their target width with nearest/ties-even rounding; rounded overflow rejects, while grammar-valid unselected large numbers remain skippable.
Both
json.encodeandjson.encode_boundedreturnResult<string, Error>. Success transfers an independent output buffer; selected NaN/infinity and invalid byte limits returnError.Invalidwithout partial output. The compiler uses one encoder operation, reserves the source across limit evaluation, validates the complete MIR JSON sequence, and carries owned float graphs through V3/interface 12 and cache invalidation. Existing callers and English/Japanese contracts are synchronized. R65 and align-llm adoption remain separate.Validation covers independent numeric/descriptor goldens, host rounding modes, ownership/cleanup and native admission, every body emitter, whole/per-unit routes, cache changes and compiled ABI export parity. Local nine-pair measurements found no reproducible ordinary decode regression; the final mixed numeric encoder is faster than both baseline raw encoding and baseline plus the explicit owned copy. Detailed measurements and artifact identities are in
bench/json_numeric/r63-results.md.