Skip to content

Fix WIT extractor emitting wrong interface when duplicated name - #3716

Merged
itowlson merged 1 commit into
spinframework:mainfrom
itowlson:extract-deps-fix-dep-imports-and-exports-same-named-itf
Sep 15, 2026
Merged

itowlson merged 1 commit into
spinframework:mainfrom
itowlson:extract-deps-fix-dep-imports-and-exports-same-named-itf

Conversation

@itowlson

Copy link
Copy Markdown
Contributor

Fixes #3715.

When a dep imports and exports distinct interfaces with the same unqualified name (but from different packages), the extractor could pick an imported one. In the original bug report, for example, a component exported its own secrets store interface, but imported a WASI config store.

This PR limits the extractor to considering only exported interfaces (yes, it calls them imports, but that means after the dep has been importised). I am still not sure if there is a different edge case where a dep exports two interfaces with the same unqualified name - @fibonacci1729 I'd love your advice here as my brain is all muddled about it, although we can probably punt that to a separate PR.

@mileszim I have a unit test which I believe replicates your scenario, but if you have bandwidth to test this against your real code, that would help with validation. Thanks for the detailed bug report (and for taking the time to port it from the docs repo)!

@itowlson
itowlson force-pushed the extract-deps-fix-dep-imports-and-exports-same-named-itf branch from 64da148 to dc5d818 Compare September 15, 2026 01:23
@mileszim

Copy link
Copy Markdown

@itowlson looks like its working! amazing!

@dicej dicej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't looked at this code before, so I don't have full context for it, but the change looks reasonable to me.

Comment thread crates/dependency-wit/src/lib.rs Outdated
Comment thread crates/dependency-wit/src/lib.rs Outdated
Signed-off-by: itowlson <ivan.towlson@fermyon.com>
@itowlson
itowlson force-pushed the extract-deps-fix-dep-imports-and-exports-same-named-itf branch from dc5d818 to 68467f7 Compare September 15, 2026 21:16
@itowlson
itowlson enabled auto-merge September 15, 2026 21:16
@itowlson
itowlson merged commit c6634ad into spinframework:main Sep 15, 2026
17 checks passed
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.

spin build: dependency WIT picks the wrong interface when a dependency's own imports share the interface name

3 participants