test(hu): pin the WIT world to its contract - #315
Merged
Merged
Conversation
YuanYuYuan
force-pushed
the
feat/hu-release-pipeline
branch
from
August 21, 2026 08:18
feb9a5c to
d4f172d
Compare
YuanYuYuan
force-pushed
the
test/hu-wit-world-agreement
branch
from
August 21, 2026 08:18
821c2dd to
a9a8ad5
Compare
YuanYuYuan
force-pushed
the
feat/hu-release-pipeline
branch
from
August 21, 2026 19:34
d4f172d to
099c423
Compare
`hu:plugin@0.1.0` is written three times: the .wit package declaration, HOST_WIT_WORLD, and build-hu-release.nu. Nothing reconciles them. Bump the .wit - the actual contract - and the other two keep the old string. The host then accepts an index advertising a world it no longer hosts, and wasmtime fails later with the link error HOST_WIT_WORLD exists to prevent. The guard is decorative at the one moment it matters. The existing refusal tests cannot see this. They hand-write a fixture world, so they prove the comparison works against a literal, never that the literal still describes the contract. Parses the world out of the .wit and the script via include_str!, and asserts all three agree. A third test asserts both parsers found something world-shaped, so a silent None cannot make the other two compare empty strings and pass.
YuanYuYuan
force-pushed
the
test/hu-wit-world-agreement
branch
from
August 22, 2026 03:53
a9a8ad5 to
b2c55e9
Compare
There was a problem hiding this comment.
Pull request overview
Adds regression tests preventing drift between the WIT contract, host constant, and release index metadata.
Changes:
- Parses the WIT package and packaging-script constants.
- Verifies both match
HOST_WIT_WORLD. - Validates parsed identifiers are nonempty and correctly prefixed.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Closes G3 of #309 — "no test covers a version skew between host and plugins". #309 lists four gaps between a published release and a real user; this is the third.
This targets
main. #312 merged the release-pipeline slice, which is wherebuild-hu-release.nucomes from.What fails without this
Three places carry
hu:plugin@0.1.0, and nothing reconciles them:crates/hiroz-union/wit/v0.1/hu-plugin.wit—package hu:plugin@0.1.0;crates/hiroz-union/src/plugin/install.rs—HOST_WIT_WORLDscripts/build-hu-release.nu—const WIT_WORLDBump the
.wit— the actual contract — and the other two keep the old string. The host then accepts an index that advertises a world it no longer hosts. wasmtime fails later at instantiation, with the link error thatHOST_WIT_WORLD's own doc comment says the guard prevents. The guard is decorative at the one moment it is load-bearing.The existing refusal tests cannot see this. They hand-write a fixture world, so they prove the comparison works against a literal, never that the literal still describes the contract.
Evidence in both directions
HOST_WIT_WORLDchanged tohu:plugin@9.9.9WIT_WORLDchanged tohu:plugin@0.2.0Each mutation fails exactly the one relevant test, so the detector is specific rather than blanket-red. The script direction is checked separately because a test catching only host-side drift would miss the case that silently publishes wrong indexes.
Those three runs were measured before this branch was rebased onto
main. The rebase changed no test: this branch is one commit, and it adds 80 lines toinstall.rsand touches nothing else.A third test asserts that both parsers found something world-shaped. Without it, a parser that returns nothing makes the other two compare empty strings. They would then pass while checking nothing.
Breaking Changes
None. Tests only.