Skip to content

feature: Support mutating diffids#6

Open
romoh wants to merge 1 commit intomainfrom
user/romoh/mutate-diffids
Open

feature: Support mutating diffids#6
romoh wants to merge 1 commit intomainfrom
user/romoh/mutate-diffids

Conversation

@romoh
Copy link
Owner

@romoh romoh commented Jan 14, 2026

Summary

Add support for mutating diffids

Validation

Ran locally and validated different mutations generated.

Signed-off-by: Roaa Sakr <romoh@microsoft.com>
@romoh romoh requested a review from Copilot January 14, 2026 22:37
@romoh romoh changed the title feature: Allow mutation of diffids feature: Support mutating diffids Jan 14, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for mutating the diff_ids field in OCI image configurations to test edge cases in container runtimes. The field is changed from Vec<String> to Option<Vec<String>> to enable fuzzing scenarios where this field can be null or missing.

Changes:

  • Modified diff_ids field in RootFs struct to be optional, enabling null/omitted serialization
  • Added four new extreme mutations to test different diff_ids edge cases
  • Updated existing code to wrap diff_ids in Some()

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
crates/confuzzled_lib/src/oci.rs Changed diff_ids field from Vec<String> to Option<Vec<String>> with skip_serializing attribute, and updated minimal image initialization
crates/confuzzled_lib/src/mutations/mod.rs Registered four new diff_ids-related mutations in the extreme category
crates/confuzzled_lib/src/mutations/extreme.rs Implemented four new mutation structs for testing diff_ids edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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")]
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The documentation states 'serializes as null' but with skip_serializing_if = \"Option::is_none\", a None value will be omitted from serialization entirely, not serialized as null. The comment should clarify this behavior or the attribute should be changed to serialize as explicit null if that's the intended behavior.

Suggested change
#[serde(skip_serializing_if = "Option::is_none")]

Copilot uses AI. Check for mistakes.
}
}

/// Empty layers with null diff_ids
Copy link

Copilot AI Jan 14, 2026

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_if attribute 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'.

Copilot uses AI. Check for mistakes.
// Clear all layers from manifest
image.layers.clear();

// Set diff_ids to None (serializes as null or omitted)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

The comment says 'serializes as null or omitted' but should be more precise. With skip_serializing_if = \"Option::is_none\", it will be omitted, not serialized as null. Either update the comment to say 'omitted' or clarify the actual behavior intended.

Suggested change
// 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 uses AI. Check for mistakes.
Comment on lines +144 to +146
/// Null diff_ids with layers intact
///
/// Sets diff_ids to null while keeping the actual layers.
Copy link

Copilot AI Jan 14, 2026

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 uses AI. Check for mistakes.
}

fn apply(&self, mut image: Image, _rng: &mut StdRng) -> Result<Image> {
// Keep layers but null out diff_ids
Copy link

Copilot AI Jan 14, 2026

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.

Copilot uses AI. Check for mistakes.
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.

1 participant