Skip to content

Unify structured source-read failures across checking and AST output #985

Closed

Description

@LunaStev

Problem

Checking hides the underlying filesystem/encoding error, while AST-only output bypasses JSON diagnostics entirely for the same unreadable input. Consumers therefore cannot reliably classify or parse source-read failures.

Reproduction

Audited canonical master 42b65e426ad45bf896623b5bce814312b694a0c7 on Linux amd64 with Rust 1.89 and LLVM 21.1.8. Reproductions use the checkout-built target/debug/wavec and matching checkout std. The local head d2f58962 has an identical file tree to that canonical merge. Commands below assume WAVEC names that binary.

python3 - <<'REPRO'
from pathlib import Path
Path('invalid.wave').write_bytes(b'\xff')
REPRO
"$WAVEC" --error-format=json check invalid.wave
"$WAVEC" --error-format=json build invalid.wave --emit=ast --out-dir out

Executed: check emits JSON saying only failed to read file, with help about existence/permissions even though the file exists but is not UTF-8. AST output emits a plain cannot read ... stream did not contain valid UTF-8 line. A nonexistent .wave file and a directory named directory.wave receive the same generic check explanation.

Scope

Route source-reading failures through a consistent structured diagnostic with input path and underlying I/O or encoding cause, including the AST input-protection prepass and other current source read entry points. Keep current exit categories and output/input preservation rules.

Starting points: src/runner.rs.

Completion criteria

  • Human diagnostics distinguish missing files, directories, encoding failures and permissions where available.
  • JSON mode emits only parseable structured diagnostic records for every affected entry path.
  • Check, AST-only and ordinary build modes have negative tests and retain existing files on failure.

Related: #404; #901's AST input protection must remain intact.

Activity

  1. self-assigned this
    on Oct 21, 2026
  2. added
    bug
    on Oct 21, 2026
  3. added a commit that references this issue on Oct 22, 2026
    aef39a5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions