fix(ack): align numeric validation across platforms - #130
Merged
Conversation
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.
Summary
SchemaTypeinference and safe-integer boundary handling.uniqueItemsbehavior that landed in feat(generator): add AckInfer and AckModel generation #133.anyOfbranch ordering, and add a focused Chrome regression gate.Context
The VM preserves an
int/doublerepresentation boundary that JavaScript does not. Strict runtime-type checks therefore made mathematically equivalent JSON numbers validate differently across platforms. JSON Schema defines integers by value, so this change normalizes numeric values only when conversion is lossless.#133 independently fixed Draft 7
uniqueItemsequality. This branch now incorporates currentmainand preserves that implementation instead of replacing it.Behavior changes
Ack.integer()accepts finite numbers with no fractional part and returns anintwhen conversion is lossless.Ack.double()accepts exactly representable numeric inputs and returns adouble.Ack.anyOf; the first successful branch determines the runtime representation.Ack.number()continues to preserve the input's numeric representation.Ack.integer().safe()rejects values outside JavaScript's portable integer range without overflowing on the native minimum integer.No public API signatures or generated JSON Schema shapes change.
Verification
fvm dart run melos run ci --no-select— passed (strict analysis; root, Dart, and Flutter tests)uniqueItemstests on Chrome — passed; one native-only precision case skipped as intended on JavaScriptfvm dart scripts/api_check.dart ack 1.1.0— passedgit diff --check origin/main...HEAD— passed