Skip to content

test(hu): pin the WIT world to its contract - #315

Merged
YuanYuYuan merged 1 commit into
mainfrom
test/hu-wit-world-agreement
Aug 22, 2026
Merged

YuanYuYuan merged 1 commit into
mainfrom
test/hu-wit-world-agreement

Conversation

@YuanYuYuan

@YuanYuYuan YuanYuYuan commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

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 where build-hu-release.nu comes from.

What fails without this

Three places carry hu:plugin@0.1.0, and nothing reconciles them:

Location Role
crates/hiroz-union/wit/v0.1/hu-plugin.witpackage hu:plugin@0.1.0; the contract
crates/hiroz-union/src/plugin/install.rsHOST_WIT_WORLD what the host compares an index against
scripts/build-hu-release.nuconst WIT_WORLD what a published index advertises

Bump 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 that HOST_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

Direction Result
as committed 3 passed, 0 failed
HOST_WIT_WORLD changed to hu:plugin@9.9.9 FAILED — 2 passed, 1 failed
the script's WIT_WORLD changed to hu:plugin@0.2.0 FAILED — 2 passed, 1 failed

Each 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 to install.rs and 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.

@YuanYuYuan
YuanYuYuan force-pushed the feat/hu-release-pipeline branch from feb9a5c to d4f172d Compare August 21, 2026 08:18
@YuanYuYuan
YuanYuYuan force-pushed the test/hu-wit-world-agreement branch from 821c2dd to a9a8ad5 Compare August 21, 2026 08:18
@YuanYuYuan
YuanYuYuan force-pushed the feat/hu-release-pipeline branch from d4f172d to 099c423 Compare August 21, 2026 19:34
Base automatically changed from feat/hu-release-pipeline to main August 22, 2026 03:45
`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
YuanYuYuan force-pushed the test/hu-wit-world-agreement branch from a9a8ad5 to b2c55e9 Compare August 22, 2026 03:53
@YuanYuYuan
YuanYuYuan requested a balanced review from Copilot August 22, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@YuanYuYuan
YuanYuYuan merged commit 29d2688 into main Aug 22, 2026
33 checks passed
@YuanYuYuan
YuanYuYuan deleted the test/hu-wit-world-agreement branch August 22, 2026 05:48
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.

2 participants