Add Component host functions and resources - #291
Draft
JDLondon7 wants to merge 6 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Failing test
upstream/maincannot define component host functions or host resources throughComponentLinker. The added tests exercise callback success/error/panic propagation, exclusive linker namespace borrowing, resource value conversion, host data recovery, and deterministic drop behavior.General correction
This is a stacked draft on top of the component call/runtime-value draft because host callbacks consume and produce the same
ComponentValrepresentation. The host/resource-specific review surface is the final two commits. It tracks #280 and deliberately leavesComponentValTypewrappers to the existing type series, including #283.Validation
With the v47.0.0 release artifacts restored as ignored build inputs:
All commands pass on Windows amd64; lint reports
0 issuesfor the stacked slice. The untagged commands specifically guard the build-tag boundary between the always-built linker lifecycle and the host-only API.Compatibility and security impact
The API is additive and synchronous. Callback state stays behind cgo handles, panics are converted into Wasmtime errors, linker borrowing is enforced in Go, and host resource ownership has explicit consume/drop paths.
Documentation
Public types and methods include Go documentation. Tests cover lifecycle and failure paths.
Downstream removal condition
Downstream users can remove equivalent local bindings after an upstream release contains these APIs and their callback, linker lifecycle, and resource ownership fixtures pass unchanged.
This change contains no TradePit product concepts or private data.