Resolve import loop with ``use``
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- wasm
- Domain
- tooling
Research direction
Reproduce the composition using the WAC file and the four component WIT definitions, then inspect the output with wasm-tools component wit as described. Trace how use core-logic.{error-detail} creates the prototype:core/core-logic@0.1.0 import while composing core; done means the composed application no longer has the unintended import loop or the limitation is clearly documented.
Written by the indexing model from the issue text.
Description
wac-cli version 0.7.0
Components xml-converter and network-outgoing implement interfaces defined in the core package and use the record error-detail defined in the core-logic interface. wasm-tools shows that after building said components with the commands wasm-tools component wit xml-converter.wasm and wasm-tools component wit network-outgoing.wasm both import prototype:core/core-logic@0.1.0. However, the core component depends on the interfaces implemented by the xml-converter and network-outgoing components, which creates an import loop. While testing with WasmCloud and its runtime linking via wrpc, this didn't cause an issue, and everything worked fine. But trying to compose the components with WAC results in the resulting component importing prototype:core/core-logic@0.1.0. Can this be solved somehow?
core component:
package prototype:core@0.1.0;
interface core-logic {
enum error-code {
conversion-failed,
failed-to-get-product-list,
internal,
}
record error-detail {
code: error-code,
message: string,
}
get-product-list-csv: func(id: string, trace-id: string) -> result<list<u8>, error-detail>;
}
interface handler-outgoing {
use core-logic.{error-detail};
get-product-list: func(id: string, trace-id: string) -> result<list<u8>, error-detail>;
}
interface converter{
use core-logic.{error-detail};
convert: func(input: list<u8>, trace-id: string) -> result<list<u8>, error-detail>;
}
world core {
import converter;
import handler-outgoing;
export core-logic;
}
network-outgoing component:
package prototype:network-outgoing@0.1.0;
world network-outgoing {
import wasi:http/outgoing-handler@0.2.0;
export prototype:core/handler-outgoing@0.1.0;
}
xml-converter component:
package prototype:xml-converter@0.1.0;
world xml-converter {
export prototype:core/converter@0.1.0;
}
network-incoming component:
package prototype:network-incoming@0.1.0;
world network-incoming {
import prototype:core/core-logic@0.1.0;
export wasi:http/incoming-handler@0.2.0;
}
WAC file:
package prototype:app@0.1.0;
let network-outgoing = new prototype:network-outgoing {...};
let xml-converter = new prototype:xml-converter {...};
let core = new prototype:core {
converter: xml-converter.converter,
handler-outgoing: network-outgoing.handler-outgoing,
...
};
let network-incoming = new prototype:network-incoming {
core-logic: core.core-logic,
...
};
export network-incoming.incoming-handler;
- Dominant language
- Rust
- Stars
- 208
- Forks
- 41
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bytecodealliance/wac
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
bytecodealliance/wac#181 · 7 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
bytecodealliance/wac#170 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
bytecodealliance/wac#169 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
bytecodealliance/wac#165 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
bytecodealliance/wac#158 · 3 comments ·
All issues in bytecodealliance/wac
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug core
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW Openfuzz
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ClickHouse/ClickHouse#122114 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
linebender/vello_svg#90 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100