Skip to content

Conversation

@P-E-Meunier
Copy link

This is just simple code cleanup, and will allow to add more formats to the manifest.

}
}
#[test]
fn manifest() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests that:

  1. Verify that the default edition is CANARY during serialization
  2. Serialization fails when the edition doesnt match the format specified?

Also (nit) could you group them in a test mod?

#[serde(untagged)]
enum RawManifest {
Canary {
edition: Edition,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will most likely break stuff.

The old deserialization code mapped multiple different versions to the RawManifest::Canary format. In the future this is great to maintain backwards compat: Ie. you can introduce a new format of the RawManifest (e.g. V1) and determine into which one to deserialize by looking at the edition field first.

This MR lost that capability as far as i can tell: You deserialize everything that has an edition into Canary and everything without into Unknown (which is indeed the current behaviour, but rules out easy adoption of breaking manifest changes). If you now add the third variant to your code, you are not inspecting the edition format pre decoding.

One option i could see to recover this (if you feel strongly about not having manual deserialization in place) is to add newtypes around Edition which represents the subsets supported by one RawManifest variant.

Copy link
Contributor

@mara-schulke mara-schulke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to change / get rid of the manual serialization / deserialization code! Thanks for raising this. My main concerns evolve around the constraints wrt. edition management! If we can bring back the "This edition must serialize into this raw format" then im happy to roll with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants