Skip to content

docs: correct what _WIT_VERSION does, and pin it to the release it describes - #276

Merged
robcohen merged 1 commit into
mainfrom
docs/wit-version-comment
Aug 9, 2026
Merged

robcohen merged 1 commit into
mainfrom
docs/wit-version-comment

Conversation

@robcohen

@robcohen robcohen commented Aug 9, 2026

Copy link
Copy Markdown
Member

The note on _WIT_VERSION said a mismatch

makes get_export_index return None and every call fail

It doesn't, and this file was its own counter-example: _WIT_VERSION has been
"3.3.0" while the pinned v0.21.0 component exports @3.4.0, and it works —
version() returns 3.4.

Measured, not reasoned about

Against that component:

pin result
3.0.0, 3.3.0, 3.4.0, 3.5.0, 3.11.0 instantiates, version() = 3.4
2.4.0, 4.0.0 WasmtimeError

Matching is by major, in either direction; only a different major fails. And
it fails on the import side at instantiation —

component imports instance `rustledger:ledger/[email protected]`, but a match ...

— because _HOST names the instance the linker offers. Not on export lookup,
which is where the old note pointed.

Why this is worth more than tidiness

The comment made the version string look load-bearing for every bump, which sends
a reviewer to check the wrong thing. A minor bump doesn't require touching it.

What a bump can genuinely break is a new mandatory import, which no version
string reveals: WIT 3.1 → 3.2 added host.decrypt and made the component
un-instantiable until the linker grew the binding (#218). update-rustledger.yml
already holds any WIT change for human review — the question that review has to
answer is "what does the component import that _define_host_interface doesn't
define"
, answered with wasm-tools component wit, not by comparing this
constant.

Concretely: rustledger main is on WIT 3.11.0 against this repo's 3.4.0, which
looks alarming under the old comment. Both import only host, and host has the
same single decrypt function in both — so the gate will fire on that jump, but
the hazard it exists to catch isn't present.

Also

Sets the constant to 3.4.0, what the pinned release actually ships.
Behaviour-neutral per the table above; it removes the puzzle of why the two
disagree and matches what the update workflow would have written.

Component-engine tests: 108 passed. Full suite unchanged at 665 passed / 1
skipped (the two locale failures reproduce on pristine main — no compiled
.mo files when running from src/).

…scribes

The note said a mismatch "makes `get_export_index` return `None` and
every call fail". It does not, and the file itself was the
counter-example: `_WIT_VERSION` has been "3.3.0" while the pinned
v0.21.0 component exports `@3.4.0`, and it works — `version()` returns
3.4.

Measured against that component rather than reasoned about:

    pin 3.0.0 / 3.3.0 / 3.4.0 / 3.5.0 / 3.11.0  -> instantiates, version() = 3.4
    pin 2.4.0 / 4.0.0                           -> WasmtimeError

Matching is by MAJOR, in either direction; only a different major fails.
And it fails on the IMPORT side at instantiation ("component imports
instance `rustledger:ledger/[email protected]`, but a match ..."), because
`_HOST` names the instance the linker offers — not on export lookup,
which is what the old note pointed at.

Why this matters beyond tidiness: the comment made the version string
look load-bearing for every bump, which is the wrong thing to check. A
minor bump does not require touching it. What a bump can genuinely break
is a new MANDATORY IMPORT, which no version string reveals — WIT 3.1 ->
3.2 added `host.decrypt` and made the component un-instantiable until
the linker grew the binding (#218). `update-rustledger.yml` already
holds any WIT change for human review; the question that review has to
answer is "what does the component import that `_define_host_interface`
does not define", answered with `wasm-tools component wit`, not by
comparing this constant.

Also sets the constant to 3.4.0, which is what the pinned release
actually ships. Behavior-neutral by the table above; it removes the
puzzle of why the two disagree and matches what the update workflow
would have written.
@robcohen
robcohen merged commit e9a9376 into main Aug 9, 2026
31 checks passed
@robcohen
robcohen deleted the docs/wit-version-comment branch August 9, 2026 00:22
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