Add validity checks on parse#517
Merged
Manishearth merged 3 commits intoboa-dev:mainfrom Aug 26, 2025
Merged
Conversation
166f1f7 to
7843230
Compare
7843230 to
753f0b7
Compare
nekevss
approved these changes
Aug 26, 2025
Contributor
|
Was this validated against test262? Updating temporal_rs to 0.0.13 breaks a bunch of leap second tests for me, this change seems to be the cause. $ git diff --unified=0 tools/test262/results.json | grep '+ ' | grep FAIL
+ "test/built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Instant/compare/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Instant/from/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Instant/prototype/equals/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Instant/prototype/toString/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Instant/prototype/toZonedDateTimeISO/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Now/plainDateISO/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Now/plainDateTimeISO/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Now/plainTimeISO/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/Now/zonedDateTimeISO/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDate/compare/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDate/from/argument-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDate/prototype/equals/argument-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDate/prototype/toPlainDateTime/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDateTime/compare/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDateTime/from/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDateTime/prototype/equals/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainDateTime/prototype/withPlainTime/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainMonthDay/from/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainMonthDay/prototype/equals/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainTime/compare/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainTime/from/argument-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainTime/from/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainTime/prototype/equals/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainYearMonth/compare/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainYearMonth/from/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/PlainYearMonth/prototype/equals/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/compare/argument-propertybag-timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/compare/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/from/argument-propertybag-timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/from/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/prototype/equals/argument-propertybag-timezone-string-leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/prototype/equals/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/prototype/withPlainTime/leap-second.js": "FAIL",
+ "test/built-ins/Temporal/ZonedDateTime/prototype/withTimeZone/timezone-string-leap-second.js": "FAIL", |
Contributor
Author
|
@linusg I validated most of the changes in temporal_rs 0.0.13 against test262, but not this one. I'm working on a fix. I believe the bug is that we should be checking IsValidDate but not IsValidTime. |
Contributor
Author
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.
https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar-static-semantics-early-errors requires us to check date/time validity on parse. This does so and adds a test for it.
This also makes ISO limits checks clearer, and adds a separate
check_validity()to be used elsewhere. As a further defense in depth mechanism we add some assertions around ISO datetime construction.I have not attempted to clean up
IsoFoo::new_uncheckedvsIsoFoo::new_with_overflow(reject)in these functions.