Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
559b37c
fix(env): guard env_lookup_flat against a thread with no VM
vbmithr Sep 17, 2026
17bc874
docs: fix the strict-mode Pages build; publish plans, drop results dumps
singaraiona Sep 17, 2026
c7ccc45
fix(table): make the public table accessors total over ray_t
singaraiona Sep 17, 2026
8a4fc85
Merge pull request #566 from RayforceDB/fix/unpublish-engineering-docs
singaraiona Sep 18, 2026
16b6d39
Merge pull request #565 from vbmithr/fix/env-lookup-flat-no-vm
singaraiona Sep 18, 2026
142de18
fix(table): guard ray_table_add_col too; state the contract per retur…
singaraiona Sep 18, 2026
4ca3a69
Merge pull request #568 from RayforceDB/fix/table-accessors-total
singaraiona Sep 18, 2026
be33fef
fix(agg): keep each worker's keyless accumulators on their own cache …
ser-vasilich Sep 18, 2026
6d771e3
perf(sym): like and strlen read a FILE domain's entries off the mappi…
ser-vasilich Sep 17, 2026
c589aaa
fix(sym): publish the raw vocabulary snapshot and retire the old mapp…
ser-vasilich Sep 18, 2026
4b3f403
feat(sys): process identity in .sys.info; .sys.exec exit codes and ou…
singaraiona Sep 18, 2026
9d1e7e4
fix(sys): guard the exec helpers out of the fuzz build; harden error …
singaraiona Sep 18, 2026
4564f25
fix(sym): keep the group strlen aggregate on its per-row path; read t…
ser-vasilich Sep 18, 2026
1eec4a7
fix(agg): carve the per-worker accumulator block in words through void*
ser-vasilich Sep 18, 2026
9a93fc0
Merge pull request #576 from RayforceDB/feat/process-identity-exec-out
singaraiona Sep 18, 2026
3d401f0
fix(io): read and read-bytes read until EOF, not to the reported size
singaraiona Sep 18, 2026
c5f6dfd
Merge pull request #575 from RayforceDB/perf/sym-file-domain-raw
singaraiona Sep 18, 2026
eba7d33
Merge pull request #574 from RayforceDB/fix/keyless-agg-false-sharing
singaraiona Sep 18, 2026
946e2ef
fix(guid): seed from the OS, independently of rand
singaraiona Sep 18, 2026
24acead
test(io): move the procfs cases off the .rfl suite; reject directorie…
singaraiona Sep 18, 2026
66e02ce
Merge remote-tracking branch 'origin/dev' into fix/read-until-eof
singaraiona Sep 18, 2026
a473a8d
fix(io): bound an unsized read by the heap's own budget
singaraiona Sep 18, 2026
fb900f5
fix(io): bound the read against remaining headroom, not the spill thr…
singaraiona Sep 18, 2026
d922316
fix(io): confine the read budget to unsized streams; close fp on reje…
singaraiona Sep 18, 2026
95c8c9d
Merge pull request #577 from RayforceDB/fix/read-until-eof
singaraiona Sep 18, 2026
8c11845
Merge remote-tracking branch 'origin/dev' into fix/guid-os-seed
singaraiona Sep 18, 2026
cad8172
Merge pull request #578 from RayforceDB/fix/guid-os-seed
singaraiona Sep 18, 2026
910e1a5
docs(sys): warn that .sys.exec 'out waits for backgrounded children; …
singaraiona Sep 18, 2026
3775817
fix(ipc): bind a VM for lifecycle hooks on VM-less threads
singaraiona Sep 18, 2026
83a5c4e
Merge pull request #580 from RayforceDB/docs/exec-out-background
singaraiona Sep 18, 2026
de7bca0
Merge remote-tracking branch 'origin/dev' into fix/vmless-hook-dispatch
singaraiona Sep 18, 2026
c96beb2
test(ipc): make the VM-less hook test actually gate the bug
singaraiona Sep 18, 2026
2dafc19
Merge pull request #581 from RayforceDB/fix/vmless-hook-dispatch
singaraiona Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions docs/aggregation-fast-path-results.md

