Skip to content

Commit 9315077

Browse files
committed
Add beta readiness hardening: multi-error CLI diagnostics, sanitizer and warning-clean CI, and beta/ABI/security docs.
Fix test_runner ion-build path resolution on Windows and fail harness PARTIAL mismatches instead of counting them as passes.
1 parent 2b2e231 commit 9315077

18 files changed

Lines changed: 308 additions & 23 deletions

File tree

.cursor/skills/adding-ion-features/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ Touch this for imports, multi-file mode, or qualified names - not only when edit
7070

7171
### Type checker (`src/tc/`)
7272

73-
See `mod.rs`, `ownership.rs`, `builtins.rs`, `types.rs`. LSP uses `check_program_collecting` for multiple diagnostics; CLI uses `check_program` (first error only).
73+
See `mod.rs`, `ownership.rs`, `builtins.rs`, `types.rs`. LSP and CLI use `check_program_collecting` for multiple diagnostics via `tc::format_type_errors`.
7474

75-
Critical checks to preserve. Patterns below match **CLI stderr** (`Type check error: UseAfterMove { ... }` via `{:?}`). The LSP formats the same errors differently (e.g. "Use after move: x") - see `ion-lsp-vscode` skill; do not use CLI grep patterns to validate LSP diagnostics.
75+
Critical checks to preserve. Patterns below match **CLI stderr** (e.g. `UseAfterMove` appears in `Type check failed with N error(s):` output). The LSP formats the same errors differently (e.g. "Use after move: x") - see `ion-lsp-vscode` skill; do not use CLI grep patterns to validate LSP diagnostics.
7676

7777
| Check | CLI stderr pattern |
7878
|-------|----------------|

.cursor/skills/ion-integration-tests/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Environment overrides:
5454
```bash
5555
COMPILER=../target/debug/ion-compiler ION_BUILD=../target/debug/ion-build CC=clang ./test_runner.sh
5656
RUNTIME_OBJ=/tmp/ion_runtime.o ./test_runner.sh
57+
CFLAGS="-Wall -Wextra -Werror" RUNTIME_OBJ=.ion_test_runtime_werror.o ./test_runner.sh
58+
CFLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address,undefined" ./test_runner.sh
5759
```
5860

