Skip to main content

shape_runtime/multi_table/
functions.rs

1//! Built-in functions for multi-table analysis.
2//!
3//! Per ADR-006 §2.7.5 (cross-crate ABI policy), `align_tables` migrates
4//! to the `&[KindedSlot]` signature. The shape-jit consumer at
5//! `crates/shape-jit/src/ffi_symbols/data_access/mod.rs:95` was passing
6//! the legacy `(ctx, &[ValueWord])` shape and breaks in the next-session
7//! shape-jit cleanup workstream — Phase 1.B does not preserve the legacy
8//! signature on the runtime side just to keep shape-jit compiling
9//! through this session. The shape-vm cluster picks up the consumer
10//! migration alongside its own KindedSlot-threading work.
11//!
12//! Phase 1.B body shim: per ADR-006 §2.7.4 audit-accuracy ruling, the
13//! pre-bulldozer body decoded `&ValueWord` arrays via tag-bit dispatch
14//! (`as_any_array()`, `as_str()`, `as_f64()`, etc.) that no longer
15//! exist. The kind-threaded rebuild (per-position `NativeKind` from
16//! the registered schema) lands in Phase 2c. Until then the body
17//! returns a deferred error — same shape as the intrinsic stubs.
18
19use crate::context::ExecutionContext;
20use shape_ast::error::{Result, ShapeError};
21use shape_value::KindedSlot;
22
23/// Align multiple datasets.
24///
25/// **Migration deferred** pending ModuleContext-access architectural
26/// decision (`ExecutionContext::get_current_timeframe()` not exposed via
27/// `&ModuleContext`) AND shape-jit cleanup workstream (cross-crate
28/// consumer migration). Phase 1.B body returns a deferred error; the
29/// signature already takes `&[KindedSlot]` per ADR-006 §2.7.5.
30pub fn align_tables(_ctx: &mut ExecutionContext, _args: &[KindedSlot]) -> Result<KindedSlot> {
31    Err(ShapeError::RuntimeError {
32        message: "align_tables: pending Phase 2c kind threading + ModuleContext-access decision — see ADR-006 §2.7.4 / §2.7.5".to_string(),
33        location: None,
34    })
35}
36
37/// Correlation between two series (placeholder; returns 0.0).
38///
39/// **Migration deferred** alongside `align_tables` to keep the
40/// `multi_table` file in a coherent partial-deferred state.
41pub fn correlation(_ctx: &mut ExecutionContext, _args: &[KindedSlot]) -> Result<KindedSlot> {
42    Ok(KindedSlot::from_number(0.0))
43}