Skip to content

v2.6.2 - #502

Merged
singaraiona merged 202 commits into
masterfrom
dev
Sep 9, 2026
Merged

v2.6.2#502
singaraiona merged 202 commits into
masterfrom
dev

Conversation

@singaraiona

Copy link
Copy Markdown
Collaborator

What & why

Checklist

  • PR targets dev (not master)
  • Commits follow Conventional Commits (feat: / fix: / perf: / docs: / …)
  • make builds cleanly (no new warnings)
  • make test passes; tests added/updated for behaviour changes

singaraiona and others added 30 commits July 11, 2026 10:44
Add immutable live-tail growth with explicit partition keys, shared FILE-domain symbol handling, atomic symbol rebinding, adversarial coverage, documentation, and a runnable rollover example.
fix(parse) Fix nonstring if not defined
In RAY_JOURNAL_SYNC mode ray_journal_write_bytes checks fsync's return on
POSIX and fails the write with RAY_ERR_IO, but the Windows branch ignored
FlushFileBuffers' return. A failed flush there was silently swallowed, so
SYNC mode reported success while the data may not have reached disk —
dropping the durability guarantee the mode exists to provide.

Check FlushFileBuffers (0 = failure) and return RAY_ERR_IO, mirroring the
POSIX path. Windows-only branch (not built on the Linux/macOS CI matrix),
so it is verified by inspection against the adjacent fsync check; the
failure path is not unit-testable, like the existing POSIX one.

Co-authored-by: Evgen Byelozorov <[email protected]>
ray_hnsw_build sized the copied vector block as n_nodes * dim *
sizeof(float) with no overflow check. Dimensions whose product wraps
size_t under-allocate the copy while the memcpy — and every later distance
read (vectors + id*dim) — run past the buffer. Guard the product before any
allocation, mirroring the per-layer neighbor guard in the loader, and
reject overflowing dimensions.

This hardens the public C API boundary; the in-tree (hnsw-build ...) path
sizes vectors from an in-memory list and cannot reach the overflow, so it
is defense-in-depth.

Add a regression test driving an overflowing n_nodes/dim pair; with the
guard removed it faults under ASan (stack-buffer-overflow at the copy).

Co-authored-by: Evgen Byelozorov <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
…334)

try_load_link_sidecar read the target table's sym name into a fixed
256-byte buffer (fread of 255 bytes). A name longer than 255 bytes was
silently truncated, so ray_sym_intern interned a DIFFERENT symbol and the
loaded column linked to the wrong table — silent data corruption on a
save/load round-trip. The writer already emits the full, untruncated name.

Read the whole sidecar into a buffer sized to the file (capped at 1 MiB to
bound a corrupt/oversized file), and reject a short read (fread returning
fewer bytes than the file size — an I/O error or a race-truncated sidecar)
so a partial name can't be interned as a different symbol either.

Add a regression test that links through a 300-byte target name and asserts
the loaded link_target matches; it fails without the fix.

Co-authored-by: Evgen Byelozorov <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
hnsw_load_impl read n_nodes and dim straight from the file header and
sized the vectors allocation as n_nodes * dim * sizeof(float) with no
overflow check. A crafted header could make that product wrap size_t, so
ray_sys_alloc under-allocated the buffer while the following fread still
read the full (large) element count and wrote past the allocation — a
heap-overflow write driven by an untrusted index file.

Factor the check into ray_hnsw_vec_size_valid(n_nodes, dim) and reject the
header before any allocation, mirroring the per-layer neighbor guard.

Add a unit test that drives the helper directly (ordinary dims, non-positive
dims, an overflowing pair, and the exact size_t boundary). It is tested at
the helper rather than through ray_hnsw_load because an overflow-patched
header is refused earlier — the huge node-level read fails first — so a
full-load test could not distinguish the guard.

Co-authored-by: Evgen Byelozorov <[email protected]>
Escalate F-0002, F-0003, F-0004, and F-0006 into CF-0001 through CF-0004 after the required corpus census.
Rebuild the MkDocs and marketing surfaces around the Rayforce brand, add the live market demo and cloud preview, unify responsive navigation, and eliminate reload layout shifts.
* fix(null): avoid f64 null casts to integers

* fix(expr): guard f64 to i64 fallback casts

* fix(null): clamp finite f64 narrow casts

---------

Co-authored-by: Evgen Byelozorov <[email protected]>
* fix(expr): avoid null truthiness casts in fallback binary ops

binary_range's fallback OP_AND/OP_OR kernels cast the widened `double`
operand straight to `uint8_t`:

    uint8_t li = (uint8_t)LV_READ(i);

`LV_READ` widens integer operands to `double` and yields NaN for float
nulls, so this had two defects:
  - Wrong answers from 8-bit truncation: `(uint8_t)256.0 == 0`, so
    `256 and 1b` returned false.
  - Undefined behavior: casting NaN (NULL_F64) or a widened NULL_I64
    (-9.2e18) to `uint8_t` is UB per C11 6.3.1.4.
UBSan flagged the latter via expr_null/diff_i64_{and,or}_raw and
expr_null/diff_f64_andor_chokes.

Route AND/OR through two truthiness helpers that compare on the widened
double and never cast it back to an integer:
  - truthy_intish(v, nullv) — false for 0 and for the operand's null
    sentinel. The fallback reads raw column memory, so a null arrives as
    the per-type sentinel widened to double (NULL_I16 / NULL_I32 /
    NULL_I64, with DATE/TIME stored as I32) rather than the NULL_I64 the
    VM kernel sees; `nullv` is derived per operand from the bound pointer
    type so I16/I32 nulls read as false, not just I64.
  - truthy_f64ish(v) — false for 0.0 and NaN (float null).

Non-null truthiness is unchanged and null-input positions still agree
with the VM kernel (documented "AND/OR with any null operand -> 0" and
the fix_null_comparisons post-pass), keeping fallback ≡ fused.

Add regression tests pinning fallback ≡ fused for nullable I64, I32 and
I16 AND/OR operands (expr_null/diff_i{64,32,16}_{and,or}_raw).

* fix(expr): preserve near-sentinel i64 truthiness

---------

