Skip to content

Commit f21a533

Browse files
chore: don't skip float truncation tests
1 parent c610a5b commit f21a533

File tree

1 file changed

+9
-7
lines changed
  • codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen

1 file changed

+9
-7
lines changed

codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/AwsProtocolUtils.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,15 @@ private static boolean filterMalformedRequestTests(
310310
HttpMalformedRequestTestCase testCase,
311311
TypeScriptSettings settings
312312
) {
313-
//TODO: underflow/overflow not rejected yet
314-
if (testCase.hasTag("underflow/overflow")) {
315-
return true;
316-
}
317-
318-
//TODO: float truncation not rejected yet
319-
if (testCase.hasTag("float_truncation")) {
313+
// Handling overflow/underflow of longs in JS is extraordinarily tricky.
314+
// Numbers are actually all 62-bit floats, and so any integral number is
315+
// limited to 53 bits. In typical JS fashion, a value outside of this
316+
// range just kinda silently bumbles on in some third state between valid
317+
// and invalid. Infuriatingly, there doesn't seem to be a consistent way
318+
// to detect this. We could *try* to do bounds checking, but the constants
319+
// we use wouldn't necessarily work, so it could work in some environments
320+
// but not others.
321+
if (operation.getId().getName().equals("MalformedLong") && testCase.hasTag("underflow/overflow")) {
320322
return true;
321323
}
322324

0 commit comments

Comments
 (0)