Skip to content

Add JSON number precision fixture - #77

Draft
leoromanovsky wants to merge 1 commit into
mainfrom
leo.romanovsky/json-exact-integers
Draft

leoromanovsky wants to merge 1 commit into
mainfrom
leo.romanovsky/json-exact-integers

Conversation

@leoromanovsky

Copy link
Copy Markdown
Collaborator

Motivation

A JSON variant value must return its numbers with their meaning unchanged. The README already requires adapters to "preserve the meaning and precision of the inputs and expected results". The existing case test-json-config-flag.json checks "integer": 1 and "float": 1.0, but no case checks integers that a double cannot hold.

An SDK that reads all JSON numbers as doubles returns 5.0 for 5, and changes integers above 2^53. For example, 9007199254740993 becomes 9007199254740992. JSON values often carry IDs and counts, so this is a correctness bug.

Changes

  • ufc-config.json: new flag json-number-precision-flag (JSON).
    • Variation within-double: 0, 5, -7, the int32 limits, 2147483648, 9007199254740991 (2^53 − 1), the floats 5.0 and 0.25, and a nested object and list.
    • Variation above-double: 9007199254740993, the int64 limits, and nested integers above 2^53.
    • A targeting rule on precision = above-double selects above-double. A static allocation serves within-double.
  • evaluation-cases/test-json-number-precision.json: two cases.
    • Case 0: no attributes, result within-double, reason STATIC. It runs on all platforms.
    • Case 1: precision = above-double, result above-double, reason TARGETING_MATCH. It skips nodejs and web, because JavaScript numbers cannot hold integers above 2^53.
  • README.md: a list entry for the new case file, and one sentence in the runner section: for JSON values, an integer stays an integer, and integers above 2^53 stay exact where the platform can represent them.

Decisions

  • Core suite, not a feature suite. The flag uses only existing UFC syntax, so CONTRIBUTING puts it in the root configuration.
  • Two cases, so that the skip is narrow. Only the integers above 2^53 are outside what JavaScript can hold. The within-double case still runs on nodejs and web.
  • Static splits only. No shards, so the results do not depend on a hash.

Verification

Checklist

  • JSON files are valid (no syntax errors)
  • New test cases reference existing flags in ufc-config.json
  • New flags have corresponding test cases in evaluation-cases/
  • Expected results match the flag configuration logic

A JSON variant value must keep each integer an integer and keep integers
above 2^53 exact. The new json-number-precision-flag returns one variant
with integers inside the double-precision range and floats, and one with
integers above 2^53. The second case skips nodejs and web, because
JavaScript numbers cannot hold those integers.
@leoromanovsky leoromanovsky mentioned this pull request Nov 17, 2026
4 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant