Stream: git-wasmtime

Topic: wasmtime / issue #15141 Expose precompile compatibility a...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 01:51):

wangkun1210 opened issue #15141:

Feature

An Engine API that returns the precompile-compatibility contract as a
fixed-width value — something a build machine can write into artifact metadata
and a loader can compare before calling unsafe Module::deserialize.
To be clear about what this is not: I am not asking for a new loading
mechanism. I'm building a loader for applications delivered as several
independently-fetched artifacts, where each entry point fetches only the
subset it imports and instantiates them in dependency order. Every piece of
that already exists and works:

Benefit

Anyone who precompiles off the build machine — which is the normal case for
anything larger than a single host, and the whole premise of shipping .cwasm
to a fleet — currently has to invent this value. A documented one turns two
things into checked facts instead of remembered conventions:

  1. The safety precondition becomes verifiable. Module::deserialize is
    unsafe because the artifact is only valid for a compatible Config,
    wasmtime version, and target. With a fixed-width fingerprint, a loader can
    return a Result on mismatch — "this artifact was built for a different
    engine" — instead of relying on the caller having hashed the right things.
    That is the difference between unsafe being justified and unsafe being
    copy-pasted.

  2. Build pipelines can key on it. Artifact directories, CI caches, and OCI
    layer annotations can be named by the real contract rather than by a
    hand-rolled approximation of it.
    The failure mode being prevented is quiet and expensive: a fingerprint that
    drifts from Config produces an error only on the machines that actually run
    the mismatched artifact.
    Secondarily, a short example under examples/ would document the
    split-artifact shape itself. I worked it out from component_type(),
    Linker::instance naming rules, and the deserialize safety comments; as far
    as I could tell it isn't written down anywhere, and I'd rather have pointed at
    a 100-line example.

Implementation

For the fingerprint, two levels of effort:

  1. core modules — AOT-compile each with precompile_module, write to
    <fingerprint>/<sha256 of input>, at load time deserialize only the modules
    in one entry's closure, register each in a shared Linker under its
    provider's namespace, instantiate in dependency order;

  2. components — the same, with each unit published as its own Component,
    wired through component::Linker, and the closure checked with
    component_type().imports() against each provider's exports() before
    instantiation, so a bad closure fails at validation rather than at link.
    I'm happy to send either as a PR if the shape is right; I'd rather not guess at
    the naming or the docs placement.

Alternatives

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 02:19):

pchickey closed issue #15141:

Feature

An Engine API that returns the precompile-compatibility contract as a
fixed-width value — something a build machine can write into artifact metadata
and a loader can compare before calling unsafe Module::deserialize.
To be clear about what this is not: I am not asking for a new loading
mechanism. I'm building a loader for applications delivered as several
independently-fetched artifacts, where each entry point fetches only the
subset it imports and instantiates them in dependency order. Every piece of
that already exists and works:

Benefit

Anyone who precompiles off the build machine — which is the normal case for
anything larger than a single host, and the whole premise of shipping .cwasm
to a fleet — currently has to invent this value. A documented one turns two
things into checked facts instead of remembered conventions:

  1. The safety precondition becomes verifiable. Module::deserialize is
    unsafe because the artifact is only valid for a compatible Config,
    wasmtime version, and target. With a fixed-width fingerprint, a loader can
    return a Result on mismatch — "this artifact was built for a different
    engine" — instead of relying on the caller having hashed the right things.
    That is the difference between unsafe being justified and unsafe being
    copy-pasted.

  2. Build pipelines can key on it. Artifact directories, CI caches, and OCI
    layer annotations can be named by the real contract rather than by a
    hand-rolled approximation of it.
    The failure mode being prevented is quiet and expensive: a fingerprint that
    drifts from Config produces an error only on the machines that actually run
    the mismatched artifact.
    Secondarily, a short example under examples/ would document the
    split-artifact shape itself. I worked it out from component_type(),
    Linker::instance naming rules, and the deserialize safety comments; as far
    as I could tell it isn't written down anywhere, and I'd rather have pointed at
    a 100-line example.

Implementation

For the fingerprint, two levels of effort:

  1. core modules — AOT-compile each with precompile_module, write to
    <fingerprint>/<sha256 of input>, at load time deserialize only the modules
    in one entry's closure, register each in a shared Linker under its
    provider's namespace, instantiate in dependency order;

  2. components — the same, with each unit published as its own Component,
    wired through component::Linker, and the closure checked with
    component_type().imports() against each provider's exports() before
    instantiation, so a bad closure fails at validation rather than at link.
    I'm happy to send either as a PR if the shape is right; I'd rather not guess at
    the naming or the docs placement.

Alternatives

view this post on Zulip Wasmtime GitHub notifications bot (Nov 04 2026 at 02:19):

pchickey commented on issue #15141:

This issue doesn't appear to comply with our policy on tool-generated content, and requires additional justification for why it is valuable enough to the project for us to review it. Please see our developer policy on AI-generated contributions: https://github.com/bytecodealliance/governance/blob/main/AI_TOOL_POLICY.md

We are happy to see the use of AI tools for translating to english for non-native-speakers, however, please include your human-written native language text before translation in a <details> in order to demonstrate compliance with the rest of our policy.


Last updated: Nov 19 2026 at 20:05 UTC