Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
202 commits
Select commit Hold shift + click to select a range
89eed55
v2.4.0 (#327)
singaraiona Jul 11, 2026
eb66eed
feat(query): support live inserts into parted tables
singaraiona Jul 14, 2026
bbdc419
fix(core): restore total-core -c semantics
singaraiona Jul 15, 2026
9961388
fix(parse) Fix nonstring if not defined
protocolstardust Jul 16, 2026
6cac6e8
Merge pull request #330 from protocolstardust/dev
protocolstardust Jul 16, 2026
f44ab81
Merge branch 'master' into dev
singaraiona Jul 16, 2026
49d8524
fix(store): surface FlushFileBuffers failure in journal SYNC mode (#335)
belowzeroff Jul 18, 2026
cb1c6cd
fix(hnsw): reject build dims whose vector count overflows size_t (#333)
belowzeroff Jul 18, 2026
7475949
fix(store): read full link sidecar to avoid wrong-symbol truncation (…
belowzeroff Jul 18, 2026
ebadd07
fix(hnsw): reject index files whose vector count overflows size_t (#332)
belowzeroff Jul 21, 2026
fa39d9d
fix(docs): remediate F-0001 F-0005 F-0007
singaraiona Jul 22, 2026
ffd784f
fix(docs): remediate CF-0001
singaraiona Jul 22, 2026
1f27e61
fix(docs): remediate CF-0002
singaraiona Jul 22, 2026
465e58e
chore(audit): plan CF-0003 ratification
singaraiona Jul 22, 2026
8f8033c
fix(docs): remediate CF-0003
singaraiona Jul 22, 2026
3ae79f5
feat(docs): redesign website and documentation
singaraiona Jul 22, 2026
5dc8265
Merge branch 'master' into dev
singaraiona Jul 22, 2026
4d2c8f3
fix(null): avoid f64 null casts to integers (#340)
belowzeroff Jul 23, 2026
4e49626
fix(expr): avoid null truthiness casts in fallback binary ops (#339)
belowzeroff Jul 23, 2026
a05886d
ci: make Rayforce audit PR comments best-effort
singaraiona Jul 23, 2026
6ca3d8a
ci: publish Rayforce audit comments from trusted workflow
singaraiona Jul 23, 2026
04d8f3d
ci: resolve fork PRs for audit commenter
singaraiona Jul 23, 2026
6acdc2c
perf: parallelize serial stages around group-by; unify binary-agg nul…
ser-vasilich Jul 23, 2026
a53d98e
Merge branch 'master' into dev
singaraiona Jul 23, 2026
260e018
fix(aggr): preserve slice nullability in binary groups
singaraiona Jul 23, 2026
492c5db
fix(expr): avoid f64 null cast in fallback idiv integer output (#344)
belowzeroff Jul 23, 2026
d250108
fix(group): avoid f64 null read cast in dense aggs (#343)
belowzeroff Jul 23, 2026
95f0a3d
fix(ipc): preserve boxed data list args (#346)
belowzeroff Jul 24, 2026
e10d1ab
fix(group): avoid f64 null cast in DA reads (#348)
belowzeroff Jul 24, 2026
842acc0
ci: use portable march for fuzz jobs (#347)
belowzeroff Jul 24, 2026
84cea17
chore(release): merge master into dev
singaraiona Jul 24, 2026
7a5839e
fix(pivot): preserve generic missing cells as null (#350)
belowzeroff Jul 27, 2026
57628fb
fix(xbar): avoid narrow bucket truncation (#351)
belowzeroff Jul 28, 2026
d7a1f6f
Merge branch 'master' into dev
singaraiona Jul 28, 2026
c501ae0
fix(arith): reject float temporal operands (#353)
belowzeroff Jul 29, 2026
aea9bda
fix(ops): make nested (LIST) columns usable through a parted view (fi…
singaraiona Jul 30, 2026
0605f1a
fix(query): preserve temporal arithmetic semantics (#354)
belowzeroff Jul 30, 2026
282d3a1
Merge branch 'master' into dev
singaraiona Jul 30, 2026
17bf2b8
ci: skip audit comments for cancelled runs
singaraiona Jul 30, 2026
05c8078
fix(query): preserve if temporal branch types (#359)
belowzeroff Jul 31, 2026
488a296
fix(store): reject duplicate splayed column names (#360)
belowzeroff Aug 3, 2026
5684559
fix(builtins): reject malformed strings in TIMESTAMP cast (#361)
belowzeroff Aug 3, 2026
c9b9a66
fix(store): support nested column inserts and persistence (#365)
singaraiona Aug 3, 2026
4c0fa46
fix(eval): enforce restricted mode in compiled lambdas (#366)
singaraiona Aug 3, 2026
8c9300b
feat(core): add bounded poll step for embedders (#367)
singaraiona Aug 3, 2026
3c79632
Merge branch 'master' into dev
singaraiona Aug 3, 2026
9b05f60
fix(test): rely on public runtime declarations (#369)
belowzeroff Aug 4, 2026
add3498
feat: website add consumer
singaraiona Aug 4, 2026
9d255c2
Merge branch 'master' into dev
singaraiona Aug 4, 2026
a1dcfd9
feat(core): expose restricted poll mode (#372)
singaraiona Aug 4, 2026
d5d5240
fix(aggr): preserve grouped nested first and last
singaraiona Aug 4, 2026
c35fa2b
Merge branch 'master' into dev
singaraiona Aug 4, 2026
2cfc70e
fix(join): preserve nested columns (#376)
singaraiona Aug 4, 2026
ac9d0cc
Merge branch 'master' into dev
singaraiona Aug 4, 2026
2fa0fbd
fix(csv): round-trip signed and >=24h TIME values in .csv.read (#379)
belowzeroff Aug 4, 2026
959db02
fix(str): propagate null start/length in substr instead of overflowin…
belowzeroff Aug 4, 2026
2083f24
fix(builtins): clamp out-of-range float in scalar numeric casts (#380)
belowzeroff Aug 5, 2026
5419053
Merge branch 'master' into dev
singaraiona Aug 5, 2026
c731b42
fix(builtins): validate bounds in DATE string cast (#382)
belowzeroff Aug 6, 2026
93db5ce
perf(aggr): specialize reduction scans (#383)
singaraiona Aug 6, 2026
e71798a
perf(collection): parallel radix distinct for fixed-width columns (#384)
protocolstardust Aug 6, 2026
8d6466f
fix(csv): harden import cancellation and schema handling (#387)
singaraiona Aug 7, 2026
8a1cf0c
fix(temporal): guard int64 overflow in DATE/TIMESTAMP decomposition (…
belowzeroff Aug 9, 2026
7bf522a
fix(eval): materialize lazy values at compiled boundaries (#391)
singaraiona Aug 11, 2026
caa529d
fix(arith): wrap scalar integer add/sub/mul on overflow instead of UB…
belowzeroff Aug 11, 2026
a2607ac
fix(builtins): reject malformed strings in TIME cast (#389)
belowzeroff Aug 11, 2026
a14ba5c
Merge branch 'master' into dev
singaraiona Aug 11, 2026
5aa47a5
fix(builtins): validate hex digits and dash layout in GUID string cas…
belowzeroff Aug 12, 2026
d1d256e
feat(core): address Data Vault workflow gaps (#395)
singaraiona Aug 12, 2026
f1d1b71
feat(io): add binary file read and write (#396)
singaraiona Aug 12, 2026
9a4ea60
Merge branch 'master' into dev
singaraiona Aug 12, 2026
776b290
fix(store): repair legacy string hash caches (#398)
singaraiona Aug 12, 2026
afbcf69
fix(builtins): reject trailing garbage and overflow in numeric string…
belowzeroff Aug 13, 2026
31d8970
fix(query): reject STR equality keys in asof-join and window-join (#400)
belowzeroff Aug 14, 2026
95defb7
fix(store): support LIST columns in parted fill (#402)
singaraiona Aug 14, 2026
4098f8b
fix(exec): propagate str_pool in OP_HEAD/OP_TAIL flat-column copies (…
singaraiona Aug 14, 2026
55c6e22
fix(query): evaluate whole-column aggregate args once in ungrouped se…
singaraiona Aug 14, 2026
bafb435
fix(group): sign-extend narrow keys in the DA accumulate loops
singaraiona Aug 14, 2026
4c0ed09
perf(group): size filtered group-by work from the surviving rows (Cli…
singaraiona Aug 14, 2026
68ace96
perf(agg): fix radix hash-bit overlap and rehash ladders in the v2 gr…
singaraiona Aug 15, 2026
76c50e3
perf(group): prime fat-entry radix payload buffers to expected load
singaraiona Aug 15, 2026
75b6901
feat(store): decide hash-vs-zone indexes at csv->splayed conversion; …
singaraiona Aug 15, 2026
2dc9cff
perf(group): route wide-domain SYM emit-filter groups to the parallel…
singaraiona Aug 15, 2026
e9c2d64
perf(group): tighten emit-filter v2 rerouting gates
singaraiona Aug 15, 2026
07ff419
perf(agg): memset the phase-3 order map instead of a scalar -1 loop
singaraiona Aug 15, 2026
399f9dd
perf(agg): parallelize the phase-3 stable-order scatter and compaction
singaraiona Aug 15, 2026
6357a2c
perf(pool): default worker auto-sizing to physical cores, not SMT thr…
singaraiona Aug 15, 2026
212fff3
perf(mem): reuse cache for direct (large) allocations
singaraiona Aug 15, 2026
1842700
fix(mem): public drain for the direct reuse cache + watermark test co…
singaraiona Aug 15, 2026
1ae57b9
refactor(mem): derive the direct-cache budget instead of an env knob
singaraiona Aug 15, 2026
d5867b6
perf(mem): raise the direct-cache cap to 4GB for 100M-row scale
singaraiona Aug 15, 2026
5d318ec
perf(group): pipelined slot prefetch in the v2 direct-insert phase1
singaraiona Aug 15, 2026
88c95bb
test(group): pin high-cardinality radix_v2 group shapes before partit…
singaraiona Aug 15, 2026
f30b578
fix(test): cast I32 key column to ensure radix_v2 path exercises I32 …
singaraiona Aug 15, 2026
9768280
perf(group): partition-major morsel batching in radix_v2 phase1
singaraiona Aug 15, 2026
34c9be0
perf(group): sparse touched-partition histogram + u32 partition ids i…
singaraiona Aug 15, 2026
0ac9aa4
feat(group): fused grouped count-distinct kernel (unwired)
singaraiona Aug 15, 2026
9959cbf
fix(cdfuse): guard dropped dispatch tasks; strengthen fused-cd tests
singaraiona Aug 15, 2026
0c68d3b
perf(query): route single-key unfiltered count-distinct through the f…
singaraiona Aug 15, 2026
94e28b9
perf(cdfuse): pair-hash partitioning with additive per-key merge (ske…
singaraiona Aug 15, 2026
125336f
perf(cdfuse): parallel key-bucketed merge phase
singaraiona Aug 15, 2026
66dcdd2
fix(cdfuse): asymmetric pair-hash combine (k==v cancellation cliff)
singaraiona Aug 15, 2026
c0cf496
fix(cdfuse): memory admission gate, SYM + boundary coverage, self-con…
singaraiona Aug 15, 2026
f3b2cbb
perf(mem): drop the direct-cache absolute cap; watermark/16 is the bound
singaraiona Aug 15, 2026
f1aaa73
perf(query): push a positive take: into grouped DAGs and bound v2's emit
singaraiona Aug 15, 2026
5684d4c
fix(query): guard the grouped take: pushdown and trim LIST columns
singaraiona Aug 15, 2026
2dd36e9
fix(query): pin the parted take guard, drop the take_pre allocation
singaraiona Aug 15, 2026
5784c19
perf(group): packed narrow-key fast path in the fat-entry radix pipeline
singaraiona Aug 15, 2026
ab5053a
fix(group): restore packed-key hash lockstep in the fused radix path
singaraiona Aug 15, 2026
701c7b8
test(group): pin F64 packed-key exclusion; honest 9-key test comment
singaraiona Aug 15, 2026
16bd46d
perf(group): prefetched partition-major probe for COUNT/SUM/AVG near-…
singaraiona Aug 16, 2026
ead2fff
fix(group): bound the grow_cap jump and keep it off the row array
singaraiona Aug 16, 2026
f2fba93
perf(group): parallelize the top-N group compaction
singaraiona Aug 16, 2026
bd9e743
fix(group): guard the top-N pre-pass against a cancelled dispatch
singaraiona Aug 16, 2026
853b3d3
perf(temporal): parallelize the extract/truncate kernels over the pool
singaraiona Aug 16, 2026
d64eb1d
test(temporal): pin the HAS_NULLS fold with vec-gate consumers; slim …
singaraiona Aug 16, 2026
902f294
perf(group): parallelize the radix key-column emit
singaraiona Aug 16, 2026
9e3cb09
test(group): slim the key-emit fixture; correct the take-bounded rout…
singaraiona Aug 16, 2026
d315102
perf(group): fuse the per-partition top-k into radix phase 2
singaraiona Aug 16, 2026
03142f5
fix(group): honour asc: on the top-N group emit filter (#408)
singaraiona Aug 16, 2026
9d95f6f
docs(group): pin the emit-filter .desc contract; honest #408 test com…
singaraiona Aug 16, 2026
c3fb6c6
fix(group): canonicalise -0.0 F64 group keys at the key-read boundary…
singaraiona Aug 16, 2026
2ec5284
fix(group): bit-level -0.0 fold in mode_scalar_key; precise NaN-polic…
singaraiona Aug 16, 2026
d59bb43
fix(collection): reject INT64_MIN count in take/drop instead of overf…
belowzeroff Aug 16, 2026
cd84f48
fix(cal): decode dates near INT32_MAX without int32 overflow (#410)
belowzeroff Aug 16, 2026
91fe7e3
fix(query): support update over parted tables and prevent column dupl…
belowzeroff Aug 16, 2026
66a80fb
fix(arith): keep integer div exact and UB-free (#403)
belowzeroff Aug 16, 2026
9e5f0a1
perf(expr): stop rescanning operands for the integer div gate (#403 f…
singaraiona Aug 16, 2026
2b93010
test(expr): pin the div gate bound; defensive idiv_i64_small reset un…
singaraiona Aug 16, 2026
412b69d
Merge branch 'master' into dev
singaraiona Aug 16, 2026
4fca523
fix(build): clang-clean boolean accumulation in the div gate scans
singaraiona Aug 16, 2026
c303733
docs(query): neutralize a product-name mention in the update by: scat…
singaraiona Aug 16, 2026
e5d87cd
docs(test): neutralize remaining product-name mentions in update-by c…
singaraiona Aug 16, 2026
3b1f533
perf(csv): drop load-time index attach from .csv.read
singaraiona Aug 17, 2026
b3f0275
feat(progress): byte-metered span for multi-phase ops
singaraiona Aug 17, 2026
0273a44
perf(csv): parallel row-offset scan, per-column finalize, whole-load …
singaraiona Aug 17, 2026
9e1592a
test(csv): boundary-dense chunking in test builds + stitching matrix
singaraiona Aug 17, 2026
bfb5b38
fix(core): normalize null and schema handling
singaraiona Aug 17, 2026
82661f4
perf(csv): parallelize the sym intern by per-column local dedupe
singaraiona Aug 17, 2026
2e6f8c8
test(csv): mixed-vocabulary column in sym_id_order; comment corrections
singaraiona Aug 17, 2026
5857e0c
perf(csv): fold bfb5b380's null scan into the finalizer's write sites
singaraiona Aug 17, 2026
3ebf8f2
fix(store): canonical SYM/STR nulls reach converted stores; HAS_NULLS…
singaraiona Aug 17, 2026
dfc0613
perf(query): fused equality on nullable SYM/STR columns
singaraiona Aug 17, 2026
12567b3
fix(group): canonical null for SYM/GUID keys in the radix emit
singaraiona Aug 17, 2026
0fb4d01
test(null): fused-relaxation and converted-store HAS_NULLS differentials
singaraiona Aug 17, 2026
47538c4
fix(collection,query): harden take/drop count-overflow family (#424)
belowzeroff Aug 25, 2026
782a63b
fix(csv): reject malformed separators and trailing garbage in typed t…
belowzeroff Aug 25, 2026
4297e72
fix: silent zero-match predicates — guid equality and like over list …
protocolstardust Aug 25, 2026
ca5a2d3
fix(join): compare GUID keys by full cell bytes (#425)
belowzeroff Aug 25, 2026
955a2fd
fix(agg): keep sum/prod list reductions exact and UB-free for i64 (#423)
belowzeroff Aug 25, 2026
8719121
fix(csv): reject impossible calendar dates in typed DATE/TIMESTAMP pa…
belowzeroff Aug 26, 2026
a4776b7
fix(storage): reject unsafe splayed column names (#434)
belowzeroff Aug 26, 2026
fabd746
fix(builtins): reject out-of-range numeric string casts (#432)
belowzeroff Aug 26, 2026
61c7c9c
fix(format): bound fmt_ensure growth; loud failure past 2GiB output (…
belowzeroff Aug 26, 2026
2b71135
fix(sort): one rule for where a null sorts, across every sort path (#…
ser-vasilich Aug 26, 2026
a4e38f1
fix(query): close the two ways an unresolved name still passed a sele…
ser-vasilich Aug 28, 2026
a93763c
fix(datalog): reject forged dl-program handles instead of dereferenci…
belowzeroff Aug 28, 2026
72f5810
refactor(ops): drop unreachable ISNULL paths; pin load-select mask re…
protocolstardust Aug 28, 2026
3fb5aff
fix(store): let a mapped string column's pool own the region they sha…
ser-vasilich Aug 28, 2026
a8102e6
feat(repl): add .repl.complete namespace completion verb (#441) (#442)
singaraiona Aug 30, 2026
b033fd2
fix(serde): reject table frames with mismatched schema/column counts …
belowzeroff Aug 31, 2026
057f519
fix(system): reject partially-numeric .ipc.open ports (#440)
belowzeroff Aug 31, 2026
86a7941
fix(repl): flush system command output (#443)
vbmithr Aug 31, 2026
322501d
fix: eliminate the three UBSan errors the test suite was swallowing (…
singaraiona Aug 31, 2026
0299511
fix(mem): size the scratch arena window from the backing block's real…
ser-vasilich Aug 31, 2026
dd80619
fix(mem): hand a cross-thread free back to its owner, and return idle…
ser-vasilich Aug 31, 2026
5d6bde8
fix(vec): flag sentinel nulls in every from_raw payload, not just SYM…
singaraiona Sep 1, 2026
ed46884
perf(query): append insert batches into a named table's columns in pl…
singaraiona Sep 1, 2026
657e853
fix(join): a null equi-join key equals another null key (#449)
protocolstardust Sep 1, 2026
14f366b
fix(format): pad table cells by display width, not byte length (#459)
singaraiona Sep 1, 2026
f1c54af
fix(journal): recovery skips log entries the snapshot already contain…
singaraiona Sep 1, 2026
4006e94
perf(join): route heavy-null build sides to the chained path upfront …
singaraiona Sep 2, 2026
5f20751
feat(ipc): bind a listener to a given address — loopback-only listene…
singaraiona Sep 2, 2026
612c0af
fix(serde): validate table/dict counts and lengths on decode (#452)
belowzeroff Sep 2, 2026
30a88e7
fix(query): handle guid membership predicates (#456)
belowzeroff Sep 2, 2026
04dc656
chore: record v2.5.15 squash (#413) as merged into dev
singaraiona Sep 2, 2026
a6eb246
fix(ipc): restrict server-state mutators under -U restricted IPC (#464)
belowzeroff Sep 3, 2026
451b08e
fix(query): accept SYM/STR HAS_NULLS segments on parted insert (#468)
singaraiona Sep 4, 2026
2ead9e7
fix(group): hash null keys identically on rehash and lookup (#467)
singaraiona Sep 4, 2026
adcd751
feat(ipc): add multicast fan-out (#470)
belowzeroff Sep 4, 2026
318b2b5
perf(query): one-pass in-place upsert and where-update for named tabl…
singaraiona Sep 6, 2026
3ab433e
fix(query): count a null as one distinct value in the grouped paralle…
ser-vasilich Sep 6, 2026
e6064d7
test(pool): drop racy main-thread-participation assert in zero_worker…
singaraiona Sep 6, 2026
5a6f9b3
fix(timer): skip missed intervals on overrun, and print a failing cal…
singaraiona Sep 6, 2026
24df86e
fix(app): exit non-zero when -p cannot bind instead of running withou…
singaraiona Sep 6, 2026
baa8c00
fix(ipc): say "timed out" when the wire handshake expires, not "refus…
singaraiona Sep 6, 2026
fd9014f
fix(pivot): keep a temporal type when both branches of an if share it…
ser-vasilich Sep 7, 2026
70d31af
fix(serde): round-trip builtins by full registered name (#482)
belowzeroff Sep 7, 2026
ecc14bd
fix(csv): infer Rayfall temporal forms (#481)
belowzeroff Sep 7, 2026
30712c9
chore: record v2.6.0 squash (#463) as merged into dev
singaraiona Sep 7, 2026
e0f6d1f
fix(parse): reject a leaf token glued to a quote, colon or name chara…
singaraiona Sep 8, 2026
dff0b5a
feat(builtins): make nil? element-wise over vectors and lists (#488)
singaraiona Sep 8, 2026
c803d47
perf(ipc): share one serialized frame across multicast subscribers (#…
singaraiona Sep 8, 2026
f582992
fix(types): index ray_type_sizes by uint8_t to avoid OOB on atom tags…
belowzeroff Sep 9, 2026
6333140
fix(store): reject calendar-impossible date partition directories (#492)
belowzeroff Sep 9, 2026
d53a66a
test(repl): pin that timers fire while the interactive prompt is idle…
singaraiona Sep 9, 2026
ce5e3eb
fix(repl): read piped stdin through the poll loop, and stay for pendi…
singaraiona Sep 9, 2026
26cc9ff
fix(mcast): accept bare subscribe calls (#500)
belowzeroff Sep 9, 2026
f5f9d84
test(journal): cover snapshot function binding recovery (#499)
belowzeroff Sep 9, 2026
a394d58
fix(journal): reject explicit writes during auto-journaled eval (#498)
belowzeroff Sep 9, 2026
ed1218d
fix(vec): a slice inherits its parent's HAS_NULLS, and a saved column…
singaraiona Sep 9, 2026
976909a
chore: record v2.6.1 squash (#483) as merged into dev
singaraiona Sep 9, 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
17 changes: 14 additions & 3 deletions docs/docs/language/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ false ; boolean false

Symbols are interned identifiers used for column names, dictionary keys, and categorical data. Prefix with a single quote to create a literal symbol.

A symbol literal runs over letters, digits, `_`, `.` and `-`. A symbol, keyword, name or number cannot be directly followed by a quote, a colon, or another name or number character: `['a:1]` is a parse error rather than the two symbols `a` and `1`, and `0Na` is not `0` followed by `Na`. A symbol that must contain a colon is built from a string, `(as 'symbol "a:1")`.

```lisp
'AAPL ; symbol atom
'price ; used as column reference
Expand Down Expand Up @@ -124,9 +126,18 @@ sentinel for their type:

Symbols have no typed null literal (there is no `0Ns`).

Inside `select` and `update` expressions, `(nil? col)` lowers to the DAG
null-check opcode and returns a boolean per row, so it can be used directly in
`where:` predicates and projections.
`nil?` is element-wise: given a vector or a list it returns a `B8` vector with
one entry per element, so `(where (nil? v))` and `(sum (as 'I64 (nil? v)))`
work without a `map`. An atom answers for itself, and so does any other
container (a table or a dict is never null). Inside `select` and `update`
expressions, `(nil? col)` lowers to the DAG null-check opcode, which gives the
same per-row answer and can be used directly in `where:` predicates and
projections.

```lisp
(nil? [1 0N 3]) ; [false true false]
(nil? [a ' b]) ; [false true false] — the empty symbol is SYM's null
```

## Vectors

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/namespaces/time.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `.time.*` — clock and timers

Monotonic clock access plus a recurring-callback scheduler. Timers integrate into the runtime's poll loop — they only fire when control is back in `ray_poll_run`, i.e. between REPL inputs, between IPC requests, or while idling in server-only mode. A long-running synchronous evaluation will defer pending timers until it returns.
Monotonic clock access plus a recurring-callback scheduler. Timers integrate into the runtime's poll loop — they only fire when control is back in the loop, i.e. between REPL inputs (interactive or piped: both read stdin through the loop), between IPC requests, or while idling in server-only mode. A long-running synchronous evaluation will defer pending timers until it returns. A script, or a piped session that reached end of input, stays alive until its pending timers are spent, so a one-shot timer set by a script fires before the process exits; a periodic timer keeps it running until the script ends the process itself. An open client handle does not keep a script alive.

The clock is the same `CLOCK_MONOTONIC` source the scheduler uses for its deadlines, so `(.time.now)` is directly comparable to the `ms` argument passed to `.time.timer.set`. Wall-clock time is intentionally not exposed here: a host sleep / resume must not retroactively shift a scheduled deadline.

Expand Down
5 changes: 3 additions & 2 deletions docs/docs/reference/all-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ Type checking, casting, null testing, and object inspection.
|---|---|---|---|---|
| `type` | unary | — | Get the type name of a value | `(type 42)` → `i64` |
| `as` | binary | — | Cast value to another type | `(as 'i64 "42")` → `42` |
| `nil?` | unary | DAG in queries | Test if value is null; element-wise in query expressions | `(nil? 0Ni)` → `true` |
| `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)` |

Expand Down Expand Up @@ -726,7 +726,8 @@ TCP-based IPC for connecting to remote Rayforce instances. Uses binary serializa
| `.ipc.open` | variadic | restricted | Open TCP connection to host:port (optional connect timeout in ms), returns handle | `(.ipc.open "localhost:5000" 2000)` |
| `.ipc.close` | unary | restricted | Close an IPC connection handle | `(.ipc.close h)` |
| `.ipc.send` | binary | restricted | Send a value over an IPC handle (sync request) | `(.ipc.send h "(sum (til 100))")` |
| `.ipc.handle` | variadic | — | Current connection handle inside any `.ipc.on.*` hook, `-1` outside | `(.ipc.handle)` |
| `.ipc.handle` | variadic | — | Current connection handle inside any `.ipc.on.*` hook, `-1` outside; given a live connection handle, that connection's transmit-queue view (`limit_bytes`, `limit_frames`, `queued_bytes`, `queued_frames`, `hwm_bytes`) | `(.ipc.handle)`, `(.ipc.handle h)` |
| `.ipc.txlimit` | variadic | restricted | Transmit backlog policy: `()` reads the process default, `(bytes [frames])` sets it, `(h bytes frames)` overrides one connection; a frame that would exceed a connection's limit is refused and a multicast subscriber is dropped and closed | `(.ipc.txlimit 8388608 64)` |
| `.ipc.on.open` | hook | user-settable | Fires after inbound connection completes handshake; arg = handle | `(set .ipc.on.open (fn [h] ...))` |
| `.ipc.on.close` | hook | user-settable | Fires before inbound connection teardown; arg = handle | `(set .ipc.on.close (fn [h] ...))` |
| `.ipc.on.sync` | hook | user-settable | Intercepts sync messages; return value becomes the response | `(set .ipc.on.sync (fn [m] (eval (parse m))))` |
Expand Down
14 changes: 14 additions & 0 deletions docs/docs/storage/ipc.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ The query is assembled as data: while the `(list ...)` is built, `(quote price)`
!!! note "Message types"
`.ipc.send` uses synchronous messaging — it blocks until the server returns a result. For asynchronous (fire-and-forget) messaging, use `.ipc.post`, which sends without waiting for a response (the C equivalent is `ray_ipc_send_async`).

### .ipc.txlimit

Every connection queues outbound bytes the socket cannot take immediately (asynchronous `.ipc.post` sends and multicast fan-out). The queue is bounded per connection: a frame that would push the backlog past the limit is refused, and for a multicast subscriber that means it is dropped from the topic and closed, so a lagging consumer learns of the loss explicitly instead of silently missing updates.

```lisp
(.ipc.txlimit) ; {bytes:268435456 frames:0} — the process default
(.ipc.txlimit 8388608) ; 8 MiB per connection, frames unlimited
(.ipc.txlimit 8388608 64) ; at most 8 MiB or 64 queued frames, whichever first
(.ipc.txlimit h 67108864 0) ; one connection may hold 64 MiB
(.ipc.handle h) ; {handle limit_bytes limit_frames queued_bytes queued_frames hwm_bytes}
```

The default is 256 MiB with no frame cap; the minimum is 4 KiB, and `frames` of `0` means unlimited. Changing the default applies to every connection without an override, including ones already open. `.mc.stats` reports the default as `tx_limit_bytes` / `tx_limit_frames` and the largest backlog any connection has held as `tx_hwm_bytes`. `.ipc.txlimit` is restricted: it decides when a peer is dropped.

## Connection Hooks

The server side exposes the inbound connection lifecycle to Rayfall code through five user-installable lambdas under `.ipc.on.*` — `open`, `close`, `sync`, `async`, and `auth` — plus the `(.ipc.handle)` accessor that returns the current connection's handle inside any hook. See [IPC Connection Hooks](ipc-hooks.md) for the full reference: signatures, install / clear semantics, the reserved-namespace carve-out, per-hook error handling, and the restricted-mode interaction.
Expand Down
7 changes: 5 additions & 2 deletions docs/multicast-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ It does not yet provide durable replay, topic filters, wildcard topics, ACLs, pe
## API

```clj
(.mc.sub topic null) ;; subscribe the current IPC handle to topic
(.mc.sub topic) ;; subscribe the current IPC handle to topic
(.mc.sub topic null) ;; explicit no-filter form
(.mc.unsub topic) ;; unsubscribe the current IPC handle from topic
(.mc.pub topic payload) ;; publish payload to all current subscribers
(.mc.stats) ;; return aggregate multicast stats
Expand All @@ -30,16 +31,18 @@ It does not yet provide durable replay, topic filters, wildcard topics, ACLs, pe
`topic` can be a string or a symbol:

```clj
(.mc.sub "ticks")
(.mc.sub "ticks" null)
(.mc.sub 'ticks null)

(.mc.pub "ticks" 42)
(.mc.pub 'ticks (dict ['sym 'price] (list 'AAPL 185.5)))
```

Filters are reserved for later work. For now, pass `null`:
Filters are reserved for later work. For now, omit the filter or pass `null`:

```clj
(.mc.sub "ticks") ;; ok
(.mc.sub "ticks" null) ;; ok
(.mc.sub "ticks" 1) ;; nyi
```
Expand Down
9 changes: 8 additions & 1 deletion src/app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,14 @@ int main(int argc, char** argv) {
/* Load script if specified */
if (file) {
rc = ray_repl_run_file(file);
if (!interactive && !(port > 0)) goto done;
if (!interactive && !(port > 0)) {
/* A script that armed timers means to run them: stay until
* they are spent (a one-shot fires once, a periodic one until
* the script ends the process). Nothing else keeps a script
* alive — a client handle it left open is not a reason. */
if (poll) ray_poll_drain_timers(poll);
goto done;
}
}

/* REPL or pure server mode.
Expand Down
121 changes: 114 additions & 7 deletions src/app/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "app/term.h"
#include "core/ipc.h"
#include "core/poll.h"
#include "core/timer.h"
#include "core/pool.h"
#include "lang/env.h"
#include "lang/eval.h"
Expand All @@ -58,6 +59,7 @@
#define STDIN_FD 0
#else
#include <unistd.h>
#include <errno.h>
#include <sys/ioctl.h>
#define STDIN_FD STDIN_FILENO
#endif
Expand Down Expand Up @@ -1180,13 +1182,111 @@ static int32_t count_unmatched(const char* s, size_t len) {
return d > 0 ? d : 0;
}

/* ── Piped stdin, read through the poll loop ──────────────────────────
* fgets() on a pipe blocks outside the poll loop, so while a producer
* held the pipe open nothing else ran: no timer fired, no IPC request
* was served, until the writer closed (#493). The piped REPL now reads
* stdin through a small line reader: when it needs bytes and a poll
* exists, stdin is a registered selector whose read_fn pumps the pipe
* into the reader's buffer, and the reader waits in bounded poll passes
* — which fire due timers and serve every other selector. Without a
* poll it reads directly, as before. */
typedef struct {
ray_repl_t* repl;
char buf[PIPE_BUF_SIZE * 2];
size_t head, tail;
bool eof;
int64_t sel_id; /* -1 once deregistered (EOF) or never registered */
} pipe_rd_t;

static ray_t* piped_pump(ray_poll_t* poll, ray_selector_t* sel) {
pipe_rd_t* rd = (pipe_rd_t*)sel->data;
if (rd->tail >= sizeof(rd->buf)) return NULL; /* consumer drains first */
ssize_t n = read(STDIN_FD, rd->buf + rd->tail, sizeof(rd->buf) - rd->tail);
if (n > 0) { rd->tail += (size_t)n; return NULL; }
if (n < 0 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) return NULL;
rd->eof = true;
ray_poll_deregister(poll, sel->id); /* close_fn clears sel_id */
return NULL;
}

/* The poller deregisters a selector on hangup after serving its last
* readable event, without another read_fn call — a pipe's data and its
* hangup arrive in one event. Mark the reader so it stops waiting on
* the poll and drains whatever the pipe still holds with direct reads
* (which never block once the writer is gone). */
static void piped_closed(ray_poll_t* poll, ray_selector_t* sel) {
(void)poll;
pipe_rd_t* rd = (pipe_rd_t*)sel->data;
if (rd) rd->sel_id = -1;
}

/* fgets semantics over the reader: returns `line` holding up to size-1
* bytes including a trailing newline when one was seen, or NULL at EOF
* with nothing left. A line longer than size-1 comes back in pieces,
* exactly as fgets hands it out. */
static char* piped_fgets(pipe_rd_t* rd, char* line, size_t size) {
for (;;) {
size_t avail = rd->tail - rd->head;
size_t maxn = size - 1 < avail ? size - 1 : avail;
char* nl = maxn ? memchr(rd->buf + rd->head, '\n', maxn) : NULL;
if (nl) {
size_t n = (size_t)(nl - (rd->buf + rd->head)) + 1;
memcpy(line, rd->buf + rd->head, n); line[n] = '\0';
rd->head += n;
return line;
}
if (avail >= size - 1) {
memcpy(line, rd->buf + rd->head, size - 1); line[size - 1] = '\0';
rd->head += size - 1;
return line;
}
if (rd->eof) {
if (avail == 0) return NULL;
memcpy(line, rd->buf + rd->head, avail); line[avail] = '\0';
rd->head = rd->tail;
return line;
}
if (rd->head > 0) { /* compact, then refill */
memmove(rd->buf, rd->buf + rd->head, avail);
rd->head = 0; rd->tail = avail;
}
ray_poll_t* poll = rd->repl ? rd->repl->poll : NULL;
if (poll && rd->sel_id >= 0) {
if (ray_poll_run_for(poll, 1000) < 0 || poll->code >= 0) {
/* The loop was told to exit (an IPC hook, a callback):
* stop reading, let run_piped wind down. */
rd->eof = true;
}
} else {
ssize_t n = read(STDIN_FD, rd->buf + rd->tail, sizeof(rd->buf) - rd->tail);
if (n > 0) rd->tail += (size_t)n;
else if (n < 0 && errno == EINTR) continue;
else rd->eof = true;
}
}
}

static void run_piped(ray_repl_t* repl) {
char line[PIPE_BUF_SIZE];
char accum[PIPE_BUF_SIZE];
size_t accum_len = 0;
bool mid_line = false;

while (fgets(line, PIPE_BUF_SIZE, stdin)) {
pipe_rd_t rd = { .repl = repl, .head = 0, .tail = 0, .eof = false, .sel_id = -1 };
if (repl->poll) {
ray_poll_reg_t reg = {0};
reg.fd = STDIN_FD;
reg.type = RAY_SEL_STDIN;
reg.read_fn = piped_pump;
reg.close_fn = piped_closed;
reg.data = &rd;
rd.sel_id = ray_poll_register(repl->poll, &reg);
/* A registration failure (an fd the poller cannot watch) falls
* back to direct reads, exactly the old behaviour. */
}

while (piped_fgets(&rd, line, PIPE_BUF_SIZE)) {
size_t len = strlen(line);
bool had_newline = (len > 0 && line[len - 1] == '\n');
if (had_newline) line[--len] = '\0';
Expand Down Expand Up @@ -1226,7 +1326,7 @@ static void run_piped(ray_repl_t* repl) {
accum_len = 0;
mid_line = false;
while (!had_newline) {
if (!fgets(line, PIPE_BUF_SIZE, stdin)) break;
if (!piped_fgets(&rd, line, PIPE_BUF_SIZE)) break;
len = strlen(line);
had_newline = (len > 0 && line[len - 1] == '\n');
if (had_newline) {
Expand All @@ -1236,7 +1336,7 @@ static void run_piped(ray_repl_t* repl) {
depth += bracket_delta_s(line, len, &bs);
}
while (depth > 0) {
if (!fgets(line, PIPE_BUF_SIZE, stdin)) break;
if (!piped_fgets(&rd, line, PIPE_BUF_SIZE)) break;
len = strlen(line);
had_newline = (len > 0 && line[len - 1] == '\n');
if (had_newline) {
Expand All @@ -1245,7 +1345,7 @@ static void run_piped(ray_repl_t* repl) {
}
depth += bracket_delta_s(line, len, &bs);
while (!had_newline) {
if (!fgets(line, PIPE_BUF_SIZE, stdin)) break;
if (!piped_fgets(&rd, line, PIPE_BUF_SIZE)) break;
len = strlen(line);
had_newline = (len > 0 && line[len - 1] == '\n');
if (had_newline) {
Expand Down Expand Up @@ -1275,9 +1375,16 @@ static void run_piped(ray_repl_t* repl) {
eval_and_print(NULL, accum, false, repl->timeit);
}

/* If poll has registered selectors (IPC server), enter poll_run after stdin */
if (repl->poll && repl->poll->n_sels > 0)
ray_poll_run(repl->poll);
if (repl->poll) {
if (rd.sel_id >= 0) ray_poll_deregister(repl->poll, rd.sel_id);
/* After stdin: a listener or connections keep the process serving
* (as before, now counting live selectors rather than slots);
* with none, stay only until pending timers are spent. */
if (repl->poll->n_live > 0)
ray_poll_run(repl->poll);
else
ray_poll_drain_timers(repl->poll);
}
}

void ray_repl_run(ray_repl_t* repl) {
Expand Down
7 changes: 7 additions & 0 deletions src/core/epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ int64_t ray_poll_register(ray_poll_t* poll, ray_poll_reg_t* reg)
return -1;
}

poll->n_live++;
if (sel->open_fn) sel->open_fn(poll, sel);
return id;
}
Expand All @@ -186,6 +187,7 @@ void ray_poll_deregister(ray_poll_t* poll, int64_t id)
ray_poll_buf_free(sel->tx.buf);
ray_sys_free(sel);
poll->sels[id] = NULL;
if (poll->n_live > 0) poll->n_live--;
}

int64_t ray_poll_run_for(ray_poll_t* poll, int timeout_ms)
Expand All @@ -205,6 +207,11 @@ int64_t ray_poll_run_for(ray_poll_t* poll, int timeout_ms)
wait_ms = (int)remaining;
}

/* Nothing registered and nothing scheduled: an unbounded loop
* would block here forever. Return instead, so a process that
* stayed only for its timers can end once they are spent. */
if (!bounded && ray_poll_idle(poll)) return 0;

if (poll->timers) {
int64_t deadline = ray_timers_next_deadline_ms(
(ray_timers_t*)poll->timers);
Expand Down
Loading
Loading