This file was deleted.

45 changes: 42 additions & 3 deletions docs/docs/language/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,24 @@ Cross-temporal comparisons are supported: dates, times, and timestamps are all c
| `as` | binary | Cast value to another type | `(as 'i64 "42")` → `42` |
| `nil?` | unary | Test if value is null; element-wise inside query expressions | `(nil? x)` |
| `rc` | unary | Reference count of an object | `(rc x)` → `1` |
| `guid` | unary | Generate a vector of N GUIDs (`(guid 0)` → `[]`) | `(guid 1)` |
| `guid` | unary | Generate a vector of N v4 GUIDs (`(guid 0)` → `[]`) | `(guid 1)` |

`guid` and `rand` draw from **different** sources on purpose:

- `guid` is seeded from the OS at first use, per thread, so values are unique
across processes and machines. That is the property the type exists to
provide, so it is not something to trade for reproducibility.
- `rand` is deterministic — the same process-wide sequence every run. That is
what makes tests and simulations reproducible, and changing `guid`'s seeding
deliberately left it alone.

```lisp
(first (guid 1)) ;; a different value in every process
(rand 3 1000) ;; [383 886 777] in every process
```

If you need a reproducible stream, use `rand`. If you need identifiers that do
not collide between two processes writing into the same table, use `guid`.

## I/O & File Operations

Expand All @@ -438,12 +455,34 @@ Cross-temporal comparisons are supported: dates, times, and timestamps are all c
| `format` | variadic | Format value to string (% is placeholder) | `(format "val=%" 42)` → `"val=42"` |
| `.csv.read` | variadic | Load CSV file into table | `(.csv.read "data.csv")` |
| `.csv.write` | variadic | Write table to CSV file | `(.csv.write trades "out.csv")` |
| `read` | unary | Read file contents as string | `(read "file.txt")` |
| `read-bytes` | unary | Read file contents as a `U8` byte vector | `(read-bytes "file.bin")` |
| `read` | unary | Read file contents as string, to EOF | `(read "file.txt")` |
| `read-bytes` | unary | Read file contents as a `U8` byte vector, to EOF | `(read-bytes "file.bin")` |
| `write` | binary | Write a string to a file | `(write "file.txt" "content")` |
| `write-bytes` | binary | Write a `U8` byte vector to a file | `(write-bytes "file.bin" bytes)` |
| `load` | unary | Load and evaluate a Rayfall script; a relative path is tried against the working directory, then below `RAYFORCE_HOME` | `(load "lib.rfl")` |

`read` and `read-bytes` read until EOF rather than to the size the file
reports. That matters for anything whose reported size is not its content
length: every file under `/proc` and `/sys` reports `0` while yielding data,
FIFOs and character devices cannot be seeked at all, and an ordinary file may
change between the measure and the read.

```lisp
(read "/proc/sys/kernel/hostname") ;; => "sita\n"
(read "/proc/sys/kernel/random/uuid") ;; => a fresh UUID per call
(.fs.size "/proc/sys/kernel/hostname") ;; => 0 (what the kernel reports)
```

`.fs.size` still reports what the OS reports — the two disagreeing on a
special file is expected, not a bug.

A stream with no size to go on — `/dev/zero`, or a FIFO nobody closes — has no
EOF to reach. Reading one grows a buffer until it crosses a ceiling derived
from the heap's remaining headroom, then fails with `io` rather than consuming
the machine. Reads of a file whose size *is* known are not subject to that
ceiling: a reported size is a finite claim, and a large file allocates and
spills exactly as it did before.

## Control Flow

