fix: preserve package metadata when unpacking webc files#6196
fix: preserve package metadata when unpacking webc files#6196
Conversation
Co-authored-by: zebreus <1557253+zebreus@users.noreply.github.com>
zebreus
left a comment
There was a problem hiding this comment.
@copilot Figure out why we removed name, version, and description explicitly before. Add a test that webcs without that information still work. Make sure that overwriting things like name on the cli still works as it did before.
…story Co-authored-by: zebreus <1557253+zebreus@users.noreply.github.com>
Completed all three requests in commit f32385f:
All tests pass and backward compatibility is maintained. |
zebreus
left a comment
There was a problem hiding this comment.
Not sure why we did strip version, name, and description before. But this looks good to me otherwise.
There was a problem hiding this comment.
Pull request overview
This pull request fixes a bug where package metadata (name, version, description) was being stripped during webc serialization, causing wasmer package unpack to lose this information. The fix removes the unnecessary metadata stripping code and updates tests and documentation accordingly.
Changes:
- Removed metadata stripping logic from
Package::load()andPackage::from_in_memory()methods - Updated test assertions to expect preserved metadata in serialized packages
- Added backward compatibility test to verify webcs without metadata can still be unpacked
- Updated CLI documentation to reflect metadata preservation behavior
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lib/package/src/package/package.rs | Removed metadata stripping code in two serialization methods, cleaned up unused import, updated test assertions, and added backward compatibility test |
| lib/package/src/convert/webc_to_package.rs | Updated test to verify metadata preservation in round-trip conversion |
| lib/cli/src/commands/package/unpack.rs | Updated documentation to reflect metadata preservation instead of noting lossy conversion |
| lib/package/src/package/snapshots/*.snap | Updated snapshot files to reflect preserved metadata in test expectations |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
They only affect comments of a test Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Nooo, the metadata stripping is intentional. The purpose is to avoid having to re-upload the same package again if just name or version changes. |
|
@theduke Is this just about reuploading packages or also caching for the contents compilation? What are scenarios in which this optimization is required? |
syrusakbary
left a comment
There was a problem hiding this comment.
This PR cant' move forward. We are stripping this values very intentionally.
Mainly, because you can transfer a package and so on if you do this. Also, because changing the name of a package enforces republishing.
The webc's should have no concept of it's own package name, that's the responsibility of the registry.
|
ping @theduke |
|
Closed based on the discussion with @theduke. |
Description
Package metadata (name, version, description) was being stripped from webc files during serialization, causing
wasmer package unpackto lose this information. The stripping logic served no purpose and prevented round-trip preservation of package manifests.This PR addresses the issue by removing the metadata stripping code and adds comprehensive documentation explaining the historical context. Backward compatibility with existing webc files is fully maintained.
This is helps to make building webc packages in CI easier, see #6197 for more details.