Skip to content

Comments

fix: preserve package metadata when unpacking webc files#6196

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/fix-webc-metadata-issue
Closed

fix: preserve package metadata when unpacking webc files#6196
Copilot wants to merge 7 commits intomainfrom
copilot/fix-webc-metadata-issue

Conversation

Copy link

Copilot AI commented Feb 13, 2026

Description

Package metadata (name, version, description) was being stripped from webc files during serialization, causing wasmer package unpack to 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.

Copilot AI and others added 2 commits February 13, 2026 09:47
Copilot AI changed the title [WIP] Fix unpacking of webc to include metadata fix: preserve package metadata when unpacking webc files Feb 13, 2026
Copilot AI requested a review from zebreus February 13, 2026 09:53
Copy link
Contributor

@zebreus zebreus left a comment

Choose a reason for hiding this comment

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

@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>
Copy link
Author

Copilot AI commented Feb 13, 2026

@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 s...

Completed all three requests in commit f32385f:

  1. Historical investigation: The metadata removal code was present from the start with no documented reason. Added comprehensive code comments explaining this history and the rationale for preserving metadata.

  2. Backward compatibility test: Added webc_without_metadata_still_works() test that verifies webcs without metadata can still be loaded and unpacked successfully. The test passes (43/43 tests passing).

  3. CLI name override: After investigation, there are currently no CLI flags to override package name/version/description in the wasmer package build command. The metadata comes directly from wasmer.toml, so the existing behavior is preserved - no changes needed here.

All tests pass and backward compatibility is maintained.

Copilot AI requested a review from zebreus February 13, 2026 10:19
@zebreus zebreus requested a review from Copilot February 13, 2026 11:03
Copy link
Contributor

@zebreus zebreus left a comment

Choose a reason for hiding this comment

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

Not sure why we did strip version, name, and description before. But this looks good to me otherwise.

Copy link
Contributor

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 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() and Package::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>
Copy link
Contributor

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

They only affect comments of a test

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zebreus zebreus marked this pull request as ready for review February 13, 2026 12:04
@zebreus zebreus requested a review from syrusakbary as a code owner February 13, 2026 12:04
@zebreus zebreus requested a review from Copilot February 13, 2026 12:04
@theduke
Copy link
Contributor

theduke commented Feb 13, 2026

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.
The package contents and therefore resulting hash is intentionally independent of name/version/owner metadata.

Copy link
Contributor

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

@zebreus
Copy link
Contributor

zebreus commented Feb 13, 2026

@theduke Is this just about reuploading packages or also caching for the contents compilation? What are scenarios in which this optimization is required?

Copy link
Member

@syrusakbary syrusakbary left a comment

Choose a reason for hiding this comment

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

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.

@marxin
Copy link
Contributor

marxin commented Feb 19, 2026

ping @theduke

@marxin
Copy link
Contributor

marxin commented Feb 19, 2026

Closed based on the discussion with @theduke.

@marxin marxin closed this Feb 19, 2026
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.

5 participants