| Function | Type | Description | Example |
Expand Down
79 changes: 71 additions & 8 deletions docs/docs/namespaces/sys.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Process-level introspection (build, memory, host info) and command-style operati
|---|---|---|---|
| [`.sys.args`](#sys-args) | variadic | — | Command-line arguments as a typed dict. |
| [`.sys.build`](#sys-build) | variadic | — | Version + build date as a dict. |
| [`.sys.info`](#sys-info) | variadic | — | Host facts: cores, page size, total memory. |
| [`.sys.info`](#sys-info) | variadic | — | Host and process facts: cores, page size, total memory, pid, hostname. |
| [`.sys.mem`](#sys-mem) | variadic | — | Allocator statistics. |
| [`.sys.prof`](#sys-prof) | variadic | — | Last profiled query's per-step statistics as a table. |
| [`.sys.querylog`](#sys-querylog) | variadic | — | Ambient per-query statistics ring as a table. |
| [`.sys.querylog.enable`](#sys-querylog-enable) | variadic | restricted | Toggle query-statistics logging. |
| [`.sys.gc`](#sys-gc) | variadic | — | Run allocator maintenance and return `0`. |
| [`.sys.env`](#sys-env) | variadic | — | Count or list of globally bound names. |
| [`.sys.exec`](#sys-exec) | unary | restricted | Run a shell command; return its exit code. |
| [`.sys.exec`](#sys-exec) | variadic | restricted | Run a shell command; return its exit code, optionally with stdout. |
| [`.sys.cmd`](#sys-cmd) | unary | restricted | Dispatch a colon-command string. |
| [`.sys.listen`](#sys-listen) | unary | restricted | Bind an IPC listener on a TCP port. |
| [`.sys.timeit`](#sys-timeit) | variadic | — | Toggle / set the per-expression profiler. |
Expand Down Expand Up @@ -75,13 +75,33 @@ Signature: `(.sys.build)`. Returns a dict with `version` (string) and `build-dat

## `.sys.info` { #sys-info }

Signature: `(.sys.info)`. Returns `{cores: i64, page-size: i64, total-mem: i64}` on POSIX. On Windows the response is `{cores: 1}` (a fallback — the sysconf-backed values aren't wired).
Signature: `(.sys.info)`. Returns `{cores: i64, page-size: i64, total-mem: i64, pid: i64, hostname: str}` on POSIX. On Windows the machine facts fall back to `{cores: 1}` (the sysconf-backed values aren't wired), but `pid` and `hostname` are answered on both platforms.

```lisp
(.sys.info)
;; => {cores: 10, page-size: 16384, total-mem: 68719476736}
;; => {cores: 10, page-size: 16384, total-mem: 68719476736,
;; pid: 48213, hostname: "tp-prod-01"}
```

`pid` and `hostname` describe *this process*, not the machine, and exist so an
embedded process can name itself. The common use is a per-start epoch that a
peer can check a stale cursor against:

```lisp
(format "%-%-%" (get (.sys.info) 'hostname)
(get (.sys.info) 'pid)
(timestamp 'global))
;; => "tp-prod-01-48213-2026.09.18D10:05:59.000000000"
```

That identity is worth preferring over a random token because it is
diagnosable: reading it back tells you which host and which process produced
it. Note `(timestamp 'global)` is second-resolution, so pid is what separates
two starts within the same second.

If `hostname` cannot be obtained, it reports `""` rather than failing the whole
call — one unavailable field should not cost the caller the others.

## `.sys.mem` { #sys-mem }

Signature: `(.sys.mem)`. Returns the buddy allocator's running counters:
Expand Down Expand Up @@ -233,15 +253,58 @@ Signature: `(.sys.env)`. From a script / IPC context returns the **count** of gl

## `.sys.exec` { #sys-exec }

Signature: `(.sys.exec "command")`. Runs `command` through `system(3)` and returns its exit status as an `i64`. Used pervasively in tests to set up / tear down `/tmp` fixtures.
Signature: `(.sys.exec "command")` or `(.sys.exec "command" 'out)`.

Runs `command` through the shell. The one-argument form returns the **exit
code** as an `i64` — the code the shell itself would report, not the
`waitpid`-encoded status. A command killed by a signal reports `128 + signum`,
following the same shell convention.

Errors: `type` (arg not a string), `domain` (null pointer).
The `'out` form returns `{code: i64, out: str}`, capturing the command's
standard output. Output is read until EOF and is not sized from `stat`, so
pipes and procfs reads come back whole. **stderr is not captured** — it stays
on the process's own stderr, so a command's diagnostics land in the log rather
than corrupting a value you are about to parse.

Errors: `type` (command not a string, or mode not a symbol), `domain` (null
pointer, or a mode other than `'out`), `io` (the command could not be started
or did not complete), `oom`.

```lisp
(.sys.exec "rm -rf /tmp/scratch") ;; => 0
(.sys.exec "false") ;; => 256 (waitpid-encoded)
(.sys.exec "rm -rf /tmp/scratch") ;; => 0
(.sys.exec "false") ;; => 1
(.sys.exec "exit 3") ;; => 3
(.sys.exec "echo hi" 'out) ;; => {code: 0, out: "hi\n"}
(.sys.exec "echo partial; exit 4" 'out) ;; => {code: 4, out: "partial\n"}
```

!!! warning "`'out` waits for every process holding the pipe"
The capture reads until end-of-file on the command's stdout, and a
backgrounded child inherits that pipe. So `'out` waits for the background
process too, not just for the shell:

```lisp
(.sys.exec "(sleep 3 &) ; true" 'out) ;; returns after 3s
(.sys.exec "./server &" 'out) ;; waits for the server
```

Detach the child's stdout and the call returns at once:

```lisp
(.sys.exec "(sleep 3 &) >/dev/null 2>&1" 'out) ;; returns immediately
```

This is inherent to capturing output — `popen(3)` behaves the same way, as
do the equivalents in other languages. The one-argument form does **not**
have it, since it only waits for the shell itself, so prefer plain
`(.sys.exec "./server &")` to launch something that outlives the call.

!!! warning "Behaviour change"
Before this, the one-argument form returned the raw `waitpid`-encoded
status, so `(.sys.exec "false")` was `256` and `(.sys.exec "exit 3")` was
`768`. Success was `0` either way, so code that only checks for zero is
unaffected; code comparing against an encoded value needs updating.

## `.sys.cmd` { #sys-cmd }

Signature: `(.sys.cmd "name args")`. Parses a colon-style command name (without the leading `:`) and dispatches. Names supported: `timeit`/`t`, `listen`, `env`, `clear`, `help`/`?`, `q`/`quit`. Unknown names fall back to `system()` (so `(.sys.cmd "ls /tmp")` works too).
Expand Down
12 changes: 6 additions & 6 deletions docs/docs/reference/all-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Operations on vectors and lists as collections — set operations, indexing, sea
| `where` | unary | — | Indices where boolean vector is true | `(where [true false true])` → `[0 2]` |
| `group` | unary | — | Group indices by value (returns dict) | `(group ['a 'b 'a])` → dict |
| `diverse` | unary | — | Check if all elements are unique (no duplicates) | `(diverse [1 2 3])` → `true` |
| `rand` | binary | — | Generate N random values from range or sample from vector | `(rand 3 100)` → 3 random ints 0..99 |
| `rand` | binary | — | Generate N random values from range or sample from vector. **Deterministic**: the same sequence in every process | `(rand 3 100)` → 3 random ints 0..99 |
| `bin` | binary | — | Binary search — left boundary (sorted input) | `(bin [10 20 30] 25)` → `1` |
| `binr` | binary | — | Binary search — right boundary (sorted input) | `(binr [10 20 30] 25)` → `2` |

Expand Down Expand Up @@ -587,7 +587,7 @@ Type checking, casting, null testing, and object inspection.
| `as` | binary | — | Cast value to another type | `(as 'i64 "42")` → `42` |
| `nil?` | unary | DAG in queries | Test for null; element-wise over vectors and lists (a `B8` per element), the same in and out of queries | `(nil? [1 0N 3])` → `[false true false]` |
| `rc` | unary | — | Get reference count of an object | `(rc x)` → `1` |
| `guid` | unary | — | Generate a vector of N GUIDs (`(guid 0)` → `[]`) | `(guid 1)` |
| `guid` | unary | — | Generate a vector of N v4 GUIDs, seeded from the OS (`(guid 0)` → `[]`) | `(guid 1)` |

```lisp
; Type checking and casting
Expand All @@ -612,8 +612,8 @@ Printing, file I/O, CSV loading, and script execution.
| `format` | variadic | — | Format value to string (% as placeholder) | `(format "val=%" 42)` → `"val=42"` |
| `.csv.read` | variadic | restricted | Load CSV file into table (mmap, parallel parse) | `(.csv.read "data.csv")` |
| `.csv.write` | variadic | restricted | Write table to CSV file | `(.csv.write trades "out.csv")` |
| `read` | unary | restricted | Read file contents as string | `(read "file.txt")` |
| `read-bytes` | unary | restricted | Read file contents as a `U8` byte vector | `(read-bytes "file.bin")` |
| `read` | unary | restricted | Read file contents as string, to EOF | `(read "/proc/self/cmdline")` |
| `read-bytes` | unary | restricted | Read file contents as a `U8` byte vector, to EOF | `(read-bytes "file.bin")` |
| `write` | binary | restricted | Write a string to a file | `(write "file.txt" "content")` |
| `write-bytes` | binary | restricted | Write a `U8` byte vector to a file | `(write-bytes "file.bin" bytes)` |
| `load` | unary | restricted | Load and evaluate a Rayfall script file. A relative path is tried against the working directory, then below `RAYFORCE_HOME` when set; absolute paths are used as given; a failure names every path tried | `(load "lib.rfl")` |
Expand Down Expand Up @@ -644,7 +644,7 @@ System interaction, metaprogramming, diagnostics, and runtime inspection.
| `.sys.gc` | variadic | — | Trigger GC / heap flush, returns `0` | `(.sys.gc)` |
| `.mem.objsize` | unary | — | Logical bytes retained by an object graph; shared children count once | `(.mem.objsize value)` |
| `.mem.ts` | special form | — | Evaluate once and return result, time, allocation, peak-memory, result-size, and worker statistics as a dict | `(.mem.ts (select {from: trades}))` |
| `.sys.exec` | unary | restricted | Execute a shell command, return exit code | `(.sys.exec "ls -la")` |
| `.sys.exec` | variadic | restricted | Execute a shell command; exit code, or `{code, out}` with `'out` | `(.sys.exec "ls -la" 'out)` |
| `.os.getenv` | unary | restricted | Get environment variable value | `(.os.getenv "HOME")` |
| `.os.setenv` | binary | restricted | Set environment variable | `(.os.setenv "KEY" "value")` |
| `.sys.args` | nullary | — | Application arguments as a typed dict; `user` subdict holds post-`--` args | `(.sys.args)` |
Expand All @@ -657,7 +657,7 @@ System interaction, metaprogramming, diagnostics, and runtime inspection.
| `.sys.prof` | variadic | — | Last profiled query's per-step statistics as a table (opt-in via `:t`) | `(.sys.prof)` |
| `.sys.querylog` | variadic | — | Ambient per-query statistics ring as a table (opt-in via `-Q` / `.sys.querylog.enable`) | `(.sys.querylog)` |
| `.sys.querylog.enable` | variadic | restricted | Toggle query-statistics logging; returns new state | `(.sys.querylog.enable 1)` |
| `.sys.info` | variadic | — | System information (cores, page size, total memory) | `(.sys.info)` |
| `.sys.info` | variadic | — | Host and process info (cores, page size, total memory, pid, hostname) | `(.sys.info)` |

```lisp
; Metaprogramming: parse and eval
Expand Down
Loading
Loading