air: feature negotiation for AIR format 0 (DD-014)

- reference/air-features.md: normative feature registry (arrays,
  atomics, capabilities, channels, effects, islands, ownership, regions,
  sync, tasks; all reserved), dependency closures, reasons for E0006
- spec 07 §8.1/§8.5/§8.7: features are mandatory, validated before the
  body, full dependency closure declared, sorted canonically; every
  extension belongs to a feature; published feature semantics immutable
- spec 05 §8: features vs effects vs capabilities
- src/air/features.zig: registry, validation, sync test with the docs
- parser validates features first; E0006 carries `reason`
- `aji features` prints supported AIR format, language and features
- conformance: unknown, reserved and duplicate feature tests
- plan: feature publication tasks in phases 1-5
This commit is contained in:
dev committed 2026-10-04 12:49:29 +03:00
1 parent 03dda1245a
commit 19dff5dd52
24 files changed
+366 -17

No files matched your search

+1
View File
@@ -80,6 +80,7 @@ These run through all phases rather than belonging to one.
| Diagnostics | New codes are added to `../reference/error-codes.md` and `src/diag.zig` together; structured fields per code are documented in the spec section that defines the rule. |
| Determinism | Every run test is executed twice and compared from P0-12 on; concurrency tests add schedule stress from P3. |
| Audit reports | Each phase that adds an auditable fact (unsafe sites, effects, capabilities, weak atomics, eliminated checks) extends the report in `src/report/` (spec 10 §6, spec 13 §5). |
| Features | Every phase from P1 publishes its feature bundles (`../reference/air-features.md`) when their semantics are specified, and adds them to `supported` when implemented. `aji features` is the discovery interface for agents. |
| Packages | Minimal `aji.toml` reading for capabilities in P2; dependencies, lockfile and sandboxed build extensions in P8 (spec 12). |
## Task conventions
+2 -1
View File
@@ -21,7 +21,8 @@ Out: islands, `Arc`, `Pin`, raw addresses (beyond rejecting them in safe code).
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P1-1 | todo | Resolve Q-009 and Q-010; propose RFC 0001 memory sections for acceptance | — | spec 03, 07, RFC 0001 | questions resolved; RFC ready for the owner, rules integrated on acceptance |
| P1-2 | todo | Contract tables for Phase 1 opcodes | P1-1 | spec 07 appendix | every in-scope opcode has all spec 07 §4 fields, including verifier transfer function |
| P1-2 | todo | Contract tables for Phase 1 opcodes, grouped by feature (`arrays`, `ownership`, `regions`) | P1-1 | spec 07a | every in-scope opcode has all spec 07 §4 fields, including verifier transfer function, and names its feature |
| P1-2a | todo | Feature gating in the parser: constructs of an undeclared feature report `E0006` reason `feature_not_declared`; publish `arrays`, `ownership`, `regions` in the registry and add them to `supported` once implemented | P1-2 | `src/air/features.zig`, `src/air/parse.zig`, `reference/air-features.md` | reject test per feature for `feature_not_declared` and `missing_dependency`; `aji features` lists the three |
| P1-3 | todo | Interpreter memory: allocations, provenance, bounds, region generations, uninitialized bytes | P1-2 | `src/interp/memory.zig` | unit tests: every access checks provenance; reading uninitialized bytes is detected in interpreter debug checks |
| P1-4 | todo | Initialization verifier | P1-2 | `src/verifier/init.zig` | E1010 accept/reject (scalar, struct field, array prefix) |
| P1-5 | todo | Ownership state machine | P1-2 | `src/verifier/ownership.zig` | E2001, E2002 accept/reject, including across branches and loops |
@@ -22,6 +22,7 @@ Out: tasks, threads, async I/O (P3); FFI to native code (P7).
|---|---|---|---|---|---|
| P2-1 | todo | Resolve Q-011, Q-012, Q-018 | — | spec 05, 07, 10 | questions resolved; runtime record format defined |
| P2-2 | todo | Formal signatures for fs, io, net, clock, random intrinsics | P2-1 | `reference/intrinsics.md` | each intrinsic lists types, effects, capabilities, ownership, failure, blocking (spec 09 §2) |
| P2-2a | todo | Publish features `effects` and `capabilities` (spec text, registry status, `supported`); effect checking applies to modules declaring `effects` | P2-1 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests; baseline modules unaffected |
| P2-3 | todo | Contract tables for `intrinsic.call`, `resource.consume`, `call.indirect` | P2-1 | spec 07 appendix | all spec 07 §4 fields present |
| P2-4 | todo | Effect verifier | P2-1 | `src/verifier/effects.zig` | E3101 accept/reject, including transitive callees |
| P2-5 | todo | Capability verifier: unforgeability, narrowing, transfer rules | P2-1 | `src/verifier/caps.zig` | E3201, E3202 accept/reject |
@@ -24,6 +24,7 @@ Non-normative. Part of the [implementation plan](README.md).
|---|---|---|---|---|---|
| P3-1 | todo | Resolve Q-013, Q-014; propose RFC 0002 for acceptance | — | spec 04, 11 | questions resolved |
| P3-2 | todo | Contract tables: `task.*`, `thread.*`, `channel.*`, `mutex.*`, `rwlock.*`, select | P3-1 | spec 07 appendix | all spec 07 §4 fields including synchronization effects |
| P3-2a | todo | Publish features `tasks`, `channels`, `sync` | P3-2 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
| P3-3 | todo | Deterministic scheduler: seeds, choice points, choice log; global fuel across tasks and a separate `quantum` (spec 11 §7.2) | P3-2 | `src/interp/sched.zig` | same seed ⇒ identical trace; choice log replays a run; fuel is the sum over all tasks |
| P3-4 | todo | Send/Share/Local derivation | P3-1 | `src/verifier/send_share.zig` | E4001, E4002 accept/reject |
| P3-5 | todo | Task-scope verifier and scoped borrows | P3-2 | `src/verifier/tasks.zig` | E4301, E4302 accept/reject |
+1
View File
@@ -23,6 +23,7 @@ Non-normative. Part of the [implementation plan](README.md).
| ID | Status | Task | Depends | Output | Done when |
|---|---|---|---|---|---|
| P4-1 | todo | Contract tables: `island.create`, `island.alloc`, `island.freeze`, `iref` access, `arc.clone`, `arc.release` | — | spec 07 appendix | all spec 07 §4 fields present |
| P4-1a | todo | Publish feature `islands` | P4-1 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
| P4-2 | todo | Island allocator in the interpreter (private regions, O(1) transfer) | P4-1 | `src/interp/memory.zig` | transfer cost independent of graph size (unit benchmark with fixed bound) |
| P4-3 | todo | `iref` verifier and closure checks | P4-1 | `src/verifier/island.zig` | E2110, E2111 accept/reject |
| P4-4 | todo | Island transfer through channels and task spawn; sender invalidation | P4-3 | verifier + interpreter | sender use after send rejected (E2001) |
@@ -23,6 +23,7 @@ Non-normative. Part of the [implementation plan](README.md).
|---|---|---|---|---|---|
| P5-1 | todo | Resolve Q-015, Q-017; propose RFC 0003 for acceptance | — | spec 04, 11 | questions resolved |
| P5-2 | todo | Contract tables: `atomic.load`, `atomic.store`, `atomic.rmw`, `atomic.cmpxchg`, `atomic.fence` | P5-1 | spec 07 appendix | all fields present, including allowed orderings per op |
| P5-2a | todo | Publish feature `atomics` | P5-2 | `reference/air-features.md`, `src/air/features.zig` | feature_not_declared / missing_dependency tests |
| P5-3 | todo | Atomic types and ordering validation | P5-2 | `src/verifier/atomics.zig` | E4201 accept/reject for every op, including cmpxchg failure order |
| P5-4 | todo | `atomic` / `atomic.weak` effect marking | P5-3 | verifier + report | relaxed use without `atomic.weak` rejected per Q-011 outcome; weak sites listed in report |
| P5-5 | todo | Weak-memory model in the interpreter | P5-1 | `src/interp/weak.zig` | SB weak outcome reachable; MP forbidden outcome unreachable |