Skip to content

fix(wasix): don't inherit a dependency's entrypoint over the root's own commands - #6872

Open
Arshia001 wants to merge 2 commits into
mainfrom
run-1087-packages-without-entrypoint-default-to-dependency-commands
Open

fix(wasix): don't inherit a dependency's entrypoint over the root's own commands#6872
Arshia001 wants to merge 2 commits into
mainfrom
run-1087-packages-without-entrypoint-default-to-dependency-commands

Conversation

@Arshia001

@Arshia001 Arshia001 commented Aug 7, 2026

Copy link
Copy Markdown
Member

resolve_package walked the whole dependency graph looking for an entrypoint whenever the root package didn't declare one, so a dependency's entrypoint would win over the root package's own commands.

wasmer/anybuild declares no entrypoint and depends on wasmer/bash, which declares entrypoint = "bash" — so it ran bash instead of anybuild.

Only a command-less root may now inherit an entrypoint from a dependency. That also makes the existing "root package's only command" fallback reachable, which it previously wasn't whenever any dependency declared an entrypoint.

Behaviour by case:

root before after
no commands inherits from dependency unchanged
one command dependency's entrypoint its own command
2+ commands, no entrypoint dependency's entrypoint None, i.e. an error rather than silently running the wrong binary

Not a recent regression — the inheritance loop dates to the original resolver (2023). It surfaced when wasmer/bash added entrypoint = "bash" in 1.0.21.

Two regression tests added. Full wasmer-wasix lib suite passes (225).

Fixes #6870

🤖 Generated with Claude Code

…wn commands

`resolve_package` walked the whole dependency graph looking for an
entrypoint whenever the root package didn't declare one, so a dependency
that declares an entrypoint would win over the root package's own
commands. `wasmer/anybuild` depends on `wasmer/bash`, which declares
`entrypoint = "bash"`, so it ran bash instead of anybuild.

Only let a command-less root inherit an entrypoint from a dependency.
This also makes the existing "root package's only command" fallback
reachable, which it previously wasn't whenever any dependency declared
an entrypoint.

Fixes #6870

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 7, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes WASIX package entrypoint resolution so a dependency’s entrypoint can no longer override (or “hijack”) the root package’s own commands when the root has commands but does not explicitly declare an entrypoint, addressing the behavior reported in #6870.

Changes:

  • Gate dependency-entrypoint inheritance on the root package having zero commands.
  • Preserve the existing “root package’s only command” fallback by making it reachable again when the root has exactly one command.
  • Add regression tests covering (a) multi-command roots and (b) single-command roots against dependency entrypoints.

Comment on lines +800 to +804
// A package that ships commands of its own must resolve to one of them, so
// only a command-less root may inherit an entrypoint from a dependency.
// Otherwise a dependency like wasmer/bash, which declares an entrypoint,
// would hijack the root package's own commands.
let may_inherit_entrypoint = dependency_graph.root_info().commands.is_empty();
Comment on lines +2125 to +2131
// Ambiguous between "anybuild" and "shipit", but never "bash".
assert_ne!(
resolution.package.entrypoint.as_deref(),
Some("bash"),
"the entrypoint must not come from a dependency when the root has \
commands of its own",
);
Assert the exact `None` the 2+ command case is supposed to produce, so
the test also fails if the resolver starts guessing between the root's
own commands, and stop implying a root with commands always resolves to
one of them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Packages without entrypoint default to dependency commands

2 participants