Phase 2: manifest grants (P2-9) and exit review (P2-12)

- src/manifest.zig: strict aji.toml subset ([package], [capabilities],
  [metadata]); errors with line numbers
- aji run --manifest: entry relative to the manifest, manifest grants
  replaced per parameter by --grant; usage error on manifest problems
- examples/packages/hello as a runnable package, checked in CI
- implemented_phase = 2; Phase 2 exit review; README and AGENTS updated
This commit is contained in:
dev committed 2026-10-04 15:24:04 +03:00
1 parent 0948eb7347
commit 778d563182
10 files changed
+332 -15

No files matched your search

+3 -2
View File
@@ -99,5 +99,6 @@ These run through all phases rather than belonging to one.
|---|---|
| P0 | done; AIR format 0 frozen as the semantic baseline (spec 07 §8.7) |
| P1 | done (exit review in the phase file) |
| P2 | in progress: RFCs 0006 (effects, capabilities), 0007 (I/O, resources, deterministic profile) and 0008 (heap, regions, budgets) implemented; next unsafe boundaries, hosted profile, audit reports, `aji.toml` grants |
| P3–P8 | not started |
| P2 | done (exit review in the phase file) |
| P3 | next |
| P4–P8 | not started |
@@ -33,11 +33,11 @@ Out: tasks, threads, async I/O (P3); FFI to native code (P7).
| P2-6 | done | Linear resource and typestate verifier | P2-3 | `src/verifier/resource.zig` | E3001, E3002 accept/reject; leak on an error path detected |
| P2-7 | done | Unsafe boundary verifier (RFC 0009: assume, borrow.index.unchecked, trusted, unsafe report) | P2-3 | `src/verifier/unsafe.zig` | E6001 accept/reject |
| P2-8 | done | Runtime intrinsics in the interpreter; virtual filesystem and loopback network for the `deterministic` profile | P2-2 | `src/runtime/` | intrinsic unit tests pass under both profiles; deterministic profile output identical across runs |
| P2-9 | doing | Entry-point capability instantiation (`--grant` done; `aji.toml` `[capabilities]` pending) | P2-5 | `src/runtime/host.zig` | missing grant fails instantiation, not execution (spec 05 §6) |
| P2-9 | done | Entry-point capability instantiation (`--grant` and `aji run --manifest`, RFC 0010) | P2-5 | `src/runtime/host.zig` | missing grant fails instantiation, not execution (spec 05 §6) |
| P2-10 | done | Reports: effect graph, capability requirements, unsafe sites | P2-4, P2-5, P2-7 | `src/report/` | deterministic JSON report; snapshot test |
| P2-11 | done | Reference programs: hello (real `io.write` if deferred from P0), file-copy, tcp-echo (single task) | P2-8 | `tests/programs/` | all three run; cleanup on every error path verified |
| P2-8a | done | Hosted profile: real console, files and TCP; run record through `--result-file` (spec 11 §8) | P2-8 | `src/interp/host.zig` | hello, file-copy and tcp-echo run against the real OS in CI |
| P2-12 | todo | Phase exit review | all | plan status | exit criterion passes |
| P2-12 | done | Phase exit review | all | plan status | exit criterion passes |
## Conformance tests to add
@@ -46,3 +46,13 @@ Negative corpus entries owned by this phase: missing capability, undeclared effe
## Remaining order (owner decision)
RFC 0008 heap and regions → implementation and conformance → unsafe boundaries (P2-7) → hosted profile (P2-8a) → audit reports (P2-10) → `aji.toml` grants (P2-9). The memory model is completed in the deterministic world before the real OS widens the bug surface.
## Exit review
- Exit criterion met: the safe file copy (`phase2/run/file_copy.air`, and `region_file_copy.air` with a 64 KiB region buffer) and the TCP echo (`phase2/run/tcp_echo.air`) run in the deterministic profile; `tests/hosted/smoke.py` runs file copy, scope denial, stdin → stdout and TCP echo against the real OS in CI.
- Decision records accepted and integrated: RFC 0006 (effects, capabilities), RFC 0007 (I/O, linear resources, profiles), RFC 0008 (heap, regions, budgets), RFC 0009 (unsafe boundaries), RFC 0010 (manifest grants).
- Features published and supported: `effects`, `capabilities`, `resources`, `heap`, `regions`, `unsafe`. Reserved for later: `linear_aggregates`, `resource_joins`, `borrow_joins`, `tasks`, `channels`, `sync`, `atomics`, `islands`.
- Conformance: 157 tests across phases 0–2 pass; every Phase 2 code (E3001, E3002, E3101, E3201, E3202, E2001, E2002, E2104, E6001) and trap (T0009) has tests; the PRNG has a golden vector.
- Tooling: `aji features`, `aji report` (audit), `aji check --report unsafe`, `aji run --manifest`, `--profile hosted` with `--result-file`.
- Fuzzing: mutation runs over each new corpus (resources, heap/regions, unsafe) found no crash.
- Known limitations: the hosted profile has been exercised on Linux only (the macOS CI job is configured but not yet observed); Zig 0.17's `net.Stream.read` does not compile and is worked around with `readWithControl`.