ron-rs / ron

Rusty Object Notation
https://docs.rs/ron
Apache License 2.0
3.31k stars 122 forks source link

Fuzz serde enum representations #502

Closed juntyr closed 1 year ago

juntyr commented 1 year ago

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.

codecov-commenter commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (2f3e5a8) 100.00% compared to head (2493a59) 100.00%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #502 +/- ## =========================================== Coverage 100.00% 100.00% =========================================== Files 80 82 +2 Lines 11178 14244 +3066 =========================================== + Hits 11178 14244 +3066 ``` | [Files](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [src/de/id.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2RlL2lkLnJz) | `100.00% <100.00%> (ø)` | | | [src/de/mod.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2RlL21vZC5ycw==) | `100.00% <100.00%> (ø)` | | | [src/de/tag.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2RlL3RhZy5ycw==) | `100.00% <100.00%> (ø)` | | | [src/parse.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3BhcnNlLnJz) | `100.00% <100.00%> (ø)` | | | [src/value/raw.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL3ZhbHVlL3Jhdy5ycw==) | `100.00% <100.00%> (ø)` | | | [tests/115\_minimal\_flattening.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvMTE1X21pbmltYWxfZmxhdHRlbmluZy5ycw==) | `100.00% <100.00%> (ø)` | | | [tests/401\_raw\_identifier.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvNDAxX3Jhd19pZGVudGlmaWVyLnJz) | `100.00% <100.00%> (ø)` | | | [tests/407\_raw\_value.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvNDA3X3Jhd192YWx1ZS5ycw==) | `100.00% <100.00%> (ø)` | | | [tests/449\_tagged\_enum.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvNDQ5X3RhZ2dlZF9lbnVtLnJz) | `100.00% <100.00%> (ø)` | | | [tests/502\_known\_bugs.rs](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-dGVzdHMvNTAyX2tub3duX2J1Z3MucnM=) | `100.00% <100.00%> (ø)` | | | ... and [1 more](https://app.codecov.io/gh/ron-rs/ron/pull/502?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

juntyr commented 1 year ago

@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 https://github.com/serde-rs/serde/issues/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 ;(

juntyr commented 1 year ago

@torkleyy I think this is finally ready (I want to merge and rebase on #512 first). Gosh this PR is huge ... and soooo cursed. And probably once the fuzzer changes lands I get many new edge case reports soon. But it is a small step phew*

Oh and the benchmark failure should be fixed by this PR too