Arrow field-level metadata in Parquet reads — DataFrame.readParquet and DataFrame.readParquetColumns now automatically read Arrow IPC field metadata embedded in Parquet files. Column "label" and "description" keys are lifted into var_labels (so DataFrame.getVarLabel works immediately after reading); all other Arrow field metadata keys are stored under "arrow:<key>" in column metadata. keel's own keel:metadata labels take precedence over Arrow labels. Files without Arrow schema metadata are unaffected. The new merge_arrow_field_metadata function handles this extraction; polars-arrow added as a direct dependency.
Arrow metadata Parquet tests — tests/stdlib/dataframe/arrow_metadata.rs covers the full merge_arrow_field_metadata path: label/description key extraction, arbitrary key storage, keel-label precedence, files without Arrow schema, column-subset reads (readParquetColumns), error cases (missing/corrupt file), and data-integrity verification.
Stdlib doc example test coverage — tests/stdlib/function_doc_examples.rs now tests all DataFrame.Expr, Date, Time, Duration, Decimal, Table, and Distribution module examples in addition to the existing modules.
VM::set_max_steps accessor — New pub fn set_max_steps(&mut self, steps: usize) method on VM for configuring the execution step limit programmatically. Previously the limit was only configurable at construction time via internal defaults.
RegisterValue implements Display — RegisterValue now has a human-readable Display impl used in error messages. Scalar values show their content (Int(42), Float(3.14), Bool(true), String("hello")); heap-indexed types show their kind (Tuple, List, Record); functions show their name (<native fn: map>, <closure>).
RegisterOutOfBounds VM error — Panicking register array accesses replaced with a proper VmError::RegisterOutOfBounds that includes the register index and the current register count, making out-of-bounds access a recoverable runtime error rather than a panic.
Exhaustiveness and SchemaKind enums — Replaced bool parameters with self-documenting enum types: Exhaustiveness::Exhaustive/Partial for value-label contracts, SchemaKind::Closed/Open for DataFrame schema validation.
Remote URL reads for DataFrame — DataFrame.readCsv, DataFrame.readParquet, and DataFrame.readJson now accept http:// and https:// URLs in addition to local file paths. Downloads are controlled by KEEL_HTTP_DISABLED (set to 1 to block all HTTP) and KEEL_HTTP_ALLOWED_HOSTS (comma-separated allowlist). Attempting a URL read when HTTP is disabled raises HttpDisabled; an unlisted host raises HttpHostNotAllowed.
compile_ast_node extracted to own module — KeelCompiler::compile_ast_node moved from inline logic into src/compiler/compile/compile_ast_node.rs for clarity.
vm.rs refactored — InstructionHandler trait impl and VM public API consolidated in src/vm/vm.rs; logic unchanged.
UUID-based DataFrame lineage IDs — DataFrame lineage now uses UUID v4 strings instead of sequential integers. IDs are stable across sessions and persist through Parquet round-trips, enabling reliable cross-session provenance tracking.
Embedded parent lineage — Each ParentRef in the lineage DAG now contains a full snapshot of the parent's DataFrameLineage at the time of derivation. This enables complete provenance reconstruction without holding references to intermediate DataFrames. Depth-limited to 3 levels for stack safety.
Lineage registry with lookup functions — All DataFrames are automatically registered in a global in-memory registry. Two new stdlib functions enable lookup:
DataFrame.lineageById : String -> Maybe Record — Look up a DataFrame's lineage by its UUID
DataFrame.lineageByName : String -> [Record] — Find all DataFrames derived from a source file (case-insensitive substring match, limited to 50 results)
BlockMissingIndentation parser error — When a function body or expression block is not indented at all (e.g., let x =\n5), the parser now emits a helpful error message instead of a generic parse failure. Applied to parse_parts_block, parse_scoped_block, and function block parsers.
FunctionMissingTypeSignature parser error — When a function definition lacks a type signature (e.g., fn example x = x + 1), the parser now emits a specific error directing users to add a type signature with the : Type -> Type syntax.
ElseMustAlignWithIf parser error — When an else branch is not aligned with its corresponding if, the parser now emits a specific error indicating the expected indentation level. Replaces generic IndentationError with a more helpful message specific to if/else alignment.
Record block duplicate field detection — Multi-line record blocks (using parse_parts_block) now detect and report duplicate field names, matching the existing behavior for inline records.
Multiline type alias integration tests — New tests for multiline type alias declarations with record types, covering 2-field, 4-field, and usage-after-declaration scenarios.
If/else branch type checking — If/else expressions now emit BranchTypeMismatch errors when then and else branches have incompatible types (e.g., if True then 1 else "one"). Previously only case expressions were checked; now both constructs enforce type consistency at compile time.
Decimal support in arithmetic operations — Int now unifies with Decimal (in addition to Float), and negation type inference supports Decimal. Enables expressions like let x = 1d + 2 where Int promotes to Decimal.
Enum record variant pattern validation — Compile-time validation for enum variant patterns that detects syntax mismatches and enforces pattern structure:
Pattern syntax validation: Error when using record syntax { } on tuple variants (e.g., Result::Ok { value } when Ok(Int)), or tuple syntax on record variants (e.g., User::Member(n, i) when Member { name, id })
Wildcard validation: Wildcards (_) in record field patterns now produce clear errors directing users to use variable bindings instead (e.g., { name: _, age } → error)
Rest pattern support: Full support for rest patterns (..) in record variants to ignore extra fields (e.g., User::User { name, .. })
Partial field errors: Missing fields without .. now produce errors listing the missing fields (e.g., User::User { name } when variant has { name, age, email } → error: "missing fields: age, email")
New error types: EnumVariantPatternMismatch for syntax mismatches, RecordPatternWildcardNotAllowed for wildcard usage, with helpful hints and notes
~Changed
38 items
Extract pre-parse checks from parser.rs — ~900 lines of token-stream validation functions moved from parser.rs into a new parser/pre_checks.rs module. The 10 check functions (check_nesting_depth, check_binary_operators, check_bare_constructors, check_delimiters, check_incomplete_constructs, check_type_alias_syntax, check_enum_syntax, check_module_syntax, check_trailing_block_comments, check_import_syntax) run before chumsky parsing to produce specific error messages. No user-visible behaviour change.
Split scope.rs into submodule directory — parser/scope.rs (948 lines) split into parser/scope/ with mod.rs (core state), types.rs (scope types), resolve.rs (symbol resolution), and queries.rs (collection/query methods). No user-visible behaviour change.
Fix stale comments — Updated documentation comments referencing removed "inline file" / "passing variables" / "parameterized modules" terminology to use the current Task system terminology (Task.run, Task.define).
Large-scale module splits for maintainability — Several monolithic source files have been split into focused submodules with no user-visible behaviour change:
stdlib/io.rs (1964 lines) → stdlib/io/ with security, console, file, dir, path, env, process submodules
stdlib/datetime.rs (1804 lines) → stdlib/datetime/ with construct, parse, format, component, arithmetic, convert submodules
Performance: filter_columns O(n×m) → O(1) — DataFrame.select and DataFrame.drop now build a HashSet of column names once instead of calling Vec::contains for every column, reducing complexity from O(n×m) to O(n+m).
Performance: VM bytecode/interner no longer cloned after compilation — After compilation, bytecode and string_interner are moved into the VM rather than cloned, eliminating one full allocation per VM::compile call.
Performance: tracing serialization guarded — Expensive {:?} formatting for heap/register state in VM tracing is now gated behind tracing::enabled!(Level::INFO), avoiding allocation in non-tracing builds.
Task stdlib module — New Task module registered as a stdlib module (like List, Math) with run and define as compile-time intrinsics. Task.run "file.kl" (vars) replaces inline "file.kl" passing (vars) for calling external task files. Task.define (params) -> (outputs) replaces module (params) exposing (outputs) for declaring task file interfaces. Supports all variable passing modes: named (x, y), spread (..), and unit (). The Task module provides import/docs/LSP integration while the actual operations are intercepted at compile time.
User-defined file modules — Import .kl files as modules with import Data.List, resolving to modules/data/list.kl relative to the entry file. Supports snake_case filenames mapped to PascalCase module names, nested directory structures (Data.Nested.Deep → modules/data/nested/deep.kl), circular dependency detection, all import forms (qualified, aliased, exposing), and modules that import other user modules or stdlib modules. New module_resolver.rs handles path resolution and compile_user_module.rs handles compilation.
DataFrame.withColumns cross-column reference batching — The withColumns function now automatically groups expressions into dependency batches, allowing later expressions to reference columns created by earlier expressions in the same call. For example, withColumns [col "amount" |> Expr.mul (lit 0.08) |> Expr.named "tax", col "amount" |> Expr.add (col "tax") |> Expr.named "total"] now works correctly, with the second expression able to reference the "tax" column created by the first. Expressions are analyzed for column dependencies and executed in separate batches when cross-references are detected.
register_user_modules_in_parser — New public function in module_resolver that discovers user modules and pre-registers them in the parser scope. Extracted from inline logic in vm.rs so the REPL can re-register modules after :cd.
Doc comment extraction into ParserState — New doc_comments: HashMap<String, String> field on ParserState and extract_doc_comments() function. Doc comments (##) and regular comments (--) on functions, let bindings, enums, and modules are extracted after each successful parse and persist across REPL evaluations via parse_file_with_state.
Inline file type caching — New inline_file_types field on TypeInferenceState caches record types for inline file expressions, allowing type inference to return concrete types instead of Unknown when the file has been previously compiled.
Expr-based lineage tracking — withColumns and agg now track per-column lineage for Expr-based operations, including source column dependencies extracted from expression metadata.
SourceColumn type for lineage — New SourceColumn struct with column, source_df, and optional label fields. resolve_source_column() helper derives source DataFrame identity from column origins (file name, "records", join source, etc.) and attaches variable labels from var_labels.
Compile-time circular dependency detection — CircularModuleDependency and ModuleCompilationFailed error variants in the compiler for user module imports.
clang added to nix dev shell — Ensures the clang linker required by .cargo/config.toml is available in the development environment.
keel init template tests — Integration tests for minimal, pipeline, and analysis project templates verifying compilation and correct output end-to-end.
compile_file vs compile contract tests — Tests documenting that VM::compile_file() resolves user modules while VM::compile() does not, covering basic, nested, and mixed user+stdlib imports.
inline/passing keywords removed — The Token::Inline and Token::Passing tokens have been removed from the lexer. All file composition now uses Task.run and Task.define syntax.
Expr::InlineFile renamed to Expr::RunFile — AST node renamed throughout parser, compiler, type inference, and formatter to reflect the new Task.run naming.
Declaration::Task replaces parameterized modules — New AST declaration variant with params and outputs fields replaces the module-based parameter/expose pattern for task file interfaces.
Error messages updated — All error hints and notes referencing inline, passing, or parameterized modules now reference Task.run and Task.define.
✓Fixed
18 items
DataFrame.Expr pretty-printer — Expr values now display in readable Keel-style syntax (e.g. col "price" |> Expr.mul (col "qty") |> Expr.named "total") instead of raw Polars debug format.
DataFrame.Expr.rowNumber implementation — Fixed a Polars error caused by using col("") (empty column name) to generate row numbers. Now uses lit(1u32).cum_sum(false) which works correctly.
Expr.rowNumber, Expr.rank, Expr.denseRank call syntax — These functions were registered with arity: 0 but were unreachable as values (the VM only auto-calls them with arguments). Changed to arity: 1 accepting (), consistent with other nullary stdlib functions like Duration.zero. Call as Expr.rowNumber (), Expr.rank (), Expr.denseRank ().
Http.withHeaders example — Fixed malformed example where the header list was split across lines in a way that broke parsing.
All stdlib function doc examples now execute successfully — Fixed scope issues (standalone expressions before let df creating separate top-level scopes), aggregation examples now use named expression variables for correct type inference, Expr.not and Http.jsonBody added to expected-failures list (keyword conflict / requires disabled Http.send), and DataFrame.sourcePath/parents/lineageByName/lineageById examples updated to use fromRecords instead of readCsv.
Or-pattern short-circuit evaluation — When an or-pattern (PatA | PatB | PatC) matched on an earlier alternative, the remaining alternatives were still evaluated. The VM now short-circuits after the first matching alternative, preventing unnecessary work and potential side-effects.
Integer division // now truncates toward zero — The // operator now compiles to a dedicated IntDivRegRegReg instruction that performs truncating integer division (consistent with most languages). Previously it fell through to float division in some paths.
HTTP body read errors now surfaced — IO.httpGet and IO.httpPost now propagate errors when reading the response body. Previously a body-read failure would silently return an empty string; now it raises a HttpError.
TOCTOU race in IO sandbox check eliminated — The sandbox path check previously called exists() before canonicalize(), creating a time-of-check/time-of-use race. The check now calls canonicalize() directly (which errors on non-existent paths), removing the race window.
Pattern binding field-name lookup — Record pattern bindings now look up fields by name instead of silently falling back to index 0 when a named field was not found. Prevents silent incorrect bindings on mismatched record patterns.
validate_data_contracts panic replaced with error — An unreachable!() macro in the data contract validator is replaced with CompileError::Internal, turning a potential panic into a recoverable compile error.
Panicking bounds checks replaced in pattern matching — Direct field_names[i] indexing in pattern_bindings and pattern_match replaced with .get(i).ok_or(VmError::IndexOutOfBounds) so malformed bytecode produces an error rather than a panic.
Unary negation on new line no longer parsed as binary subtraction — let x = 42\n-x was incorrectly parsed as 42 - x (binary subtraction across line boundary). The parser now preserves newlines before - and + tokens, so -x on a new line is correctly parsed as unary negation.
Module exposing restrictions enforced — Qualified access to non-exposed module functions is now correctly rejected at compile time. Added P0 test coverage: bytecode emission (481 lines), declaration compilation (584 lines), extended type inference (541 lines), type system (1183 lines), VM core (500 lines), and VM handlers (552 lines).
Submodule alias resolution in let bindings — Fixed type inference for module function calls when using aliased submodules (e.g., import DataFrame.Expr as Expr followed by Expr.lit 42).
Token span boundaries for multi-byte UTF-8 characters — Fixed panic when computing token spans for source containing multi-byte characters (e.g., █). Span boundaries now snap to valid char boundaries.
Native object display for multi-line output — Native objects with multi-line display strings (e.g., rendered tables) now show directly without wrapping in angle brackets.
Enum record variant pattern matching — Fixed runtime error when pattern matching on enum variants with record syntax. Previously User::Member { name, id } would fail with "Direct tuples are not supported" error. The parser now preserves record pattern structure for validation while the compiler correctly handles both old unpacked format (backward compatible) and new record format. Includes comprehensive test coverage (85 tests) covering nested patterns, edge cases, generic enums, mixed variants, and error scenarios.
-Removed
1 items
DataFrame.mutate — Removed the mutate function from the DataFrame stdlib. Use withColumn or withColumns instead, which provide better type tracking and Polars expression support. The Operation::Mutate lineage variant has also been removed.