-
Notifications
You must be signed in to change notification settings - Fork 0
feature: Support mutating diffids #6
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -116,6 +116,112 @@ impl Mutation for EmptyEverything { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| /// Empty layers with null diff_ids | ||||||
| #[derive(Debug)] | ||||||
| pub struct EmptyLayersNullDiffIds; | ||||||
|
|
||||||
| impl Mutation for EmptyLayersNullDiffIds { | ||||||
| fn name(&self) -> &'static str { | ||||||
| "empty-layers-null-diffids" | ||||||
| } | ||||||
| fn category(&self) -> MutationCategory { | ||||||
| MutationCategory::Extreme | ||||||
| } | ||||||
|
|
||||||
| fn apply(&self, mut image: Image, _rng: &mut StdRng) -> Result<Image> { | ||||||
| // Clear all layers from manifest | ||||||
| image.layers.clear(); | ||||||
|
|
||||||
| // Set diff_ids to None (serializes as null or omitted) | ||||||
|
||||||
| // Set diff_ids to None (serializes as null or omitted) | |
| // Set diff_ids to None (will be omitted from serialization if using `skip_serializing_if = "Option::is_none"`) |
Copilot
AI
Jan 14, 2026
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.
The documentation says 'Sets diff_ids to null' but with the skip_serializing_if attribute, setting to None will omit the field rather than serialize it as null. Update the documentation to accurately describe the behavior as 'omits diff_ids' or 'removes diff_ids field'.
Copilot
AI
Jan 14, 2026
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.
The comment says 'null out diff_ids' but the field will be omitted during serialization due to skip_serializing_if. Consider changing to 'omit diff_ids' or 'remove diff_ids' for accuracy.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -344,10 +344,10 @@ impl ImageConfig { | |||
| rootfs: RootFs { | ||||
| // Empty tar has this digest (uncompressed) | ||||
| // The hash below is for empty content | ||||
| diff_ids: vec![ | ||||
| diff_ids: Some(vec![ | ||||
| "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" | ||||
| .to_string(), | ||||
| ], | ||||
| ]), | ||||
| rootfs_type: "layers".to_string(), | ||||
| }, | ||||
| history: None, | ||||
|
|
@@ -389,7 +389,10 @@ pub struct RootFs { | |||
| #[serde(rename = "type")] | ||||
| pub rootfs_type: String, | ||||
|
|
||||
| pub diff_ids: Vec<String>, | ||||
| /// Layer diff IDs. When None, serializes as null which can trigger | ||||
| /// edge cases in container runtimes that expect this field. | ||||
| #[serde(skip_serializing_if = "Option::is_none")] | ||||
|
||||
| #[serde(skip_serializing_if = "Option::is_none")] |
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.
The documentation comment says 'null diff_ids' but with the
skip_serializing_ifattribute on the field, setting diff_ids to None will omit the field from serialization rather than serialize it as null. Update the comment to reflect that the field will be 'omitted' rather than 'null'.