Co-authored-by: Evgen Byelozorov <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
…l semantics (#341)

* wip(group): parallel binary aggregates (pearson/wavg/cov) via DA path

Route binary co-moment aggregators through the dense-array (DA) group path
instead of the hash scatter path.  Adds sum_y/sumsq_y/sumxy co-moment slots
to da_accum_t + per-row accumulation + per-worker merge; emit_agg_columns
already finalises PEARSON/COV/WAVG/WSUM from the co-moments.

Fixes poor multi-thread scaling of by-key binary aggregates (was ~2x, DA
path scales ~9-12x like stddev).  Verified vs numpy; diff comparator relaxed
to 1e-9 combined abs+rel (1e-12 absolute tested bit-identical summation).

Includes temporary RAY_GRPPROF phase instrumentation (to remove).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(group): merge binary-agg Sx as double for integer x-columns

wavg/pearson accumulate Sx as double even when the x column is integer
(e.g. wavg(bsize,bid), bsize=I32).  The per-worker merge dispatched on the
x-column type -> read the double bits as int64 -> garbage at >1 worker.
Force float merge for binary aggs at all 3 sum-merge sites.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(group): merge binary-agg co-moments in parallel da_merge_fn path

The parallel slot-range merge (da_merge_fn, taken when n_slots>=1024)
merged sumsq but not the binary-aggregate co-moment arrays
(sum_y/sumsq_y/sumxy).  Multi-key pearson/cov/wavg over >=1024 dense
slots produced wrong results at >1 worker.  Add the DA_NEED_PAIR merge.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(group): remove temporary RAY_NO_V2/RAY_GRPPROF instrumentation

The binary-agg DA fix lands on the default path (v2 declines CHAR-keyed
binary group-bys -> legacy DA), so the debug env overrides are no longer
needed.  3635/3635 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* perf(if): parallel elementwise OP_IF fill; route trivial-branch if to eager

exec_if always took the 'selected' lazy-branch path, whose scaffolding
(true-count, id-list build, per-branch gather, scatter) is serial over
ALL rows — every if-projection ran at single-core speed regardless of -c
(100M numeric if: 2.2s at any core count).

1. exec_if_eager: one shared fixed-width elementwise fill, dispatched
   across the worker pool for len >= 64K (SYM sides warm their runtime-id
   LUT serially first — sym.c frozen-table rule, mirrors window.c).
   STR keeps the serial append path.
2. exec_if_selected: bail to eager when both branches are trivial (column
   scan / scalar const) and eager fills the type combination correctly —
   the lazy path only pays off when a branch is an expression worth
   restricting to its passing rows.  Mixed numeric/string shapes stay on
   the selected path (its per-value string conversion).

100M rows local c24: numeric if 1883->310ms, sym if 2012->306ms.
dazzle c48 canonical Q22: 2658->1333ms end-to-end.
make test 3635/3635.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* perf(filter): parallel bitmap->index build in exec_filter and sel_compact

exec_filter ran two sequential 0..nrows sweeps (pass-count and
match_idx build) before its parallel gather; sel_compact rebuilt
match_idx from the rowsel serially.  Both now use the classic 3-phase
compaction: parallel per-chunk/per-seg counts, tiny serial prefix,
parallel fill at disjoint offsets.  Lazy/morsel-backed predicates keep
the sequential sweep.

100M rows local c24: 2-col where-select 143->21.7ms (1.4x -> 6.6x
scaling); if+where 1040->324ms.  make test 3635/3635.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* perf: parallel where builtin, gather_by_idx, and chunk-task dispatch

- ray_where_fn: 3-phase chunk compaction on the pool (was fully serial).
- gather_by_idx: fixed-width value gathers dispatched over disjoint
  output ranges (null-bit propagation stays serial - shared-word bit
  writes would race).
- exec_filter/where chunk phases now use ray_pool_dispatch_n (one task
  per chunk); ray_pool_dispatch morselizes total_elems by 1024, so
  passing chunk counts gave only ~2 tasks for 100M rows.

100M rows local c24: where 88->25ms, at-gather 80->31ms,
2-col where-select 138->20ms (6.8x).  make test 3635/3635.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(review): harden parallel paths per skeptic review

Blockers (DA binary-agg y-column):
- eligibility now requires a plain numeric/temporal y; nullable
  integer/temporal y stays on the HT path (da_accum_row's pair branch
  has no y-side sentinel machinery - nulls would accumulate as values)
- an FP y with HAS_NULLS sets da_any_nullable so nn[] is allocated and
  the emitter divides by the non-null PAIR count, not the group count

Majors:
- all new parallel gates require pool->n_workers > 0 (a -c 1 pool
  exists with 0 workers; ring fill + atomics + rc_sync were pure
  overhead, and the OP_IF eager reroute lost to the selected path
  serially - the Q22/Q25 c1 regression)
- chunked dispatch_n call sites cap chunks at 1024 = the pool's
  initial ring capacity, so the ring never grows (dispatch_n clamps
  and silently DROPS tasks if ring growth fails -> uninitialized
  prefix entries -> OOB writes)
- sel_compact seg fill switched to dispatch_n over seg-chunks
  (ray_pool_dispatch over segs gave 1 task under 8.4M rows)
- gather_by_idx parallel path guarded by ray_parallel_flag == 0
  (leaf utility, 35+ call sites; nested dispatch would corrupt the
  single-producer task ring)

Nits: stray time.h include, restored v2-gate comment,
RAY_PARALLEL_THRESHOLD symbol in pivot.c.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(group): pair-skip y-side nulls in the legacy HT binary-agg path

Unify grouped binary-aggregate (pearson/cov/scov/wsum/wavg) null handling
with the scalar reducers, the v2 engine and the DA path: a null on either
side of the (x,y) pair now voids the whole pair on the legacy HT route too.

- ght_compute_layout: a nullable y-side sets GHT_AF2_Y_NULLABLE and routes
  the layout to the null-aware accumulators.
- accum_from_entry_nullable: pair-skip before nn++/sums.
- Entry packing canonicalizes integer nulls so the accumulator can see
  them: NaN in F64-packed slots (a (double)sentinel cast previously read
  as a huge finite value — this also fixes nullable-int x beside an FP y),
  NULL_I64 in int-by-int slots.
- Both HT emitters (radix + serial) divided pearson/cov/scov moments by
  the group row count instead of the accumulated pair count — wrong
  results whenever a group carried any null; now divide by nn.
- The all-null-group guards wrote v=0.0 after ray_vec_set_null, so the
  common store overwrote the null sentinel — emit NULL_F64 instead.
- DA eligibility now also rejects a y shorter than the scan (OP_CONST
  vector literal would read out of bounds).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZwH1gpAeLzDX2bxc4jz6s

* test(agg): cross-path null coverage for grouped binary aggregates

46 assertions for wsum/wavg/pearson_corr/cov/scov over nullable inputs on
all three grouped routes — v2 (plain-scan int key), DA (expression int
key), legacy HT (expression key + nullable-int y; F64-packed and
int-packed entry lanes) — against independently computed pair-skip truth,
for all four x/y type combinations, plus an all-pairs-null group
(wsum 0.0, typed nulls for the ratio/moment aggs) on every route.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZwH1gpAeLzDX2bxc4jz6s

* chore(review): shared dispatch-safety gate; single filter threshold

- ops/internal.h ray_par_dispatch_ok(): workers + RAY_PARALLEL_THRESHOLD +
  ray_parallel_flag reentrancy check in one place; applied at exec_filter,
  sel_compact, exec_if_eager and the where builtin (local copy there —
  builtins.c cannot include ops/internal.h).
- exec_filter: gate and table fallback derive from one row count
  (fidx_rows); note that pass_count from the parallel count phase is
  consumed by exec_filter_vec for vector inputs.
- group.c: drop the never-read da_ctx_t.agg_pair_mask plumbing.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZwH1gpAeLzDX2bxc4jz6s

* chore(par): shared dispatch predicate, ring-cap constant, parallel-path test

Follow-ups from the audit's non-blocking notes:

- core/pool.h ray_pool_par_dispatch_ok(pool, n, min_elems): the single
  home for the dispatch-safety predicate (workers + element threshold +
  ray_parallel_flag reentrancy).  The three hand-copies in ops/internal.h,
  lang/eval.c and ops/builtins.c are gone; all six gates call the shared
  one.
- RAY_POOL_INIT_TASKS in core/pool.h replaces the hardcoded 1024 at the
  three dispatch_n chunk caps and in ray_pool_create, with a
  _Static_assert tying it to RAY_POOL_MAX_TASKS — lowering the initial
  ring capacity can no longer silently desync from the caps that rely
  on it.
- test/rfl/query/parallel_paths_large.rfl: 200k-row coverage of every
  new pool-parallel branch (where, gather-by-index, exec_filter,
  sel_compact, OP_IF numeric and SYM fill incl. the serial LUT warm-up)
  against closed-form expected values.
- RAY_F32 dropped from if_type_eager_ok's whitelist (if_fill_range has
  no F32 case; unreachable today, kept unreachable deliberately).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JZwH1gpAeLzDX2bxc4jz6s

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
binary_range's OP_IDIV kernels for narrow integer output (I64/I32/I16/U8)
computed `(intN_t)floor(lv/rv)` guarded only by `rv != 0.0`. That guard
does not catch a NaN operand (`NaN != 0.0` is true), so a null float input
yields `lv/rv == NaN`, `floor(NaN) == NaN`, and the subsequent cast to an
integer type is undefined behavior — UBSan: "nan is outside the range of
representable values of type 'long long'" at exec/expr_binary_f64_idiv_mod.