5961
**Harness link step:** On startup, `test_runner.sh` precompiles `runtime/ion_runtime.c` once to `RUNTIME_OBJ` (default `.ion_test_runtime.o`) and links that object for each `run` test and `test_multifile`. This path uses `ion-compiler` and `gcc` directly, not `ion-build`. Example programs under `examples/` use `ion-build` per README.
@@ -132,7 +134,7 @@ The harness greps **compiler CLI stderr** for the pattern (not LSP diagnostic te
132134

133135
### `test_error` PARTIAL pass trap
134136

135-
If compilation fails but the grep pattern does **not** match, the harness prints **PARTIAL** and still increments `pass_count`. A wrong pattern looks like a pass - always verify the pattern against actual CLI output and confirm the harness prints **PASS**, not PARTIAL.
137+
If compilation fails but the grep pattern does **not** match, the harness prints **PARTIAL** and increments `fail_count`. A wrong pattern is a harness failure - always verify the pattern against actual CLI output and confirm the harness prints **PASS**, not PARTIAL.
136138

137139
## Test file conventions
138140

.cursor/skills/ion-lang/SKILL.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ Ion is a move-only, no-GC systems language transpiled to C. This skill orients y
1818
| Resource | Purpose |
1919
|----------|---------|
2020
| [ION_SPEC.md](../../../ION_SPEC.md) | Authoritative language semantics and grammar |
21+
| [docs/BETA.md](../../../docs/BETA.md) | Beta subset, compatibility policy, platform support |
22+
| [docs/ABI.md](../../../docs/ABI.md) | Runtime ABI notes for generated C and stdlib types |
2123
| [README.md](../../../README.md) | Build, run, project structure |
2224
| [CONTRIBUTING.md](../../../CONTRIBUTING.md) | Build, test, lint, and PR expectations |
2325
| [CHANGELOG.md](../../../CHANGELOG.md) | Release notes by month |
26+
| [SECURITY.md](../../../SECURITY.md) | Security reporting scope and policy |
2427
| [tests/README.md](../../../tests/README.md) | Integration test catalog |
2528

2629
**Compiler pipeline** (see [references/compiler-pipeline.md](references/compiler-pipeline.md)):

.cursor/skills/ion-lang/references/compiler-pipeline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
- `Send` checking for channels and `spawn`
4747
- Module visibility (`pub`), generics, method resolution
4848
- Errors via `TypeCheckError` enum
49-
- CLI: `check_program` returns first error; LSP: `check_program_collecting` gathers multiple independent errors
49+
- CLI and LSP: `check_program_collecting` gathers multiple independent errors; CLI prints them via `tc::format_type_errors`
5050

5151
### 6. IR (`src/ir/mod.rs`)
5252

.cursor/skills/ion-lsp-vscode/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Known limitations: built-in methods have signature hover but no go-to-definition
7777

7878
### CLI vs LSP error text
7979

80-
The CLI prints `Type check error: UseAfterMove { ... }` (`{:?}` on `TypeCheckError`) and stops at the first error. The LSP uses `check_program_collecting` and may show several type-check diagnostics in one publish (e.g. one per function). LSP formats errors as human-readable strings (e.g. "Use after move: x"). Do not use CLI grep patterns from `ion-integration-tests` to validate LSP diagnostics.
80+
The CLI and `ion-build` print `Type check failed with N error(s):` followed by numbered lines from `tc::format_type_errors`. The LSP uses `check_program_collecting` and may show several type-check diagnostics in one publish (e.g. one per function). LSP formats errors as human-readable strings (e.g. "Use after move: x"). Do not use CLI grep patterns from `ion-integration-tests` to validate LSP diagnostics.
8181

8282
## Extension files
8383

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,48 @@ jobs:
3535
ION_BUILD: ${{ github.workspace }}/target/release/ion-build
3636
run: cd tests && bash test_runner.sh
3737

38+
- name: Generated C sanitizer smoke (Linux)
39+
shell: bash
40+
env:
41+
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
42+
CC: gcc
43+
CFLAGS: -fsanitize=address,undefined -fno-omit-frame-pointer
44+
LDFLAGS: -fsanitize=address,undefined
45+
ASAN_OPTIONS: detect_leaks=0
46+
UBSAN_OPTIONS: halt_on_error=1
47+
run: |
48+
cd tests
49+
"$CC" $CFLAGS -c ../runtime/ion_runtime.c -I. -I.. -I../runtime -o .ion_test_runtime_san.o
50+
while IFS=' ' read -r test expected; do
51+
"$COMPILER" "$test.ion" >/dev/null
52+
"$CC" $CFLAGS "$test.c" .ion_test_runtime_san.o -I. -I.. -I../runtime -lpthread $LDFLAGS -o "$test"
53+
set +e
54+
"./$test" >/dev/null
55+
status=$?
56+
set -e
57+
if [ "$status" -ne "$expected" ]; then
58+
echo "$test: expected exit $expected, got $status"
59+
exit 1
60+
fi
61+
rm -f "$test.c" "$test"
62+
done <<'EOF'
63+
test_basic 42
64+
test_vec_push_pop 0
65+
test_string_push_byte 79
66+
test_spawn_channel 0
67+
test_array_to_slice_coercion 10
68+
EOF
69+
70+
- name: Generated C warning-clean smoke (Linux)
71+
shell: bash
72+
env:
73+
COMPILER: ${{ github.workspace }}/target/release/ion-compiler
74+
ION_BUILD: ${{ github.workspace }}/target/release/ion-build
75+
CC: gcc
76+
CFLAGS: -Wall -Wextra -Werror
77+
RUNTIME_OBJ: .ion_test_runtime_werror.o
78+
run: cd tests && bash test_runner.sh
79+
3880
integration:
3981
permissions:
4082
contents: read

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 2026-06
44

5+
- **Readiness hardening**: beta compatibility and runtime ABI documents, a lightweight security policy, CLI/`ion-build` multi-error type diagnostics, sanitizer and generated-C warning-clean CI smoke jobs, and `CFLAGS`/`LDFLAGS` support in the integration harness.
56
- **Language**: `for` iteration, `match` guards, `else if`, `break`/`continue`, `loop {}`, `+=`, hex/bin literals, function types `fn(T) -> R`, tuple literals and destructuring. Capture-free fn literals (`fn(T) -> R` lowered to static C function pointers; `ClosureCapture` for outer bindings).
67
- **Stdlib & runtime**: `fmt.ion`, `Result<T, E>`, `fs.read_to_string`, `String::push_byte`.
78
- **Compiler**: scope-drop codegen, `pthread` spawn, slice bounds checks, array-to-slice coercion, struct/enum field drops, `String` equality, module function name mangling, lasting-borrow rules (ION_SPEC 5.3), field-path borrow exclusivity, move/copy tracking fixes, generic monomorphization, generated C file banner (repo-relative source labels via `portable_source_label`, GNU C note, merged stdlib note, multi-file provenance, comment-safe path escaping).

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cargo install --path . --bin ion-compiler --bin ion-build
2020

2121
`ion-lsp` is built with the release command above; point the editor extension at `target/release/ion-lsp` (see README IDE Support).
2222

23-
CI (`.github/workflows/ci.yml`) builds all three binaries on Linux; the Windows job builds `ion-compiler` and `ion-build` only. Build `ion-lsp` locally for IDE work.
23+
CI (`.github/workflows/ci.yml`) builds all three binaries on Linux, runs integration tests, ASan/UBSan smoke on generated C, and a `-Wall -Wextra -Werror` harness pass on Linux. The Windows job builds `ion-compiler` and `ion-build` only. Build `ion-lsp` locally for IDE work.
2424

2525
## Test
2626

ION_SPEC.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,12 +1237,17 @@ The `ion-lsp` binary and VS Code/Cursor extension provide:
12371237

12381238
Built-in methods (`Vec::push`, `String::len`, etc.) show signature hover but have no source location for go-to-definition.
12391239

1240-
The CLI `ion-compiler` still reports the first type-check error only. The LSP uses `TypeChecker::check_program_collecting` to gather multiple diagnostics in one `publish_diagnostics` call. Import failures are reported per `import` statement via `Compiler::load_imports`.
1240+
The CLI `ion-compiler`, `ion-build`, and the LSP use `TypeChecker::check_program_collecting` to gather multiple independent type diagnostics. Import failures are reported per `import` statement via `Compiler::load_imports`.
12411241

12421242
Build with `cargo build --release --bin ion-lsp`. Rebuild after compiler or LSP changes; reload the editor window so `ion.lspPath` picks up the new binary. Set `ion.lspPath` in editor settings to the executable path.
12431243

12441244
#### 10.3 Known limitations
12451245

1246+
Beta compatibility and runtime ABI notes live in [docs/BETA.md](docs/BETA.md)
1247+
and [docs/ABI.md](docs/ABI.md). Features listed below are either intentionally
1248+
constrained in the beta subset or unstable until a later release documents a
1249+
stronger contract.
1250+
12461251
- No trait bounds on generics
12471252
- String `for...in` iterates bytes (`u8`), not Unicode code points or graphemes
12481253
- `if`/`else` merge: ownership after an `if` is merged from branches that can fall through to the following code. A move in a branch that always `return`s, `break`s, or `continue`s does not block use after the `if`. If two fall-through paths disagree (one moved, one valid), it is still an error.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Known limitations: [ION_SPEC.md section 10.3](ION_SPEC.md#103-known-limitations)
2929
| Resource | Contents |
3030
|----------|----------|
3131
| [ION_SPEC.md](ION_SPEC.md) | Language semantics, grammar, stdlib contracts |
32+
| [docs/BETA.md](docs/BETA.md) | Beta subset, compatibility policy, and platform support |
33+
| [docs/ABI.md](docs/ABI.md) | Runtime ABI notes for generated C and stdlib types |
3234
| [CONTRIBUTING.md](CONTRIBUTING.md) | Build, test, lint, and PR expectations |
3335
| [CHANGELOG.md](CHANGELOG.md) | Release notes by month |
3436
| [tests/README.md](tests/README.md) | Integration test catalog |

0 commit comments

Comments
 (0)