compiler: a missing import is an error, not an empty string #136

Merged
will.anderson merged 1 commits from fix/missing-import-is-an-error into dev 2026-08-16 02:48:05 +00:00
Owner
import "../../NOPE/does_not_exist.el"

compiled cleanly — exit 0, empty stderr, and a program silently missing everything it imported.

resolve_imports called fs_read(src_path) and used the result unchecked. fs_read returns "" both for empty file and no such file, so a typo, a moved file, or a relative path resolved from the wrong working directory all produced a successful build of nothing.

It caused a real wrong conclusion during test-framework work: a bisection run from a subdirectory where ../../runtime/ didn't resolve produced eleven consecutive "successful" compiles that included no runtime at all, and the results were believed before anyone noticed.

Missing dependency, confident success — the same shape as a suite reporting pass for tests that never ran, and a benchmark reporting 0µs because the optimiser deleted the loop.

fs_exists separates the two cases, so a legitimately empty file still resolves to "". A nonexistent path prints the resolved path and exits 1.

Verified: bad import exits 1 (was 0); elc-cli.el still compiles with the self-hosting fixpoint byte-identical; neuron's full soul amalgam regeneration exits 0 in 405 ms with byte-identical output (1,270,212 bytes).

```el import "../../NOPE/does_not_exist.el" ``` compiled **cleanly** — exit 0, empty stderr, and a program silently missing everything it imported. `resolve_imports` called `fs_read(src_path)` and used the result unchecked. `fs_read` returns `""` both for *empty file* and *no such file*, so a typo, a moved file, or a relative path resolved from the wrong working directory all produced a successful build of nothing. **It caused a real wrong conclusion during test-framework work:** a bisection run from a subdirectory where `../../runtime/` didn't resolve produced **eleven consecutive "successful" compiles that included no runtime at all**, and the results were believed before anyone noticed. Missing dependency, confident success — the same shape as a suite reporting pass for tests that never ran, and a benchmark reporting 0µs because the optimiser deleted the loop. `fs_exists` separates the two cases, so a legitimately empty file still resolves to `""`. A nonexistent path prints the resolved path and exits 1. **Verified:** bad import exits 1 (was 0); `elc-cli.el` still compiles with the self-hosting fixpoint byte-identical; neuron's full soul amalgam regeneration exits 0 in 405 ms with byte-identical output (1,270,212 bytes).
will.anderson added 1 commit 2026-08-16 02:47:41 +00:00
compiler: a missing import is an error, not an empty string
El SDK CI - dev / build-and-test (pull_request) Failing after 11m23s
906c664a65
import "../../NOPE/does_not_exist.el"

compiled CLEANLY — exit 0, empty stderr, and a program silently missing
everything it imported.

resolve_imports did `fs_read(src_path)` and used the result without checking.
fs_read returns "" both for "file is empty" and "file does not exist", so a
typo, a moved file, or a relative path resolved from the wrong working
directory all produced a successful build of nothing.

It caused a real wrong conclusion during test-framework work: a bisection run
from a subdirectory where ../../runtime/ did not resolve produced ELEVEN
consecutive "successful" compiles that had included no runtime at all, and the
results were believed before anyone noticed.

Missing dependency, confident success — the same shape as a test suite
reporting pass for tests that never ran, and as a benchmark reporting 0us
because the optimiser deleted the loop.

fs_exists separates the two cases, so a legitimately empty file still resolves
to "" and is fine. A path that does not exist now prints the resolved path and
exits 1, which is what build scripts check.

Verified:
  - bad import: exit 1 (was 0), message names the resolved path
  - elc-cli.el still compiles, self-hosting fixpoint byte-identical
  - neuron's full soul amalgam regeneration: exit 0, 405ms, output
    byte-identical at 1,270,212 bytes
will.anderson merged commit dbb06f6ee4 into dev 2026-08-16 02:48:05 +00:00
Sign in to join this conversation.