-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Smithy to 1.16.1 #1053
Upgrade Smithy to 1.16.1 #1053
Conversation
A new doc preview is ready to view. |
A new generated diff is ready to view. |
A new generated diff is ready to view. |
A new doc preview is ready to view. |
A new doc preview is ready to view. |
A new generated diff is ready to view. |
A new doc preview is ready to view. |
A new generated diff is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great! I think we may need more tests on the quoted header parsing
...kotlin/software/amazon/smithy/rust/codegen/smithy/generators/http/RequestBindingGenerator.kt
Outdated
Show resolved
Hide resolved
A new doc preview is ready to view. |
A new generated diff is ready to view. |
A new doc preview is ready to view. |
A new generated diff is ready to view. |
There are 5 protocol test failures for the server.
The 5 tests are new in Smithy 1.16 and are not regressions i.e. had they been in the current Smithy version we're using, the server would still have failed. The server is doing poorly at protocol tests; I'm working on reducing the failures. (1) is due to us not generating the tests correctly, we're not inserting the input headers to construct the request. Adding them should make many more tests pass. (2) is due to us only inserting I've created GitHub issues to track these and I will be tackling them shortly:
Since these fixes are semantically unrelated to this PR, I suggest I fix them in separate PRs. To unblock merging this PR, you can add this patch: diff --git a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt
index aad4fdc1..0afb1004 100644
--- a/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt
+++ b/codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/protocol/ServerProtocolTestGenerator.kt
@@ -431,6 +431,11 @@ class ServerProtocolTestGenerator(
private val AwsQuery = "aws.protocoltests.query#AwsQuery"
private val Ec2Query = "aws.protocoltests.ec2#AwsEc2"
private val ExpectFail = setOf<FailingTest>(
+ FailingTest(RestJson, "RestJsonInputAndOutputWithQuotedStringHeaders", Action.Request),
+ FailingTest(RestJson, "RestJsonInputAndOutputWithQuotedStringHeaders", Action.Response),
+ FailingTest(RestJson, "RestJsonOutputUnionWithUnitMember", Action.Response),
+ FailingTest(RestJson, "RestJsonUnitInputAllowsAccept", Action.Request),
+ FailingTest(RestJson, "RestJsonUnitInputAndOutputNoOutput", Action.Response),
FailingTest(RestJson, "RestJsonAllQueryStringTypes", Action.Request),
FailingTest(RestJson, "RestJsonQueryStringEscaping", Action.Request),
FailingTest(RestJson, "RestJsonSupportsNaNFloatQueryValues", Action.Request), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! might be worth fuzzing the many_dates stuff while we're there but not urgent
if inner.contains("\\\"") { | ||
inner = Cow::Owned(inner.replace("\\\"", "\"")); | ||
} | ||
let rest = then_delim(&input[(index + 1)..])?; | ||
if inner.contains("\\\\") { | ||
inner = Cow::Owned(inner.replace("\\\\", "\\")); | ||
} | ||
let rest = then_comma(&input[(index + 1)..])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could factor out fn replace(cow, pat, pat) -> cow
fn read_many_strings() { | ||
let test_request = http::Request::builder() | ||
.header("Empty", "") | ||
.header("Foo", "foo") | ||
.header("Foo", " foo") | ||
.header("FooInQuotes", "\" foo\"") | ||
.header("CommaInQuotes", "\"foo,bar\",baz") | ||
.header("QuoteInQuotes", "\"foo\\\",bar\",\"\\\"asdf\\\"\",baz") | ||
.header( | ||
"QuoteInQuotesWithSpaces", | ||
"\"foo\\\",bar\", \"\\\"asdf\\\"\", baz", | ||
) | ||
.header("JunkFollowingQuotes", "\"\\\"asdf\\\"\"baz") | ||
.header("EmptyQuotes", "\"\",baz") | ||
.header("EscapedSlashesInQuotes", "foo, \"(foo\\\\bar)\"") | ||
.body(()) | ||
.unwrap(); | ||
let read = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably also hit trailing whitespace
|
||
fuzz_target!(|data: &[u8]| { | ||
if let Ok(s) = std::str::from_utf8(data) { | ||
if let Ok(req) = http::Request::builder().header("test", s).body(()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this ever return OK? you can make a request without a URI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the builder builds successfully. I verified by adding a panic!
inside of the conditions, and it definitely gets triggered.
@@ -1,3 +1,8 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hooray for lints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from the server codegen perspective.
Description
This PR upgrades Smithy from 1.13 to 1.16.1.
Smithy change log here: https://github.com/awslabs/smithy/blob/main/CHANGELOG.md
Biggest changes:
@jsonName
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.