Skip to content
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

wip(fix): import mapping resource overlap #557

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vados-cosmonic
Copy link
Contributor

@vados-cosmonic vados-cosmonic commented Jan 29, 2025

This commit attempts to fix the case of an import map that perfectly overlaps an existing component resource.

When a resource that exists in a component is overriden with an import map, the interface can change arbitrarily.


This handle failure seems to actually be much deeper... Where I've landed is that resources are broken when import mapped over.

I've been able to figure out that the import map'd resource that overlaps with the local one is being interpreted as a host & imported & owned resource.

They basically are being detected as owned when they should not be -- while it is possible to have a ResourceData::Host that is imported and owned, in this case the resource is actually coming from the import map (it's not the same resource as the component created/is in the WIT).

I can't tell if the right move here is to:

  • Disable host-mapping over resources that are defined by the component in question
  • Modify bindgen to figure out that import-mapped things (which are missing/don't construct properly) and use them differently somehow
  • make changes to componentize.js to maybe avoid producing lowering code (???) that may be causing the failures

I'm thinking it might be a componentize problem because the function in the WASM has no idea about the import mapping above, and is probably trying to lower using the definitions in the component (that don't match the import map).

The first issue was attempting to remove the resource that wasn't actually successfully created which I found a way to work around (that maybe makes sense), but I'm finding that while you can create the resource, you can't consume it (i.e. from consumeBar) inside the component.

This commit attempts to fix the case of an import map that perfectly
overlaps an existing component resource.

When a resource that exists in a component is overriden with an import
map, the interface can change arbitrarily.

Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
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