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

+8 -1
View File
@@ -242,4 +242,11 @@ Resource types and their consumption rules: spec 06 §6. Resources are used thro
On a trap it reports `{"status":"trapped", "code":…, "kind":…, "function":…, "block":…, "inst":…}` (spec 01 §6).
Programs that declare `capabilities` also get `"stdout"` and `"stderr"` (captured output) and `"files"` (files written in the virtual file system, keyed by path in byte order) in the record of the `deterministic` profile (spec 11 §8). These byte strings are written as JSON strings in which printable ASCII other than `"` and `\` appears as is, `"`, `\` and newline are escaped as `\"`, `\\` and `\n`, and every other byte `b` as `\u00XX`, so any output is valid, deterministic JSON. When the deterministic runtime detects quiescence it reports `{"status":"blocked","kind":"no_future_event",…}` (spec 11 §8). When instantiation fails (spec 05 §10.2) the program does not start and the runner reports `{"status":"not_instantiated","reason":…,…}`. When the runner stops execution because an execution limit is exhausted (spec 11 §7), it reports `{"status":"limit_exceeded","kind":"fuel","limit":N,"steps":N}`. This is an outcome of the execution environment, not of the program, and is not a trap.
Programs that declare `capabilities` also get `"stdout"` and `"stderr"` (captured output) and `"files"` (files written in the virtual file system, keyed by path in byte order) in the record of the `deterministic` profile (spec 11 §8).
**Canonical record.** The run record is canonical JSON: UTF-8, no whitespace, fields in the order this section lists them, integers in decimal, no locale dependence. Strings escape `"` as `\"`, `\` as `\\`, the control characters U+0008, U+0009, U+000A, U+000C, U+000D as `\b`, `\t`, `\n`, `\f`, `\r`, and other characters below U+0020 as `\u00xx` (lowercase hex); everything else, including non-ASCII, is written as its UTF-8 bytes. Byte data is encoded unambiguously:
- `stdout`, `stderr`: a JSON string if the bytes are valid UTF-8, otherwise `{"encoding":"base64","data":"…"}`;
- every entry of `files`: always `{"encoding":"base64","data":"…"}`, since file contents are arbitrary bytes.
Base64 is RFC 4648 with padding. Two records are equal exactly when their bytes are equal. When the deterministic runtime detects quiescence it reports `{"status":"blocked","kind":"no_future_event",…}` (spec 11 §8). When instantiation fails (spec 05 §10.2) the program does not start and the runner reports `{"status":"not_instantiated","reason":…,…}`. When the runner stops execution because an execution limit is exhausted (spec 11 §7), it reports `{"status":"limit_exceeded","kind":"fuel","limit":N,"steps":N}`. This is an outcome of the execution environment, not of the program, and is not a trap.