spec: bit-exact PRNG, canonical run record, global quiescence

Owner review of the RFC 0007 implementation:
- spec 11 §8.1: xoshiro256** with SplitMix64 seeding specified bit for
  bit, fill consumes ceil(n/8) outputs LSB first; golden vector; own
  implementation replaces std.Random (whose seeding differs)
- spec 07a: canonical run record; stdout/stderr as UTF-8 strings or
  base64 objects, files always base64 objects
- spec 11 §8: blocked only at global quiescence (no runnable unit, no
  known future event, unfinished execution)
- reserved feature resource_joins; test names are permanent and
  rule-descriptive (renamed resource_*/borrow_* tests)
- plan: remaining Phase 2 order heap/regions -> unsafe -> hosted ->
  reports -> aji.toml
This commit is contained in:
dev committed 2026-10-04 14:07:54 +03:00
1 parent d405d4ea50
commit 7a74be3cf7
18 files changed
+203 -38

No files matched your search

+1
View File
@@ -51,6 +51,7 @@ A key is a single lowercase word; header lines without a `key:` prefix are free-
## Rules
- Every verifier rule gets at least one `accept` and one `reject` test (AGENTS.md, testing policy).
- **Names are permanent and describe the rule** (`resource_use_after_move.air`, `borrow_use_after_end.air`). A name is never reused for a different rule; the corpus doubles as an executable specification.
- One defect per `reject` test. A test that triggers several unrelated errors is hard to repair against.
- Keep tests minimal: the smallest module that exhibits the rule.
- Tests are written in text AIR format 0 (`docs/reference/air-text.ebnf`) and start with the four-line module header.
@@ -2,7 +2,7 @@
; expect: reject E2106
; phase: 1
; spec: docs/spec/08-verifier.md
module test.use_after_end
module test.borrow_use_after_end
air 0
lang 0.1
features [arrays, ownership]
@@ -2,7 +2,7 @@
; expect: reject E5002
; phase: 2
; spec: docs/reference/intrinsics.md
module test.ok_arity
module test.intrinsic_ok_arity
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
@@ -2,7 +2,7 @@
; expect: reject E2002
; phase: 2
; spec: docs/spec/06-resources-and-errors.md
module test.close_twice_after_error
module test.resource_close_twice_after_error
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
@@ -2,7 +2,7 @@
; expect: reject E2101
; phase: 2
; spec: docs/spec/06-resources-and-errors.md
module test.close_while_borrowed
module test.resource_close_while_borrowed
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
@@ -2,7 +2,7 @@
; expect: reject E1001
; phase: 2
; spec: docs/spec/06-resources-and-errors.md
module test.copy_resource
module test.resource_copy
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
@@ -2,7 +2,7 @@
; expect: reject E3001
; phase: 2
; spec: docs/spec/06-resources-and-errors.md
module test.use_after_close
module test.resource_use_after_close
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
@@ -2,7 +2,7 @@
; expect: reject E2001
; phase: 2
; spec: docs/spec/06-resources-and-errors.md
module test.use_after_move
module test.resource_use_after_move
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
@@ -0,0 +1,41 @@
; Golden vector of the deterministic generator (spec 11 §8.1): seed 0, calls of 1, 7, 8 and 17 bytes.
; expect: run
; grant: rng=random.read
; seed: 0
; result: [180,42,69,86,73,120,31,110,224,230,51,73,157,132,95,26,44,45,45,38,241,148,165,106,89,46,132,31,74,173,165,187,202]
; phase: 2
; spec: docs/spec/11-determinism-and-replay.md
module test.random_golden_vector
air 0
lang 0.1
features [arrays, capabilities, effects, ownership]
fn @main(%rng: cap<random.read>) -> array<u8, 33>
effects [random.read]
entry:
%b = local.alloc array<u8, 33>
local.zero %b
%m = borrow.mut %b
%s = slice.make %m
%o0 = const.usize 0
%o1 = const.usize 1
%o8 = const.usize 8
%o16 = const.usize 16
%n7 = const.usize 7
%n17 = const.usize 17
%a = slice.sub %s, %o0, %o1
intrinsic random.fill(%rng, %a)
borrow.end %a
%c = slice.sub %s, %o1, %n7
intrinsic random.fill(%rng, %c)
borrow.end %c
%d = slice.sub %s, %o8, %o8
intrinsic random.fill(%rng, %d)
borrow.end %d
%e = slice.sub %s, %o16, %n17
intrinsic random.fill(%rng, %e)
borrow.end %e
borrow.end %s
borrow.end %m
%r = local.load %b
ret %r
@@ -2,7 +2,7 @@
; expect: run
; grant: rng=random.read
; seed: 7
; result: [61,145,174,42]
; result: [90,118,249,78]
; phase: 2
; spec: docs/reference/intrinsics.md
module test.random_seeded