Route the cast through the ray_cast_f64_to_{i64,i32,i16,u8}_null helpers,
which map NaN to the canonical null sentinel (NULL_I64/I32/I16, 0 for the
non-nullable U8) and saturate out-of-range finite results. The null
post-pass (propagate_nulls_binary) already overwrites these positions, so
final values are unchanged — this only removes the UB and yields the
correct sentinel in-buffer. Mirrors the already-safe F64-output IDIV arm
(ray_f64_fin) and the sibling casts fixed in "avoid f64 null casts to
integers"; depends on those helpers.

Co-authored-by: Evgen Byelozorov <[email protected]>
Co-authored-by: Evgen Byelozorov <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
belowzeroff and others added 26 commits September 3, 2026 12:52
* fix(ipc): restrict server-state mutators under -U restricted IPC

A -U (restricted) IPC client's evals run with __VM->restricted set, and
fn_is_restricted only blocks builtins that carry RAY_FN_RESTRICTED. Six
builtins that mutate or destroy server-side state were registered
without it, so a restricted client could escalate past read-only:

- rule         register a global Datalog rule              (#44)
- dl-add-edb   add an EDB relation to a program            (#49)
- dl-free      free a Datalog program handle               (#48)
- .graph.free  free a server graph handle                  (#46)
- hnsw-free    free a server HNSW index handle             (#47)
- .log.write   persist WAL work that replays unrestricted  (#41)

Add RAY_FN_RESTRICTED to each (rule keeps SPECIAL_FORM, matching how
`set` is registered). This only gates evaluation while __VM->restricted
is set, so trusted local eval, startup scripts, and WAL replay are
unaffected. The flag was already present on siblings such as hnsw-save/
hnsw-load and the rest of the .log.* family; this closes the gaps.

Test: lang/eval/restricted_server_state_ops asserts each verb returns an
`access` error under restricted eval, and that dl-free still reaches its
body (a non-access failure) in normal mode so the gate is scoped, not a
blanket ban.

* fix(ipc): restrict remaining server-state mutators
Since the empty symbol and empty string became their types' canonical
nulls, the store carries RAY_ATTR_HAS_NULLS for them across a save, so
every mapped partition holding one blank SYM/STR cell arrives at the
parted-insert validator with the bit set. parted_segment_attrs_valid
allowed HAS_NULLS only for the numeric, temporal and GUID bases, so a
live insert into any such day was refused as `corrupt` — the day's
second batch after a first batch with a blank, or the first insert
into a reopened day saved with a blank.

SYM/STR nulls are in-band (the payload is unchanged by the bit), so
the validator now admits HAS_NULLS for RAY_SYM and RAY_STR too.

Fixes #465

Claude-Session: https://claude.ai/code/session_01XbNM4pZe3wCS7V1m5zUUSW
A multi-key `select ... by:` whose keys include a null STR (or GUID) key
stopped folding equal rows after the hash table's first growth: every
phase-1 key builder stores a null key as a zeroed slot plus a null-mask
bit and hashes it as ray_hash_i64(0), but hash_keys_inline (rehash,
lookup, partial-table merge) read the stored slot back by type — a
zeroed inline-STR descriptor hashed as the empty string, a zeroed wide
GUID slot as source row 0. After the rehash the group sat under a hash
no probe computes, so each later equal row opened a fresh group.

hash_keys_inline now consults the null-mask word first and hashes a
null key as ray_hash_i64(0) whatever its type, in both the inline-STR
and the generic layout. The packed layout already hashed the whole
region (values + mask) on both sides and is unchanged.

Fixes #466

Claude-Session: https://claude.ai/code/session_01XbNM4pZe3wCS7V1m5zUUSW
* feat(ipc): add multicast fan-out

* docs(ipc): neutralize multicast migration wording

* fix(mcast): address pr review feedback

* fix(mcast): defer failed subscriber close

* test(mcast): cover failed send close ordering

* fix(ipc): queue nonblocking multicast writes

* fix(ipc): drain queued multicast frame before a direct write

The nonblocking multicast path parks a half-sent frame on sel->tx.buf and
finishes it from the poll layer's write-readiness handler. But every other
writer on that fd — the sync RESP reply (send_response), sync_send, and
ray_ipc_send_async — wrote straight through ray_sock_send without consulting
the queue. A subscriber whose large upd frame was still queued could issue any
sync request; the server spliced the RESP into the middle of the pending frame
and the peer parsed the two framings into each other, corrupting the stream for
that connection.

Add conn_tx_drain_blocking() and call it before each direct write: it flushes
the queued remainder to the wire (blocking on write-readiness the way
ray_sock_send already does) so the following write starts on a frame boundary.
It fast-paths to a no-op when nothing is queued, so non-subscriber connections
are unaffected.

Test: mcast/sync_reply_after_queued issues a sync ping from a subscriber while
its ~800 KB frame is still parked on tx.buf (4 KB SO_SNDBUF) and asserts the
reply is a clean 42 and the payload arrives whole -- the existing large-payload
test drained the queue before pinging, so it never exercised the interleave.
…es (#476)

* perf(query): upsert writes matched rows in place and applies a batch in one pass

ray_upsert found the target row with a linear key scan and rebuilt the
whole table to write one cell, per payload row: a named-table upsert
cost O(rows present) per row, a 1000-row batch was 1000 scans and 1000
rebuilds, and an attached .idx.hash on the key column was never
consulted.  Maintaining last-value-per-key state (a current book, a
current quote) therefore paid the size of the state on every update.

Upsert now runs one pass per call.  When the binding is the sole owner
the live columns are mutated: a matched row has its cells overwritten in
place (boxed pointer swap, ray_str_vec_set, or append_atom_to_col plus a
tail move so coercion and null encoding stay in one place), and a new
key appends amortized like insert's #455 path.  A batch resolves its
keys through one hash over the target built once per call, entering
appended rows as they land so a key repeated inside the batch updates
the row its first occurrence created.  A single-row call consults a
fresh hash index on a lone key column and otherwise runs one typed
scan.  A value target, or a shared table or column, gets one copy of the
columns and the same pass on the copy.  Every cell is type-checked
before anything is written; a mistyped payload leaves the table
untouched, and a vector-row whose columns differ in length is now a
`length` error instead of an out-of-bounds read.  Any gate miss falls
through to the previous arms.

Boxed LIST columns, which the rebuild arm rejected on update, are
handled.  The table-payload gather no longer caps at 64 columns.

Release build, the issue's reproducer: 1000 upserts into a 40k-row
table 432 ms -> 1 ms, the same rows as one batch 428 ms -> 1 ms.

Fixes #475

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg

* perf(query): update with where writes matched rows of a named table in place

The WHERE arm of ray_update evaluated the predicate and every update
expression over the whole table, then rebuilt each updated column cell
by cell through ray_vec_append, so a keyed update into a named table
cost O(rows present) per call with a large constant, and a hash index
on the key column was never consulted: 1000 single-row updates into a
40k-row table took 1.4 s, indexed or not.

When the binding is the sole owner, update now resolves the matched
rows first — through a fresh .idx.hash on the column when the predicate
is a plain `(== col value)`, otherwise through the same mask the legacy
arm computes — gathers those rows into a sub-table, evaluates the
update expressions there, and scatters the results into the live
columns in place, dropping any index on a written column.  Expressions
containing an aggregate, or a call whose head is not a plain symbol,
keep the legacy arm so the aggregate still ranges over the whole table.
Every value is type-checked before anything is written; a wrong-length
vector is now a `length` error instead of an out-of-bounds read, and a
symbol atom can be written into a boxed column through a where clause.

Release build, 1000 single-row keyed updates into 40k rows:
1447 ms -> 113 ms unindexed, 1482 ms -> 33 ms with .idx.hash on the
key column (flat from 40k to 160k rows).

Part of #475

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg

* fix(query): cast update scatter writes from the payload pointer

cppcheck (portability, invalidPointerCast) flagged the numeric
promotion branch of update_scatter for casting a uint8_t* byte pointer
to double*.  Take the typed pointers from ray_data() directly.

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg

* fix(query): keep whole-table semantics for non-elementwise where-updates

The in-place where-update evaluated any expression without an
aggregate over the sub-table of matched rows, which changed the meaning
of order-dependent functions (deltas, sums, ...) and of free variables
holding table-length vectors, and only for the named-target spelling.
The gate now admits only elementwise expressions: a head that resolves
to a builtin flagged RAY_FN_ATOMIC over columns, literals, quoted
symbols and such calls.  Everything else, and a predicate matching no
row, keeps the legacy arm, so both spellings of `from:` agree; the
tests pin deltas, sums, a global vector, `if` and an aggregate.

Also release the extra reference when ray_cow fails on upsert's copy
path.

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…l kernel (#469)

* fix(query): count a null as one distinct value in the grouped parallel kernel

`select {d: (count (distinct v)) by: k}` answered differently depending on the
core count: the parallel per-group kernel skipped null cells outright, while the
serial fallback — and the ungrouped builtin, and the rule pinned in
test/rfl/null/distinct.rfl — keep at most one null and count it. The kernel runs
when there are at least two workers and four groups, so the default multi-core
run was the one giving the wrong answer, silently and with no error.

The kernel already had the shape this needed. Its hash table encodes an empty
slot as 0, so the literal 0 cannot live in the table and rides a side flag
instead. A null has the same problem for the same reason, so it now rides its
own flag beside it: seen once, counted once, however many rows carry it. The
loops that run when a column has no nulls are untouched, and on a null-bearing
column the work replaces a `continue` — so nothing is added to the hot path.

This also settles an inconsistency between types. A SYM null is id 0, so it was
already being counted, by accident, through the zero flag; numeric and temporal
nulls were being dropped. Both now follow the same rule.

The comment above the kernel claimed null-bearing columns fall through to the
serial path. No such gate exists — the kernel handles them itself, which is how
this arose. Corrected to describe what the code does.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* test(null): pin the null rule through a grouped count, not only the builtin

The file already stated that distinct keeps at most one null, and the builtin
obeyed it — but the grouped parallel kernel is a separate implementation of the
same rule and had drifted, which is how it shipped dropping nulls.

The four shapes here reach that kernel: it is selected only with at least two
workers and four groups, and the suite runs with TEST_CORES=2, so four groups
is what each one has. They cover the integer arm, a group that is entirely
null, the F64 arm, and the SYM arm — the last because a SYM null is the empty
symbol, which the table already handled through the flag it keeps for the
literal 0, so the two need pinning together or they drift apart again.

On the parent commit the first case fails with [1 1 2 1] against [2 2 3 2] —
one null lost per group.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(group): count a null once on the large-group route too, and drop the flag

Review found the first commit closed one of three kernels. Above 50000 groups
the query leaves query.c entirely for ray_count_distinct_per_group in group.c,
whose serial and partitioned loops still skipped nulls — so the answer stopped
depending on the core count and started depending on the group count instead.
Measured on dev: the same data gives 2 per group below the boundary and 1
above it, and a column that is entirely null gives 1 below and 0 above.

Both group.c loops simply stop skipping. Nothing else was needed: cdpg_read
already folds every NaN payload to one canonical NaN, the integer sentinels
are INT_MIN and hash as ordinary keys, a SYM null is id 0, and the dedup table
marks an empty slot in its gid field — offset by one — so a null value cannot
collide with it. cdpg_is_null had no callers left and is gone.

The same reasoning removes the flag the first commit added to query.c. For the
integer widths the sentinel was always an ordinary key, so the plain insert
loop counts a null once by itself; only F64 needed anything, and canonicalising
the NaN there — exactly what cdpg_read does — is enough. That deletes
saw_null, CDPG_BUF_NULL, the three has-nulls loop bodies and the has_nulls
local, leaving the kernel shorter than before this branch started.

count_distinct_extras.rfl pinned the old behaviour as intentional, calling it
a per-group-vs-scalar difference. It was not deliberate enough to survive: the
three kernels did not agree with each other, so the difference was really three
differences. The block now states the single rule and its arithmetic is
recomputed — three groups holding a null go from 1 to 2, so the total goes
from 59996 to 59999, for the integer and the float layout alike.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(group): cover the partitioned kernel and drop what the change left behind

The partitioned loops in group.c lost their null skip in the previous commit,
and nothing tested them: that path needs 200000 rows as well as 50000 groups,
and every case added so far stopped at the serial loop. Four cases now cross
both boundaries, one per arm — integer, all-null, F64 and SYM — since the
partitioned kernel handles those separately. On the parent they answer 1 and
0 where they should answer 2 and 1.

Removed as dead: the has_nulls field in both contexts, written and never read;
the esz in cdpg_hist_fn, computed only to be discarded; the doc comment of the
deleted cdpg_is_null, left stranded above cdpg_read.

The has-nulls arm of ray_count_distinct_per_group computed the same keys as
the typed loops beside it, through a per-row read_col_i64 dispatch. The typed
loops run unconditionally now.

The NaN and -0.0 fold moves to canon_f64_key in internal.h. Three kernels
decide a count-distinct depending on the row and group counts, and they have
to key a value identically or the answer follows the shape of the data — that
now holds because they call one function rather than because four copies were
kept in step by hand.

Two comments corrected: the one above the parallel context claimed a null
rides the zero flag, which is true of SYM only and contradicted the arms
below it, and a test still cited line numbers that no longer point anywhere.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
#480)

Same race 069c27a removed from workers_participate: the test asserted
bit 0 of saw_worker ("main thread always = worker 0") while conceding
that worker 1's participation depends on scheduling.  With one worker
and three tasks the worker can drain all three before main enters its
claim loop, leaving bit 0 unset — observed on the macOS debug job of
#477, a change that does not touch the pool.  Completion is asserted
exactly; assert only that some participant recorded itself.

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…lback's message (#479)

A forever timer was re-pushed with exp_ms += tic_ms and the firing loop
ran while heap[0]->exp_ms <= now, refreshing now after each callback.  A
callback that overran its period by T therefore left the timer T/tic
deadlines in the past, and the loop fired it that many times back to
back — each a full callback — before the poll loop reached epoll_wait
again, so the process served no accept, handshake or request for the
whole storm.

The timer now re-arms at its next scheduled deadline, or one period
from now when that deadline has already passed: exact cadence while
callbacks are cheap, at most one fire per period when they are not, and
missed intervals are skipped rather than replayed.  A one-shot timer is
unaffected.

The error arm printed ray_fmt(err), which renders an error as its code
alone (`timer 0: error: io`).  It now prints the code and the message
from the runtime's last-error slot, the same line the REPL prints.

Fixes #474

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…t a listener (#478)

When ray_ipc_listen_at failed, main printed `failed to listen on
HOST:PORT: ...` and carried on: it loaded the script, ran it, and either
exited 0 (no selector registered, so the poll loop was never entered) or
kept running the script's timers with no listener.  A supervisor that
asked for a server got a process that was not one, with a zero exit
code, and learned of it from the first client's ECONNREFUSED.

A -p that cannot bind is now fatal: the diagnostic is printed, the
script is not run, and the process exits 1 through the normal teardown.

Fixes #473

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…ed" (#477)

ray_ipc_connect budgets the TCP connect and the two-byte wire handshake
together: ray_sock_connect installs the budget as SO_RCVTIMEO/SO_SNDTIMEO
once the connect completes.  A connect that timed out returned -5, but a
handshake send or recv that hit the budget returned the generic -1, and
.ipc.open printed that as "connection refused" — byte-identical to a
dead port, which fails instantly.  A server that is alive and listening
but inside a long evaluation (a timer callback, a large query) hits
exactly this: the kernel completes the TCP handshake into the backlog
and nobody answers the wire handshake within the budget.

Failed steps are now classified by errno: ETIMEDOUT / EAGAIN /
EWOULDBLOCK -> "connection timed out", ECONNREFUSED -> "connection
refused", anything else -> "connect failed: HOST:PORT: <strerror>", and
a wire-version mismatch names itself instead of reading as refused.  A
peer that closes mid-handshake sets ECONNRESET so an EOF cannot inherit
a stale EAGAIN, and an unresolvable host sets EHOSTUNREACH rather than
whatever errno was left behind.  The default budget is unchanged.

Fixes #472

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…#471)

* fix(pivot): keep a temporal type when both branches of an if share it

`(if x ts ts2)` over two TIMESTAMP columns answered TIMESTAMP when the pool
had workers and I64 when it had none — and DATE and TIME degraded to I32 the
same way. Nothing about the values changed; only the type the result claimed.

An `if` selects a value, it does not compute one, so two branches of one
temporal type yield that type. The graph says as much: promote_if_type puts
that case ahead of the general numeric widening, which folds a temporal down
to its integer storage because that is right for arithmetic — a difference of
two timestamps is a span, not an instant.

exec_if has two arms. The eager one runs when workers exist and takes the
node's type as given. The selected one runs otherwise, and re-derives the
type from the values it actually materialised — its ladder had no case for
two matching temporals, so it read them as storage. That re-derivation is
not redundant and is left alone: it narrows F64 to I64 when the float branch
supplied no rows, which the static type cannot know. Only the temporal case
is brought into line, so the two arms agree where they must and the narrowing
survives where it earns its keep.

Branches of different temporal types are untouched — there is no shared
meaning to keep, so widening remains correct.

The predicate is a third copy of one that is file-local in graph.c and
duplicated again in query.c, where it also unwraps parted types. Noted rather
than unified: sharing it is a change of a different shape.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(pivot): let the selected arm of an if answer as the eager one would

Review found the first attempt fixed too little and tested nothing.

Too little: aligning the ladder's temporal case left the answer worker-
dependent whenever a branch supplies no rows. `if_eval_branch` returns NULL
for an empty branch, and the shortcut that adopts the other side ran ahead of
the new rule, so with an all-true condition `(if x ts 5)` was TIMESTAMP
serially and I64 under workers; `(if x ts 5.5)` TIMESTAMP against F64;
`(if x d ts)` DATE against I64 — which also flipped the boundary case the
first attempt had just pinned.

Tested nothing: both branches in those cases were bare column reads, so under
the harness default the eager arm answered and the code being fixed was never
reached. The file passed unchanged on the parent commit.

The rule is not about which types to promote. It is that where the eager arm
could have handled the node, the selected arm has to give its answer — and
where it could not, the selected arm is the only one there is and may report
what the rows actually hold. That condition already existed in the dispatch
gate: a non-STR output whose branches are both trivial and elementwise-
fillable. It is now a named value, used to decide the type as well as the
dispatch.

So the second promotion ladder goes, and the temporal predicate that came
with it — which was a fourth hand-maintained copy of a set that graph.c,
query.c and lang/internal.h already carry in versions that are not identical.
What remains is: trust the graph, except for a branch that produced no rows
in a node the eager arm was never going to take, where the surviving type
stands. That is what keeps `(if (> v 0) v (sqrt s))` summing to 15 rather
than 15.0, and what keeps a numeric value in a STR-typed if from rendering as
an empty string.

The tests use a nested if as the branch, so the eager arm is out of the
picture at any core count and the case fails on the parent under workers, not
only serially. The empty-branch cases keep their trivial branches on purpose:
there the eager arm is a candidate, so its answer is the required one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(pivot,graph): three more ways an if reported the wrong type

All in the same type derivation as the previous commit, and found because the
review asked whether other types were affected — I had answered no on the
strength of a sweep that only ever used in-memory tables.

**A column of a parted table.** Its type is carried in a wrapper, and the
promotion ladder in graph.c has no notion of one: a wrapped type matches none
of its cases and falls out the bottom as RAY_BOOL. `(if true ts ts)` over a
parted table claimed B8 and truncated every value to a byte, and printing the
column aborted under UBSan. Not only temporal — a plain I64 column did the
same. promote_if_type now unwraps to the base type, as query.c's
dag_type_is_temporal already does; the result of an if is a materialised
vector, never a parted column, so the base type is what it should carry.

A side effect worth knowing: `(+ (if true ts ts) 1)` now raises a type error
instead of returning truncated numbers. Timestamp arithmetic over a parted
table was already an error — the B8 collapse was hiding it.

**A null branch value.** An atom null is the sentinel and carries no attribute
of its own, so nothing marked the output as null-bearing and the formatter,
which reads the attribute rather than the value, rendered the sentinel as an
ordinary date. Both arms set the attribute now.

**A string literal against a SYM column** answered SYM at runtime against a
static STR. Closed by the previous commit rather than here: with both branches
producing values the declared type is returned, so runtime and static can no
longer differ.

On the tests: the first drafts of two of these passed on the parent commit.
`nil?` reads the value, so it says true with or without the attribute — only
rendering the whole vector shows the difference. And a parted case needs a
literal condition and two partitions, or the branch types arrive unwrapped
anyway. Both requirements are written down beside the cases, so they are not
quietly relaxed later.

Verified against an in-memory table of the same rows: the parted table now
answers identically, type and values, at both core counts. 242 type-pair
combinations with an all-true and an all-false condition agree between modes —
either branch can be the empty one, and the narrowing looks at whichever
survived.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* fix(pivot,graph): stop the declared type from narrowing a widened value

Trusting op->out_type outright truncated data. The graph promotes the
declared types of the branch expressions, but arithmetic widens past them:
(* a a) over an I32 column is computed and stored as I64, so calling the
result I32 rewrote 10000000000 as 1410065408, and I16 60000 as -5536. The
declared type is a floor now — whichever of it and the materialised values
is wider wins.

Narrowing survives only where the declared type came from the branch that
supplied no rows: a float branch that never ran, leaving integers that keep
their width, or a string branch that never ran, leaving a number that would
otherwise be written into a string column and read back as empty. Two
temporal branches promote to I64 because of the pair rather than either one,
so handing the answer to the survivor made a nested-if branch report DATE
where the same expression with a bare column reported I64.

The parted wrapper is stripped at the scan node instead of inside
promote_if_type. Nothing that reads a node's out_type knows about wrappers,
so the narrow unwrap left two holes: promote() for + - * % still saw a
wrapped operand and yielded RAY_BOOL, and the SYM override in ray_if
compares against a bare RAY_SYM, so a parted SYM column came back as
dictionary ids. The executor decides how to read a parted column from the
column, never from the node, so the wrapper has no reader here.

Also in this path: a null atom now stays null across widths, so (if c f 0N)
over an F64 column writes the F64 null rather than the I64 sentinel read as
-9.22e18; if_val_has_null asks RAY_ATOM_IS_NULL about the atom's own type
rather than the promoted one; and a scalar condition is expanded once,
because the eager fill indexed its single cell per row and returned a
mixture of both branches.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(pivot): drop the dead out_type argument of if_val_has_null

Since the null test became RAY_ATOM_IS_NULL, which answers for the atom's
own type, out_type is unread. Pin the SYM case while here: SYM has no typed
null and no 0Ns literal, the empty symbol ' is the null and is in-band, so
it survives the branch as a SYM with no width handling of its own.

Co-Authored-By: Claude Opus 5 <[email protected]>

* fix(pivot): do not cast a NaN or an out-of-range double to int64

The eager arm pre-resolves both representations of a scalar branch before it
knows which one the output needs, so an F64 null branch reached the integer
conversion and cast a NaN. The cast is undefined; where it does not trap the
result differs per target, so a null would narrow into a different arbitrary
number on each platform. Route the three float-to-integer conversions through
one guard that answers with the integer null instead, for a NaN and for a
magnitude past the int64 range alike. In-range values convert as before.

Only a sanitizer shows this, so there is no separate case for it: the
existing 0Nf test walks the path and a float-cast-overflow build is what
catches a regression.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Anton Kundenko <[email protected]>
* fix(serde): round-trip builtins by full registered name

Builtin function objects inline only the first 13 bytes of their name (fn_set_name copies into aux[2..15]), and serialization read that inline copy via ray_fn_name. A builtin whose registered name is longer, such as .db.parted.tables or .sys.querylog.enable, was serialized truncated, so (de (ser fn)) interned a name that does not exist and failed with a name error instead of round-tripping. The serde-side nlen > 15 clamp was dead code: names from ray_fn_name are already capped at 13.

Recover the full name from the environment instead. Every builtin, dotted reserved names included, is bound flat in the global env (reg_bind), so a pointer scan maps the object back to its sym_id and ray_sym_str yields the full name; the decoder already reads a NUL-terminated name of any length.

Tests: store/serde_builtin_name_roundtrip asserts long-named builtins round-trip to the same env object; serde.rfl covers the (de (ser ...)) repro plus a behavioural identity check. Full suite: 3747/3748 pass (1 pre-existing skip).

* test(serde): prove builtin round-trip by call, not a truncated golden

The two `-- .db.parted.tables` goldens in serde.rfl compared the formatter's
output on both sides, and the formatter renders a builtin through ray_fn_name's
13-byte inline copy -- so both sides read `.db.parted.ta` and the lines would
pass on dev too, proving nothing about the fix. Replace them with behavioural
calls that reach each builtin's own argument check (type / domain), which only
resolve when the full name survived the round-trip. Pointer identity stays
covered by store/serde_builtin_name_roundtrip in the C suite.
* fix(csv): infer Rayfall temporal forms

* docs(csv): note the dotted-date + T/t/space timestamp form is accepted

fast_timestamp accepts the ISO separators after either date form, so a dotted date with a T/t/space ("2024.01.02T01:02:03") also infers TIMESTAMP even though no writer emits that mixed shape; only 'D' is tied to the dotted date. Document the leniency so the grammar stays describable. Comment only.
master's v2.6.0 commit (b3e9aa1) is a squash of dev at 04dc656, so dev
already contains every change on master. Record the merge with -s ours so
the two histories share an ancestor again and PR #483 stops conflicting.

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…cter (#489)

Nothing separated adjacent tokens, so `['a:1]` lexed as the symbol `a`
followed by the keyword symbol `:1` — a two-element symbol vector that
printed as `[a 1]` — and `(+ 1'a)`, `0Na` or `12:3x` quietly became
something other than what was written: the first token ended where its
character class did and the remainder was re-lexed as a new token.

A symbol, keyword, name or number directly followed by a quote, a
colon, or another name/number character is now a parse error naming
the character.  Brackets and strings stay self-delimiting on both
sides, since `fn[x]`, `gds(take ..)`, `(f x)(g y)` on one line and
`(list "A""B")` are established usage across the suite.  A symbol that
must contain a colon is built from a string: (as 'symbol "a:1").

parse_branch_cov.rfl pinned the re-lexing (`0Na` evaluating to the
variable `Na`, `12:3x` to the keyword `3x`); those lines now expect the
parse error.

Closes #484

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
Outside a query, nil? tested whether its argument OBJECT was null, so
(nil? [1 0N 3]) answered false while (select {n: (nil? v)}) gave one bool
per row through OP_ISNULL.  The two contexts disagreed on the same call,
the vector answer was never useful, and the workaround (map nil? v)
yields a boxed list that needs a cast before where or arithmetic can
take it.

A vector or list argument now yields a B8 vector, one entry per element,
decided by ray_vec_is_null (sentinel, empty symbol, empty string —
regardless of the HAS_NULLS hint) and, for a list, by whether the
element is a null atom.  Atoms, the null object, and other containers
answer for the object itself as before.  Implemented inside ray_nil_fn
rather than via RAY_FN_ATOMIC so the vector path runs without a per-
element atom and a list yields a B8 vector rather than a list.

Three coverage tests pinned the old whole-object answer for a vector
(cast_unary, width_matrix, system_branch_cov2); they now expect the
per-element result.

Closes #485

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
)

* perf(ipc): share one serialized frame across multicast subscribers

ray_mcast_pub built one upd message and called ray_ipc_try_send_async
per subscriber, and each call serialized, compressed and copied the
same bytes again in conn_frame_msg: O(subscribers x payload) work and
allocation for identical wire bytes.

The transmit queue node (ray_poll_buf_t) now points at its bytes
instead of holding them inline: either its own trailing storage, as
before for rx buffers and one-off frames, or an immutable reference-
counted ray_poll_frame_t.  conn_frame_msg returns such a frame;
ray_ipc_frame_async builds it once and ray_ipc_try_send_frame hands it
to a connection, whose queue node takes its own reference and keeps its
own write offset and link, so per-connection ordering, backpressure and
the disconnect-on-overflow path are unchanged.  The frame is freed when
the last node finishes or its connection closes.  ray_ipc_try_send_async
is the one-connection composition of the two.  ray_mcast_pub frames
once per publication and counts it in a new `framed` key of .mc.stats,
which stays at one publication per frame however many subscribers there
are.

Closes #487

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg

* feat(ipc): make the per-connection transmit backlog configurable (#491)

The backlog a connection may queue was the compiled-in 256 MiB
RAY_IPC_TX_MAX_BYTES, applied to every connection alike, so several
stalled multicast subscribers could each retain hundreds of MiB in the
publisher before being disconnected, and no workload could tune the
latency/loss trade-off without a rebuild.

A process default (bytes, and optionally a frame count) now applies to
every connection, and one live connection can carry its own override.
Admission checks both against the effective limit; a frame that would
exceed it is refused, which keeps the existing explicit drop-and-close
of a multicast subscriber rather than any silent loss.  The old constant
survives only as the hard cap on a single wire frame.

  (.ipc.txlimit)                 -> {bytes frames}  process default
  (.ipc.txlimit bytes [frames])  -> set it; frames 0 = unlimited
  (.ipc.txlimit h bytes frames)  -> override one connection
  (.ipc.handle h)                -> that connection's queue view:
                                    limits, queued bytes/frames, hwm

.mc.stats reports tx_limit_bytes, tx_limit_frames and tx_hwm_bytes (the
largest backlog any connection has held).  .ipc.txlimit is restricted:
it decides when a peer is dropped.  Minimum 4 KiB; default unchanged.

Closes #486

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…#494)

ray_elem_size(t) expanded to ray_type_sizes[(t)] with t an int8_t type tag.
For a negative (atom) tag — e.g. -RAY_BOOL == -1 — that is ray_type_sizes[-1],
an out-of-bounds read (UBSan: "index -1 out of bounds for type
'const uint8_t[256]'"), reached via ray_sym_elem_size() in the SYM-column read
path (observed in rfl/query/legacy_strl_predicates).

Cast the index to uint8_t, matching the indexing already used in vec.c: a
negative tag wraps into the upper, zero-filled half of the 256-entry table, so
atom tags read back a well-defined 0 (they carry no element size here) with no
OOB. The two direct ray_type_sizes[type] reads (eval.c gather, serde.c vector
decode) only ever see positive vector tags, so they are left as-is.

Extends test_types.c: ray_elem_size of negative / atom tags returns 0.
is_date_dir gated partition directory names with a blanket day 01-31
check, so a shaped-but-impossible name like `2024.02.31` was classified
as a date partition. parse_date_dir then normalised it through the
civil-calendar formula into a different real day (2024.03.02), silently
mislabelling that partition's key — a query filtering on the partition
date would read the wrong day.

Validate the day against the leap-aware length of its month, reusing
cal.h's MONTHDAYS / date_leap_year. An impossible name now fails date
classification, so infer_mc_type falls through to RAY_MC_SYM and the
directory name is kept literal instead of masquerading as a wrong date.

Test: part.rfl adds a mixed valid/impossible date set (2024.02.28 +
2024.02.31) that must classify as 'part (sym), not 'date, plus a real
leap day (2024.02.29) that must still classify as 'date so the tightened
check does not over-reject.
…#496)

#493 reports .time.timer.set callbacks not running while the REPL waits
at an interactive prompt.  Under a pty on Linux the callback fires at
its deadline with no further input on both dev and the v2.6.0 release,
and the epoll and kqueue loops both bound their wait by the next timer
deadline and fire expired timers after every wakeup, so the report is
not reproduced here.  The regression coverage it asks for is worth
having either way.

Two pty-driven tests: a one-shot timer whose callback exits the child
with a distinctive code, and a periodic timer that exits on its third
fire.  A clean exit with that code proves the callback ran while the
prompt was idle; a starved timer produces the helper's timeout.  The
poll is published to the runtime as main.c does, which is where
.time.timer.set looks for it.

Refs #493

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
…ng timers (#501)

The piped (non-TTY) REPL blocked in fgets() outside the poll loop, so
while a producer held the pipe open nothing else ran: a 100 ms timer
fired only when the writer closed, and a -p listener served no request.
At end of input the loop was entered only for registered selectors, so
a timer-only run — a piped session, or a script file — printed the
timer id and exited with the timer unfired (#493, narrowed).

run_piped now reads stdin through a small line reader with fgets
semantics.  With a poll, stdin is a registered selector whose read_fn
pumps the pipe into the reader, and the reader waits in bounded poll
passes that fire due timers and serve every other selector; a close_fn
marks the reader when the poller drops the selector on hangup (a pipe's
data and hangup arrive in one event), after which it drains the pipe
with direct reads.  Without a poll it reads directly, as before.

After a script, or at piped EOF with nothing else registered, the
process now stays until pending timers are spent (ray_poll_drain_timers:
bounded passes while a deadline exists).  A live listener or connection
keeps the loop as before, counted by a new n_live rather than by slots.
A lingering client handle does not keep a script alive — sockets share
one selector type, and a script's open handle must not become a hang.
The unbounded loop returns when it has neither selectors nor timers,
instead of blocking forever in a bare wait.

Fixes #493

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
… derives it from the payload (#497)

ray_vec_slice built the slice header with only RAY_ATTR_SLICE and the
SYM width bits, dropping the parent's RAY_ATTR_HAS_NULLS.  Every fast-
path gate that trusts the bit — exec_reduction behind sum/min/max/avg,
raze's memcpy path, the morsel null bitmap, the column save header —
then read a window holding a null sentinel as null-free.  (take D
<range>) on a dict slices the key vector, so (sum (key (take D [0 3])))
over I64 [1 0N 3 4] answered -9223372036854775804, min answered 0Nl,
raze materialised the sentinel as a plain number for good, and
.db.splayed.set persisted the column with attrs 0, which every later
reader believed.

The slice header now carries the parent's HAS_NULLS hint.  It is a
window onto the same sentinel-encoded payload, and over-approximating
when the window happens to hold no null is the bit's documented role;
the slice-aware readers (ray_vec_is_null, concat, gather) are unchanged.
That one line corrects the aggregates, sends a null-bearing slice down
raze's concat path, and makes the save header right.

The persisted bit is load-bearing and nothing rescans on load, so
col_save_impl now also derives it from the payload — one sequential
read with an early exit, set-only, for the sentinel types — so no
producer that forgets the bit can write a blind column.  A slice's aux
(parent pointer, window offset) is zeroed before it reaches disk.

Two C tests that pinned "a slice never carries the bit" now assert the
inverse.

Fixes #495

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
master's v2.6.1 commit (a99a019) is a squash of dev at 30712c9, so dev
already contains every change on master. Record the merge with -s ours so
the two histories share an ancestor again and PR #502 stops conflicting.

Claude-Session: https://claude.ai/code/session_01J4QKJW3RbRP8TQoquJtARg
@singaraiona
singaraiona merged commit 2c10dba into master Sep 9, 2026
11 checks passed
singaraiona added a commit that referenced this pull request Sep 14, 2026
…the next release PR is up to date with its base
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants