Skip to content

Make std recovery guidance account for an invalid bundled library #956

Closed

Description

@LunaStev

Problem

When an incompatible standard library beside the executable is selected, E1002 recommends wavec update std as a recovery option. That command only updates the legacy per-user tree; it cannot repair or replace the selected bundled tree. Even an already valid legacy tree remains shadowed, so following this advice leaves the same error.

The selection order and refusal to fall back from an invalid bundle are intentional. The defect is the recovery guidance, not that precedence.

Starting points: compatibility-error help, installation destination, and bundled selection policy.

Reproduction

Executed at canonical master d59bdab376bdc04edacdc8029b256cb8d55b5adf on Linux amd64 with the checkout-built compiler, Rust 1.89.0 and LLVM 21.1.8. The following uses a disposable home and package; it does not alter an actual installation or perform a network update.

Run this Python from the repository root:

import json
import os
from pathlib import Path
import shutil
import subprocess
import tempfile

root = Path(tempfile.mkdtemp(prefix="wave-std-recovery-"))
package, home, work = (root / name for name in ("package", "home", "work"))
for directory in (package, home, work):
    directory.mkdir()
compiler = package / "wavec"
shutil.copy2("target/debug/wavec", compiler)
bundle = package / "std"
bundle.mkdir()
(bundle / "manifest.json").write_text(json.dumps({
    "name": "std", "compatibility_revision": 999999,
}))
legacy = home / ".wave/lib/wave/std"
legacy.mkdir(parents=True)
shutil.copy2("std/manifest.json", legacy / "manifest.json")
(legacy / "probe.wave").write_text("pub const VALUE: i32 = 7;\n")
(work / "main.wave").write_text(
    'import("std::probe")::{VALUE};\n'
    'fun main() -> i32 {\n    return VALUE;\n}\n'
)
env = dict(os.environ, HOME=str(home), USERPROFILE=str(home), NO_COLOR="1")
for extra in ([], ["--std-root", str(legacy)]):
    result = subprocess.run([
        str(compiler), "check", "main.wave",
        "--target=x86_64-unknown-linux-gnu", "--error-format=json", *extra,
    ], cwd=work, env=env, capture_output=True, text=True)
    print(result.returncode, result.stderr)

The default invocation fails with E1002 and this help:

select a matching std with `--std-root <path>`, or update the installed std with `wavec update std`

The explicit valid legacy root succeeds. The legacy tree is already compatible before the first run. Source inspection confirms both install/update destinations are exclusively the legacy tree, so updating it cannot change which invalid bundle is selected. No real update was executed for this audit.

Scope

Make recovery guidance accurately describe how to select or repair the selected std. Explain the legacy-only effect of install std/update std where relevant, and direct bundled-root failures toward a matching explicit root or repairing the compiler package. Keep the existing precedence, compatibility checks, and invalid-bundle rejection unchanged.

Related #928/#932 added bundled discovery; that implementation is already merged. This issue is the separate ineffective recovery recommendation on its intentional failure path. It does not request a release, installer-channel change, dependency update or automatic fallback.

Difficulty: easy; suitable for a first contribution using the existing std discovery and JSON diagnostic tests.

Completion criteria

  • Invalid bundled-root diagnostics do not imply that a legacy-only update repairs that bundle.
  • Default, explicit and legacy-root errors retain actionable guidance in human and JSON modes.
  • Cover an invalid bundle with an already valid legacy tree and verify explicit selection succeeds.
  • Preserve selected-root validation, no-silent-fallback behavior and std-free programs.

Activity

  1. added
    bug
    good first issue
    on Oct 18, 2026
  2. added a commit that references this issue on Oct 21, 2026
    42b65e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions