-
Notifications
You must be signed in to change notification settings - Fork 123
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
Fuzz serde enum representations #502
Conversation
Codecov ReportAll modified lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #502 +/- ##
===========================================
Coverage 100.00% 100.00%
===========================================
Files 80 82 +2
Lines 11178 14244 +3066
===========================================
+ Hits 11178 14244 +3066
☔ View full report in Codecov by Sentry. |
df51f7b
to
45314ab
Compare
@torkleyy Holy dang, serde attributes are a mess. This nightmare has really only unearthed two or three bugs in ron (around tagged enum tag identifier deserialising), many cases where we cannot roundtrip because serde's Content loses information (see serde-rs/serde#1183), but MANY nightmares around serde attributes just plain not roundtripping themselves. I will try to add some tests and update our restrictions README in the PR, but I won't spend any time prettifying our fuzzer at this point. It will hopefully get nicer over time as the above restrictions are lifted. Hopefully I can get this PR merged early next week and then finally, with the confidence that we now know about the limitations of serde attributes in ron, release v0.9. ... and I need to fix those tests ... later. And as always, the fuzzer finds another bug just as I think I'm done with this ;( |
3d1cf42
to
ecb0383
Compare
…e they are always serialized tag first)
…ernally tagged newtypes
…ndling yet, units fail
…for implicit Some inside untagged*
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
Fixes #500, since all (known) roundtrip issues are now documented and tested. Once serde allows us to fix them, they can be removed from the newly expanded restrictions section.
document that serde only supports unit, bool, integer, float, char, string, and byte keys inside flattened structs, and only string and byte keys anddocument that we only support string keys inside flattened maps (even though serde technically permits more, this support is not roundtrip-safe as soon as flattened maps are involved)u8
andu64
when the flattened struct is inside an untagged or internally tagged enum#[enable(implicit_some)]
is not supported withOption
s inside#[serde(flatten)]
PrettyConfig::struct_names(true)
is not supported inside flattened structs / struct variants#[serde(flatten)]
ed field:#[serde(flatten)]
ed map field, which collects all unknown fields#[serde(flatten)]
ed map, they must not contain:#[serde(flatten)]
ed fields must not contain:i128
oru128
valuesPrettyConfig::struct_names
settingOption
s with#[enable(implicit_some)]
must not contain any of these or a unit, unit struct, or an untagged unit variant#[enable(unwrap_variant_newtypes)]
ron::value::RawValue
#![enable(unwrap_variant_newtypes)]
extension is enabled#[serde(flatten)]
ed fields must not contain:ron::value::RawValue
using aPrettyConfig
may add leading and trailing whitespace and comments, which theron::value::RawValue
absorbs upon deserializationCHANGELOG.md
// BUG:
comments in the fuzzer again to ensure that nothing was missed / is unnecessary or out of place