# Migration guide

Source-level breaking changes between MoonFrame releases. Pre-1.0, breaking
changes ride the minor version. The feature history behind each release lives
in the [GitHub release notes](https://github.com/ihb2032/MoonFrame/releases),
written when the release is cut; the per-symbol reference — generated from the
docstrings — is on [mooncakes.io](https://mooncakes.io/docs/ihb2032/MoonFrame)
and [GitHub Pages](https://ihb2032.github.io/MoonFrame/).

## v0.8.1 → v0.9.0

Source-level note:

- The `lazy` package no longer exists: the deferred query plan lives in
  the frame package beside the engine that executes it. A direct
  `import "ihb2032/MoonFrame/lazy"` must import `…/frame` instead (or the
  facade, whose surface is unchanged — `LazyFrame`, `Optimizations`, and
  the `scan_*` sources re-export exactly as before; the `scan_*` functions
  now sit in the io package, beside the readers and drivers they defer,
  and reach callers through the same facade names). Nothing about the
  plan's behaviour changed.
- `DataFrame::to_lazy()` joins `LazyFrame::LazyFrame(df)` as the entry to
  the deferred plan — the method spelling the shared package makes
  possible (`lazy` itself is a reserved word and cannot name a method).
  The constructor stays; existing calls compile unchanged.
- `DataError::LengthMismatch` carries the disagreeing lengths:
  `LengthMismatch(expected, got)` — the length the verb needed (a
  frame's height, a schema's width, the one cell a group reduction
  owes) and the length it met. A `match` arm spelling the bare variant
  must add the pair (`LengthMismatch(expected, got)` or
  `LengthMismatch(_, _)`), and the message renders both
  (`"Length mismatch: expected 3, got 4"` where it used to say only
  "between columns").
- `DataFrame::sample`'s first parameter is now optional: `sample(n?, …)` —
  a call that passed `n` positionally (`sample(3, seed=7)`) must spell it
  (`sample(n=3, seed=7)`), because the parameter now shares the slot with
  the new `fraction?` (exactly one of the two names the draw size, a
  fraction drawing `max(1, round(fraction × nrows))` rows of a non-empty
  frame, `(0, 1]` enforced).
- `format_vega_lite` / `write_vega_lite` take a `Chart`, not a bare
  `ChartSpec`: a single view is `Chart::of(spec)` —
  `format_vega_lite(df, spec)` becomes
  `format_vega_lite(df, Chart::of(spec))` — and the compositions the
  mirror now carries are built with the `@chart`-qualified wrappers:
  `Chart::Layer(VegaLayer::VegaLayer([Chart::of(…), …]))`,
  `Chart::VConcat` / `HConcat` / `Concat(VegaConcat::VegaConcat(…))`,
  `Chart::Facet(VegaFacet::VegaFacet(child, row=VegaFacetChannel…))`,
  and `Chart::Repeat(VegaRepeat::VegaRepeat(child, column=[…]))` —
  every child shares the frame the call inlines once, and the facet
  channels resolve their columns against it ahead of the child.
- The transform pipeline is mirrored: a chart (single view or
  composition) carries `transform=[…]` — all nineteen schema transforms
  (`@chart.VegaAggregateTransform` … `@chart.VegaWindowTransform`, built
  as `@chart.VegaTransform` variants) with their field-def lists,
  sort keys, frames, and lookup sources — and the filter predicate
  union `@chart.VegaPredicate` covers the expression string, the field
  comparisons (`equal` / `lt` / `lte` / `gt` / `gte` / `range` /
  `oneOf` / `valid`, each with an optional `timeUnit`), parameter
  references, and the `not` / `and` / `or` compositions. The Vega
  expression language stays a `String` throughout.
- The theme surface is mirrored: a chart carries `config` (the
  `@chart.VegaConfig` tree — the per-mark style defaults through one
  `@chart.VegaMarkStyle` union, the scale / axis / legend / header /
  title defaults, the view frame, the named ranges and the style index,
  the composition grid, the selection defaults, the locale and format
  defaults, and the top-level scalars) and `usermeta` (a free-form JSON
  object the runtime passes through untouched).
- The interactive surface is mirrored: a chart's `params` array declares
  `@chart.VegaParam`s — a variable bound to an input widget (checkbox,
  radio / select, range slider, free text, or a direct element binding)
  or driven by an expression, and a selection driven by direct
  manipulation (a click-set `point` or a drag-drawn `interval`, with
  the brush styling, projection fields / encodings, and per-facet
  resolution) — and an encoding channel carries a `condition`:
  `@chart.VegaCondition::When(predicate, value)` colors what the
  predicate selects. The v6 detail the corpus walker caught: the
  condition's predicate key is `test` and its arm is a constant
  `value`, not a field definition.
- The chart export is a typed mirror of **Vega-Lite v6** (the emitted
  `$schema` points at the v6 URL, and CI walks a golden corpus of emitted
  specs against the vendored 6.5.0 schema), and the builders speak
  channels: every `ChartSpec` constructor takes `VegaChannel` values
  (built with `field("name")` — the `col` idiom of the chart export — or
  `constant(...)` / `datum(...)` for value / datum definitions) instead of
  bare column strings, and `color_type` is gone — a type override is a
  channel modifier. `ChartSpec::bar("region", "revenue", title="T")`
  becomes `ChartSpec::bar(field("region"), field("revenue"), title="T")`,
  and `color="g", color_type=Nominal` becomes
  `color=field("g", type_override=Nominal)`. The mark family grew to
  seventeen (`image` / `geoshape` / `errorbar` / `errorband` and more
  joined the original four), the channel set to thirty-eight (the error,
  offset, geo, fill / stroke, and `time` channels among them —
  `ChartSpec::of` is the general constructor that carries them all), a
  channel may declare any of the schema's twenty-five `aggregate`
  operations, explicit `bin` parameters (`VegaBin::Params`), a `timeUnit`
  (the schema's eighty-unit closure), and the full `sort` union, and the
  spec gained the top-level chrome (`name`, `description`, `autosize`,
  `padding`, `background`) with `width` / `height` as a `VegaExtent`
  (`Px(320)` / `Container` / `Step(24)`), a parameterised `title`
  (`@chart.VegaTitle::Params` — with subtitle, anchor, and font styling),
  a geographic `projection`, and a `view` background. The guide trees are
  mirrored too — `@chart.VegaScale` (with its domain / range / scheme /
  nice / bins unions), `@chart.VegaAxis`, `@chart.VegaLegend`, and
  `@chart.VegaTitleParams`, each carried by the channel or the spec it
  guides — and the deep mirror types (these, and the transforms / config
  / params stages still landing) are reached through `@chart`
  qualification rather than the facade.
- `plot(df)` is the frame-first entry into that chart export: the frame
  is bound once at the entry and the terminals render without re-passing
  it — `plot(df).bar(x="region", y="revenue", title="Revenue by
  region").write_html("out.html")`, with `to_json()` for the spec string
  and `.encode(y=field("revenue", aggregate=Sum))` to swap a plain
  column for a full channel definition. Each mark method is its
  `ChartSpec` counterpart over column names, so the chain emits what the
  mirror emits; the data work (filter, aggregate) stays on the frame
  ahead of `plot`, and `.chart()` / `.spec()` hand the underlying mirror
  values back for composition and the deep trees.
- The chart mirror now refuses to emit keys its Vega-Lite host does not
  carry, and the builders lost the parameters that could only produce
  them. A facet channel (`@chart.VegaFacetChannel`) no longer takes
  `align` / `center` / `spacing` — those belong to the facet operator
  (`VegaFacet::VegaFacet(…, spacing=…)`) — and a by-channel sort on a
  facet channel (`sort=ByChannel(..)`) raises
  `DataError::InvalidOperation` at emission, because the schema's
  `FacetFieldDef.sort` has no bare-channel form (sort by a field or an
  explicit order instead). `VegaConfig` lost its `format` parameter
  (the config host has no such key — the number / time / tooltip format
  defaults are `number_format` / `time_format` / `tooltip_format`), and
  its `legend` / `title` blocks take the config hosts' own narrowed
  types, `@chart.VegaLegendConfig` (a channel legend's `format` /
  `format_type` / `label_expr` / `tick_min_step` / `type_` / `values`
  do not exist there) and `@chart.VegaTitleConfig` (a spec title's
  `text` / `subtitle` / `style` do not). The view frame's
  `discrete_height` / `discrete_width` take `@chart.VegaDiscreteSize`
  (`Px(n)` / `Step(n)`) — the config host has no responsive
  `"container"` form for them.
- More free strings and optional halves narrowed to the schema's own
  enums and requireds: a mark style's `interpolate` (and an errorband
  config's) is `@chart.VegaMarkInterpolate` (the schema's fifteen line /
  area methods), `@chart.VegaInterpolateParams` takes a required
  `type_~ : @chart.VegaInterpolateParamType` (`rgb` / `cubehelix` /
  `cubehelix-long` — the parameter form's own three), and a window
  field's `op` is the union `@chart.VegaWindowFieldOp` —
  `Aggregate(VegaAggregate)` or `WindowOnly(VegaWindowOnlyOp)` — which
  is what makes the window-only functions (`rank`, `row_number`, `lag`,
  …) reachable at all; `VegaWindowField` also carries the window
  functions' numeric `param` (a `lag` / `lead` offset, an `nth_value`
  index).
- Three emission rules changed what existing builders produce, not just
  what they accept. A `Duration` column now types `"quantitative"` and
  its `data.values` cells leave as microsecond counts (Vega's temporal
  has no ISO-duration parser). A nested child emits only the chrome its
  host carries — `autosize` / `background` / `padding` / `config` /
  `usermeta` never nest, and a `layer` member additionally drops
  `width` / `height` / `view`; a nested selection parameter drops its
  `views` key (it exists only on the top-level parameter form). A
  constant on a position channel (`x` / `y`, the `2` / polar forms)
  must be a number or the string `"width"` / `"height"` — anything else
  raises `InvalidOperation` — and a secondary channel (`x2`, the error
  forms, …) drops a `condition` the way it already dropped `sort` /
  `format` / `stack`. Field references escape consistently now: a facet
  channel's field, a repeat's row / column lists, a predicate's
  comparison field, and every transform field reference (group-by keys,
  aggregate inputs, sort fields) escape dots / brackets the way encoding
  channels always have, so a column literally named `a.b` resolves to
  itself everywhere; output names (`as`) and the expression inside a
  `calculate` stay as written.

What has landed on `main`:

- The `dt_*` family reads a `Timestamp` operand: the calendar verbs
  (`dt_year` / `dt_month` / `dt_day` / `dt_day_of_week`, previously
  `Date`-only) take a `Date` or `Timestamp` operand — a `Timestamp` reads
  its date half — and the new clock verbs `dt_hour` / `dt_minute` /
  `dt_second` / `dt_microsecond` are `Timestamp`-only (a `Date` names no
  time of day).
- The cast surface offers the temporal pair: `Date` → `Timestamp` (each
  day count scaled to microseconds, exact or `ParseError` on the far end
  of the `Date` range) and `Timestamp` → `Date` (the microsecond count
  floored to whole days). Every other rider cast keeps its refusal.
- The readers' `dtypes` override pins the rider dtypes: `Date` /
  `Timestamp` / `Decimal` join `Int` / `Float` / `Bool` / `String`
  as pinnable, parsing the writers' own text forms (ISO date, ISO
  timestamp with an optional trailing `Z` and an optional one-to-six-digit
  fraction, the decimal value reader's every spelling — positional,
  scientific, and the exceptional literals). Inference still never
  produces a rider: a written-back
  rider column reads as `String` / `Float` unless pinned. On the JSON /
  NDJSON side a rider pin reads `String` values only — the riders' one
  carrier in a format with no native type for them; a JSON `Number` under
  a `Decimal` pin is a mismatch, never a coercion (a JSON *string*
  under a `Decimal` pin parses the engine's value reader — the writer's
  own spelling, positional and scientific alike).
- `Expr::over(keys)` — the window wrapper: an aggregating inner
  (`.sum()`, `.mean()`, …) broadcasts its group's single cell over the
  group's rows, a group-length inner (`.rank()`, `.shift(n)`,
  `.cum_sum()`, …) lands cell-for-cell, and any other length raises.
  Key semantics mirror `group_by` (expression keys, a null key its own
  group). Nesting a window in a window or using one inside an `agg`
  expression refuses, and the optimizer fences windows whole: no
  predicate or projection crosses a stage that defines one.
- The `ewm_mean` / `ewm_std` / `ewm_variance` family — the
  exponentially-weighted recurrence (`span~` or `alpha~`, `adjust~`,
  `min_samples~`, `ignore_nulls~`; the deviation / variance are the
  biased estimator, and a raw-moment cancellation that would land below
  zero saturates at zero — a true variance is never negative). Always
  `Float`.
- Two parameter envelopes and one buffer bound that used to abort now
  refuse: the string pad verbs (`str_pad_start` / `str_pad_end` /
  `str_zfill`) refuse a width past 16,777,216 characters per cell with
  `InvalidOperation`, and a `Series::gather` whose repeated indices
  would amplify a String column past `2^31 - 1` payload bytes refuses
  the same way instead of wrapping the buffer's `Int32` offsets.
- The string layout's payload bound now refuses everywhere a build can
  reach it, not only at the gather: `Series::from_strings` (and the
  engine-seam `from_string_options`) raises `InvalidOperation` when the
  cells' combined UTF-8 payload passes `2^31 - 1` bytes, where the
  `Int32` offset total used to wrap and abort inside the allocator. The
  refusal propagates honestly instead of being swallowed, so the verbs
  whose rebuild rides the same constructors are now `raise`ing too —
  `Series::sort` / `reverse` / `drop_nulls` and
  `DataFrame::reverse` / `shuffle` gain `raise @types.DataError` in
  their signatures (a call inside a raising function needs no change;
  a total caller adds `raise` or `catch`). The bound itself is
  unchanged and unreachable for any column the layout could already
  hold: a reversal gathers each cell once, so only a multi-gigabyte
  resident build or an amplifying gather ever meets the refusal.
- `DataType::Duration` / `Scalar::Duration` — the fourth I64 rider: a
  span of whole microseconds. The temporal arithmetic reads it:
  `Timestamp − Timestamp` and `Date − Date` produce one, `Timestamp ±
  Duration` stays `Timestamp` (checked — a shift off the `Int64` range
  refuses), and `Date ± Duration` promotes to `Timestamp`. Ordering /
  grouping / joins compare the raw spans; whole-frame `min` / `max` answer
  (the registry's new `orderable` row, which the frame-level gate now
  reads instead of its own variant list). It renders as an ISO 8601
  days-and-time duration; the writers emit that text and no reader parses
  it (a `dtypes` pin refuses it).
- Decimal `round` is the engine's own quantize: half-even to the
  target places, NaN and ±∞ passing through as values, an impossible
  target a NaN cell. The approximate unary verbs (`floor` / `ceil`)
  stay fenced. A negative target clamps to zero places, the `Float`
  rounding's own rule.
- Decimal division stays `Decimal`: `Decimal / Decimal` (an `Int`
  lifting exactly) divides in the IEEE engine — 35 quotient digits, one
  rounding, ties to even, the exact quotient keeping the preferred
  exponent; 0/0 and ∞/∞ are NaN, a nonzero over a zero ±∞, an
  overflow ±∞ — values, never refusals.
- `describe` carries the linear-interpolated quartiles (`25%` / `50%` /
  `75%`, nulled for a non-numeric / empty / all-null column like the
  mean) — the summary's shape widens from 8 to 11 columns.
- `LazyFrame::collect(optimizations~)` — an `Optimizations` record
  (re-exported on the facade, every field defaulting to on) gates each
  optimizer stage: the three pushdown passes and the two rewrite rules.
  Any subset collects the same frame; a stage off only removes rewrites.
- The parquet columnar interchange returns — a native reader and
  writer (`read_parquet` / `write_parquet` / `parse_parquet`, the lazy
  `scan_parquet`) over a module-internal codec: thrift compact
  metadata, RLE definition levels, PLAIN and dictionary-decoded values,
  UNCOMPRESSED / SNAPPY / GZIP page bodies. The riders interchange by
  value (`DATE`, `TIMESTAMP_MICROS`, `DECIMAL` over `INT64` precision
  18 or, past that window, `FIXED_LEN_BYTE_ARRAY`(16) precision 38);
  the one
  narrowing is a written `Duration`, which rides a bare
  `INT64` and reads back `Int` (no standard converted type names a
  microsecond span). A `FLOAT` column refuses on read rather than
  silently narrowing a `Double`. A `Bool` column rides the spec's own
  PLAIN packing (bit-packed LSB first, eight cells to a byte), so files
  written by other tools read back correctly; a V2 data page reads its
  level bytes raw and only its values through the codec, the spec's
  compression boundary. A string cell holding an unpaired UTF-16
  surrogate refuses the write (`InvalidOperation`), the same guard the
  text writers carry. Hostile counts refuse with a located `ParseError`
  instead of sizing an allocation: a chunk naming more values than its
  bytes could carry, a page naming more than its chunk, an RLE run
  count or a SNAPPY declared length past their bounds. The projection
  is lenient like the text readers': a name the file does not carry
  builds no column (the file's rows over zero columns), and the
  expression that references the name raises the `ColumnNotFound` a
  full read plus a select would — which is also what keeps the lazy
  `scan_parquet` honest when the optimizer absorbs a filter and narrows
  the projection in one pipeline: the predicate's own columns ride the
  decode even when the projection above drops them, the same key-column
  contract the text scans' pruner honours, so a filtered select or a
  filtered group-by collects to exactly its eager spelling.
- The parquet codec reads and writes the spec's own level encodings. A
  V1 data page prefixes its RLE definition-level run with the 4-byte
  little-endian length the format defines (a file MoonFrame wrote
  before this change carried the run bare — those files now refuse on
  read instead of mis-decoding), and a V2 page decodes its levels as
  the RLE / bit-packed hybrid stream the page header itself sizes — no
  prefix, never compressed — where the reader once read a bare bitmap
  no parquet writer emits, under the page type (3) a foreign V2 page
  actually declares. The schema walk reads the repetition type
  and child count too: a REQUIRED column's pages carry no level section
  at all and their values begin at the body's first byte (a foreign
  REQUIRED column was mis-refused before), a group element refuses
  naming the group instead of pairing a chunk under the BOOLEAN the
  absent physical type once defaulted to, and a REPEATED leaf refuses
  the same way. A dictionary page no longer counts its entries into the
  chunk's value total (a dictionary chunk with several data pages
  reads now), a V2 page whose header spells `is_compressed=false`
  decodes its values raw however the chunk's codec votes, a bare INT32
  column reads as a signed `Int`, and the thrift skipper bounds its
  nesting so a footer spelled to recurse refuses with a located
  `ParseError` instead of exhausting the stack.
- The parquet codec carries a conformance pass against the format's own
  definitions. A dictionary page header now reads in the thrift
  bindings' field order — `num_values` before `encoding` — where a
  foreign dictionary page whose entry count spells no legal encoding
  value was refused as unsupported. The footer walk checks the file's
  leading `PAR1` magic alongside the trailing one, so a file is parquet
  from byte zero or refuses. Each rider's schema element carries the
  `LogicalType` annotation beside its converted type — the format's own
  rule that a writer spells both: the union variant the modern readers
  read (`STRING`, `DATE`, `DECIMAL` with its scale before its
  precision, `TIMESTAMP` with the UTC-adjusted bool and the `MICROS`
  unit). The thrift skipper reads a byte field (wire type 3) as its
  single raw byte rather than a varint whose continuation bit would
  swallow the next field header.
- A foreign `DECIMAL` column's annotation now carries the format's own
  envelope on read: the precision is required, one to nine digits over
  `INT32`, one to eighteen over `INT64`, up to the payload's capacity
  over `FIXED_LEN_BYTE_ARRAY`, and at most 38 over the legacy
  variable-width `BYTE_ARRAY`, with the scale never past the precision
  — a file declaring past that envelope refuses the column instead of
  reading cells under an annotation the payload cannot honour. The
  writer declares precision eighteen over `INT64` and thirty-eight over
  the wide payload.
- The chart export gains a browser page: `format_vega_html` /
  `write_vega_html` wrap the specification `format_vega_lite` emits in a
  standalone HTML document that loads the Vega runtime from three pinned
  CDN scripts (vega@6.4.0 / vega-lite@6.5.0 / vega-embed@7.3.0) and
  hands the embedded spec to `vegaEmbed` — opening the file renders the
  interactive chart, with vega-embed's action links for SVG / PNG
  export. The channel contract is the spec emitter's (`ColumnNotFound`
  for a column absent from the frame), and the embedded JSON rewrites
  every literal `<` to its `\u003c` escape (the U+2028 / U+2029 line
  separators likewise), so chart data cannot close the host `<script>`
  element early.
- A signed year zero refuses: `-0000-01-01` (and the timestamp spellings
  built on it) read as year 0, but the writer emits year 0 only as the
  unsigned `0000-01-01` — the form the parsers promise to accept — and
  ISO 8601 agrees a signed zero is no year. The signed form now refuses
  like every other shape the writers do not emit; the unsigned one is
  unchanged.
- A year past the ISO 8601 basic range renders in the expanded form's
  own sign: a `Date` or `Timestamp` in year 10000 or beyond now renders
  `+10000-…` where it rendered the bare digits before (the negative side
  always carried its `-`; an expanded year without its sign is no ISO
  spelling). The parser reads the signed spelling back — and still reads
  the bare digits too, the spelling earlier writers emitted — while a
  `+` on a four-digit year and a signed year zero (`+0000-…`, like
  `-0000-…`) refuse as shapes no writer spells.
- `Decimal` becomes an IEEE 754-2019 decimal128 floating-point dtype —
  the fixed-point `Decimal(scale)` over an unscaled `Int64` retires.
  **Source-breaking**: the variant loses its parameter
  (`DataType::Decimal` — a `match` arm spelling `Decimal(scale)` or a
  construction `Decimal(2)` fails to compile) and the scalar carries the
  engine's `Dec128` value (`Scalar::Decimal(Dec128)` — the two-argument
  spelling is gone). The engine (`Dec128`, re-exported on the facade
  beside `DataType` / `Scalar`) is a sign, up to 34 significant digits,
  a per-value quantum exponent in `[-6176, 6144]`, and the exceptional
  shapes ±infinity / NaN / signed zero as **values**: every operation
  computes exactly and rounds once (ties to even), an overflow is ±∞,
  a lost magnitude a signed zero — the fixed-point era's
  `InvalidOperation` refusal family (the envelope check, the checked
  multiplies, the rescale lifts, the sum past 18 digits, the
  negation / round overflows) is gone with the scale it was about.
  Construct decimals with `Dec128::of_int64` /
  `Dec128::of_int64_scale` / `Dec128::parse_opt` / the `nan` /
  `infinity` / `zero` constructors, and build a decimal column with
  `Series::from_scalars(name, cells, dtype=DataType::Decimal)` over
  `Scalar::Decimal` cells (the expression layer's `lit` does the same).
- The decimal arithmetic semantics follow the engine: `+` / `-` / `*` /
  `/` all stay `Decimal` (`Int` lifts exactly; a `Float` operand
  promotes the pair to `Float` through the correctly-rounded
  conversion — the fence the fixed-point era kept between the exact and
  approximate dtypes is a promotion now). Exact results keep the
  cohort's preferred exponent (`1.50 + 0` is `1.50`); `sum` propagates
  NaN and folds +∞ with −∞ into NaN while an overflowing total is ±∞;
  `min` / `max` skip NaN; sorting reads the total order (NaN past
  everything, −0 and +0 equal — the `Float` stack's own shape);
  comparisons, grouping, joins, and `n_unique` read numeric value
  equality, cohorts comparing equal (`1.0` joins `1.00`).
- The decimal value fence is deleted with the refusals it guarded: the
  optimizer's decimal risk family, its wbtests, and the
  `may_carry_decimal` probe the file sources carried are gone, so a
  predicate over decimal arithmetic sinks exactly like one over `Int`
  (the temporal family keeps its fence — the microsecond domain still
  refuses on values). `check_decimal_scale` and
  `parse_decimal_unscaled_opt` retire from the engine seams.
- The casts cross both ways: `Int` → `Decimal` exactly, `Float` →
  `Decimal` the correctly-rounded conversion, `String` → `Decimal` the
  value reader, `Decimal` → `Int` truncating toward zero (the
  exceptionals and out-of-range magnitudes refusing like the `Float`
  source), `Decimal` → `Float` the correctly-rounded conversion,
  `Decimal` → `String` the value rendering. The parquet interchange
  chooses the payload per column at the one adaptive scale every cell
  honours: `INT64` + `DECIMAL` (precision 18) while the scale is at
  most eighteen and every lifted magnitude fits eighteen digits, and
  otherwise the format's wide decimal — `FIXED_LEN_BYTE_ARRAY`(16) +
  `DECIMAL` (precision 38, big-endian two's complement). A NaN / ±∞
  cell always refuses (the fixed-point interchange has no exceptional
  spelling), as does a column past the 16-byte payload's own window (a
  scale past 38, or a lifted magnitude past 38 digits). Reading takes
  the annotation at the format's word: a `FIXED_LEN_BYTE_ARRAY` of any
  width from one to sixteen bytes strides and decodes exactly while the
  precision stays inside the format's capacity rule
  (`floor(log10(2^(8n−1) − 1))` digits), `INT32` + `DECIMAL` covers the
  small-value payload, and the legacy variable-width `BYTE_ARRAY` +
  `DECIMAL` trims its redundant sign-extension bytes. A foreign payload
  carrying more than the dtype's 34 significant digits rounds once into
  the engine.

## v0.8.0 → v0.8.1

No source-level migration steps. v0.8.1 is an additive patch: every v0.8.0
symbol and signature is unchanged, and nothing is renamed, removed,
re-signed, or given a new required `match` arm. What the patch adds: the
always-`Float` math family on `Expr` (`sqrt` / `cbrt` / `exp` / `ln` /
`log2` / `log10`, the trigonometric and hyperbolic pairs, and the binary
`atan2` / `hypot`, each taking any numeric operand and producing a
`Float` column); `DataFrame::shuffle` plus `sample` re-seeded on the
chacha8 generator — both remain deterministic in their seed, but the
concrete rows a given seed selects differ from v0.8.0's; the readers'
dtype override (`dtypes~` on `CsvReadOptions` / `JsonReadOptions`, with a
`dtypes()` accessor) and the lazy `scan_json`, the JSON counterpart of
`scan_csv` / `scan_ndjson`; and transparent gzip on the io paths — a
`.gz`-suffixed write compresses, and a read whose leading bytes carry the
gzip magic decompresses on the fly. Riding along: the decimal value fence
covers a right join's clashing left column and `clip`, blank JSON input
asserts its dtype pins the way the empty array does, and the kernel /
optimizer hot paths dropped their per-walk allocations.

## v0.7.0 → v0.8.0

The operator-alignment sprint widens the join vocabulary and the dtype
set: three public enums each gain variants — `JoinType` the two joins,
`DataType` / `Scalar` the two `I64`-rider dtypes — under the repo's standing
exception that an enum may add
variants within a breaking release. Everything else the sprint adds is
additive — new verbs (`pivot` / `unpivot`, the positional / rolling /
cumulative families, the `dt_*` quartet, the null toolbox, the
distinctness predicates `is_duplicated` / `is_unique` / `unique_counts`,
`mode` / `sample` / the `top_k` family, `rank` / `quantile` on every
spelling, the dispersion reductions `median` / `std` / `variance`, the
named-aggregation verbs on `GroupedDataFrame` / `LazyGroupBy`, the
`iter` / `iter2` / `iter_rows` iteration family, and
`DataType::is_summable`), new enums (`PivotAgg`, `RankMethod`,
`QuantileInterpolation`), and error-facing tightenings that turn silent
output into a `raise` on inputs no caller could have relied on. One
withdrawal rides along, forced by the toolchain rather than the sprint —
the Parquet interchange below.

### The Parquet interchange is withdrawn

`read_parquet` / `write_parquet` (with the string-level `format_parquet` /
`parse_parquet` and the lazy `scan_parquet`) are gone. The interchange rode
the `mizchi/parquet` reader/writer, whose dependency chain
(`mizchi/duckdb`) still ships the module-manifest format the current
MoonBit toolchain no longer parses — the package cannot be installed at
all, so the feature cannot ship with it. The wire format returns when the
upstream package publishes a toolchain-compatible release. Until then,
move Parquet data through CSV — the interchange landed and was withdrawn
on unreleased `main` only, so no released MoonFrame carries it and there
is no older version to pair an older toolchain with.

### `JoinType` gained `Semi` / `Anti`

`JoinType::Semi` and `JoinType::Anti` — the existence filters, Polars'
`how="semi"` / `how="anti"` — join the enum, which makes an exhaustive
`match` over it fail to compile until the two variants are handled. Add the
arms (a `Semi` / `Anti` join keeps the left schema and filters rows by
whether a key match exists in the right frame); a `match` that ends in a
`_` arm needs no change.

### `n_unique` counts a null as one distinct value

`n_unique` aligns with Polars: a null cell is one distinct value, so a
column with nulls counts one more than it used to, and an all-null column
now returns `1` (was `0`); an empty column is still `0`. Every spelling
moves together — `Series::n_unique`, `Expr::n_unique`, the whole-frame and
grouped verbs, and `describe`'s `n_unique` row. `count` still counts
non-null cells, so the old reading's inputs remain reachable through
`count` and `null_count`.

### `vstack` refuses a slot whose column name differs

`vstack` aligns with Polars: the stacked frame's schema must agree with
`self`'s column-for-column — same count, same name in each slot, same
dtype — where it used to check only count and dtype, silently stacking a
renamed or reordered column's values under another name. Rename or reorder
`other`'s columns (`select`) before stacking when the sources genuinely
differ.

### A null `clip` bound leaves the operand cell untouched

`clip` aligns with Polars' post-1.0 reading: a null bound cell is no bound
on that side, so a present operand cell passes through where the old
nested-`when` lowering nulled it. A null operand cell still stays null,
and both bounds null keep the column unchanged. `clip` and `diff` also
moved onto dedicated AST nodes — a chained clamp or difference now renders
and evaluates linearly where the lowering embedded the operand 4 (resp. 2)
times per link — with no spelling change at the call site.

### A right join leads with the right frame's columns

`how=Right` aligns with Polars' swapped-left-join reading: the right
frame's columns lead in right order (the coalesced key among them, its
values from the right), the left frame's non-key columns follow in left
order, and a left column clashing with a right name takes the suffix
(where it used to be the right one suffixed, the left columns leading).
Downstream code that indexed a right join's output by position, or that
read the suffixed spelling, moves with it.

### `str_to_lowercase` applies Final_Sigma, and the case tables name UCD 18.0.0

A word-final `Σ` lowercases to `ς` (a medial one to `σ`), by the cased /
case-ignorable characters around it — the one contextual rule the default
conversion carries, matching Polars and Rust's `str::to_lowercase`; the
locale rules (Turkish dotless `i`) stay unapplied. The mapping tables
themselves were always generated from UCD 18.0.0 data, but the file
header claimed 16.0.0 (a hand-edit at the original commit, three
editions' worth of newer mappings ago); the regenerated header names the
edition the tables came from, and now also carries the `Cased` /
`Case_Ignorable` ranges Final_Sigma reads.

### `JsonReadOptions` gains `allow_nonfinite_floats`; duplicate-key errors name a position

The JSON family grows the CSV reader's non-finite gate: with
`allow_nonfinite_floats=false` a number that overflows `Double` (e.g.
`1e999`) is not `Float` evidence, so the column stays `String` instead of
being silently retyped to `Float(∞)`. The default is unchanged. And
`reject_duplicate_keys` now rides the parser itself instead of a
pre-parse scan: the error names the key's line and column (the scan named
the 1-based object number), and whichever trouble the parser meets first
— a repeat or a syntax error — is the one reported.

### `DataType` / `Scalar` gained `Timestamp` / `Decimal` variants

`DataType::Timestamp` and `Scalar::Timestamp(micros)` — microseconds since
the Unix epoch, UTC — and `DataType::Decimal(scale)` /
`Scalar::Decimal(scale, unscaled)` — a fixed-point decimal whose value is
`unscaled × 10⁻ˢᶜᵃˡᵉ` over an `Int64` — are new, which makes an exhaustive
`match` over either enum fail to compile until the variants are handled.
Both ride the same 64-bit buffer an `Int` column always held, so nothing
about column storage changes; what each means is documented on the enum.
The decimal envelope — `scale` in `[0, 18]` — is enforced where a decimal
dtype is built (`InvalidOperation` outside it), `+` / `-` / `*` are exact
across scales and refuse (never wrap) when a magnitude or a product's
scale leaves the range, and `sum` keeps the dtype under the same refusal.
The readers never infer either dtype: a written-back `Timestamp` /
`Decimal` column reads as `String` / `Float` respectively. A `match` that
handles every variant *except* by a catch-all `_` arm needs no change.

## v0.6.0 → v0.7.0

v0.7 is a pre-1.0 breaking release — the surface-focus one: `io` returns to
tabular interchange and the root facade narrows its first-contact face. Those
breaks are qualification moves. The widening break is the `Date` dtype: two
public enums gained a variant. The narrow one is on the error side: the two
error-detail enums became `#non_exhaustive`. Nine value-type members were
removed — predicates and comparisons that spelled out what a pattern match,
a column expression, or the comparison kernel already says — and two enums
are deleted outright: the sort vocabulary became Polars' two flags. The
nullable series constructors likewise converged into one, the window
verbs took Polars' saturating semantics — `slice` never raises, and a
negative `head` / `tail` count drops from the opposite end — and floats
now order by IEEE-754: `NaN` is a value in `sort` and propagates through
`median`. String case mapping and the default trim set went Unicode, and
the standards review closed two smaller gaps: `Date` renders ISO-8601
years zero-padded, and the CSV writer gained Polars' `line_terminator`
knob. The column selectors became `DataFrame` methods — the frame appears
once at the call site instead of twice.

### `DataType` / `Scalar` gained a `Date` variant

`DataType::Date` and `Scalar::Date(days)` (whole days since the Unix epoch)
are new, which makes an exhaustive `match` over either enum fail to compile
until it handles the variant. Add a `Date` arm — what the variant means is
documented on the enum, and a column of it rides the same 64-bit buffer an
`Int` column always held, so nothing about column storage changes. A
`match` that handles every variant *except* by a catch-all `_` arm needs no
change.

### Error-detail matches carry a `..` arm

`TypeMismatchDetail` and `ParseErrorDetail` are now `#non_exhaustive`, so an
exhaustive `match` over either fails to compile until it ends in a `..`
catch-all (a plain `_` arm still compiles but warns — the `..` spelling is
the blessed one). Add the arm and treat an unknown shape as you would an
unknown diagnostic today:

```moonbit
fn describe(detail : @moonframe.TypeMismatchDetail) -> String {
  match detail {
    Message(m) => "type mismatch: \{m}"
    Expected(expected, got, _) => "expected \{expected}, got \{got}"
    Operation(op, left, right) => "cannot \{op} \{left} and \{right}"
    @moonframe.TypeMismatchDetail::.. => "type mismatch"
  }
}
```

From v0.7.0 on, a new diagnostic shape added to either enum is **not** a
breaking change: this arm absorbs it. `DataError` itself is unchanged — a
new error kind remains a deliberate, breaking change.

### Nine value-type members are removed

`DataType` loses the four single-variant predicates `is_bool` / `is_float` /
`is_integer` / `is_string`, and `Scalar` loses the five raising comparisons
`eq` / `lt` / `gt` / `lte` / `gte`. What stays is the part that carries
semantics a caller cannot spell another way: `is_numeric` reads the dtype
registry (a `Date` rides the `Int` buffer yet is not numeric), and the
`as_*` accessors are the typed reads behind every `item()` / `get()`. A
single-variant check is what a pattern match says in MoonBit, and a cell
comparison is a column-level concern — the expression verbs
`col("a").eq(...)` / `.lt(...)` / `.gt(...)`, whose dtype matrix (including
the exact, promotion-free `Int` ↔ `Float` comparison) has its one home on
the comparison kernel:

```moonbit
// before
if field.dtype().is_integer() { ... }
assert_eq(Scalar::Int(2).gte(Scalar::Int(2)), true)

// after
if field.dtype() is Int { ... }
// compare cells through the column: an expression over the frame
let flagged = df.filter(col("q").gte(lit_int(2)))
```

### Column selectors are `DataFrame` methods

The six column-selector free functions — `numeric_cols`, `cols_of_dtype`,
`cols_matching`, `cols_starts_with`, `cols_ends_with`, `cols_contains` —
are methods of `DataFrame` now, so the free-function spellings (and their
root-facade re-exports) are gone. Each reads the frame it is called on;
the `df` argument the free function took at the front is the receiver:

```moonbit
// before
df.select(numeric_cols(df))

// after
df.select(df.numeric_cols())
```

### `SortOrder` / `NullOrder` are gone; sort keys are two flags

Sort direction and null placement leave the enum vocabulary — they are
Polars' `descending` / `nulls_last` flags now. `DataFrame::sort` /
`LazyFrame::sort` take `(key, descending, nulls_last)` tuples, and
`Series::sort` takes labeled `descending?` (default `false`) /
`nulls_last?` (default `true`, the previous default). The mapping is
mechanical:

| before | after |
| --- | --- |
| `SortOrder::Asc` | `false` |
| `SortOrder::Desc` | `true` |
| `NullOrder::NullsFirst` | `false` |
| `NullOrder::NullsLast` | `true` |

```moonbit
// before
df.sort([(col("quantity"), SortOrder::Desc, NullOrder::NullsLast)])
s.sort(order=Desc, nulls=NullsFirst)

// after
df.sort([(col("quantity"), true, true)])  // (key, descending, nulls_last)
s.sort(descending=true, nulls_last=false)
```

An `explain` rendering does not change: a plan still reads
`SORT [col(qty) Desc NullsLast]`.

### `CsvWriteOptions` gains `line_terminator`, and its constructor `raise`s

Polars' `line_terminator` knob arrives additively — default `"\n"`
unchanged, `"\r\n"` for RFC 4180's letter — and the reader takes every
CR/LF combination (`"\r"`, `"\n\n"`, …) back without a knob. The one
signature change: the constructor now `raise`s `InvalidOperation` on a
terminator it cannot round-trip — an empty one (it would fuse every row
into one) or one holding any character other than `\n` / `\r` (the reader
breaks lines on those alone, so anything else fuses rows or glues itself
onto the last cell). So a `CsvWriteOptions::CsvWriteOptions(...)` call in
a non-raising context needs the usual `catch` / propagation.

### A file that is not UTF-8 now raises

Every `read_*` entry point decodes strictly: a file whose bytes are not
well-formed UTF-8 used to reach the parsers through a lenient decoder,
which merged a stray byte with the ones after it — swallowing a delimiter
or a quote and shifting every cell boundary that followed — or silently
dropped the rest of the file, so a Latin-1 or otherwise non-UTF-8 file
produced confidently wrong data with no error. It now raises
`DataError::ParseError` naming the first malformed byte's offset. Files
that are valid UTF-8 (a leading BOM included) read exactly as before.

### `Date` renders ISO-8601 years zero-padded to four digits

A `Scalar::Date` whose year is under 1000 used to render without its ISO
padding — year 800 as `800-…`, year 0 as `0-…` — where ISO 8601's `YYYY`
basic range is `0000`–`9999`. It now renders `0800-…` and `0000-01-01`,
a negative year carries its sign over a padded magnitude (`-0002-09-16`),
and a year beyond 9999 keeps its expanded spelling (`-194022-09-24`).
Dates in 1000–9999 — every date a reader or the epoch neighbourhood
produces — render exactly as before.

### Floats order by IEEE-754: `NaN` is a value in `sort` and `median`

The two bespoke "`NaN` behaves like missing" rules are gone, replaced by the
IEEE-754 total order and Polars' own behaviour. In `sort`, a `Float` `NaN` no
longer follows the key's `nulls_last` flag like a null — it orders as the
largest value, trailing an ascending sort and leading a descending one,
independent of where the nulls sit. In `median`, a `NaN` no longer drops out
of the window — it propagates, as `sum` / `mean` always have; the median of
`[1, 2, NaN]` is now `NaN` (was `1.5`), and the median of an all-`NaN`
column is `NaN` (was an empty-window `InvalidOperation` on the whole-column
path). `min` / `max` keep skipping it, null placement keeps its
direction-independent model, and only `null` is missing.

### String case mapping and the default trim set go Unicode

`str_to_uppercase` / `str_to_lowercase` map every cased letter through the
Unicode **default case conversion** — the simple one-to-one mappings (`é`
→ `É`, Greek and Cyrillic across their alphabets) plus the SpecialCasing
expansions — where they were ASCII-only before. A cell's length can grow:
`straße` uppercases to `STRASSE` (`ß` → `SS`), the `ﬁ` ligature to `FI`,
and `İ` lowercases to `i` + combining dot above. The locale-conditional
rules (Turkish dotless `i`, final sigma) are not applied — the default
conversion carries no locale. The default `str_strip_chars` set widens from
ASCII whitespace to the Unicode `White_Space` property — NBSP, the narrow
no-break space, and the ideographic space now trim alongside tab, newline,
carriage-return, and space. A custom `chars` set is unchanged.

### `slice` is Polars' saturating window, never an error

`DataFrame::slice` / `Series::slice` / `LazyFrame::slice` change both shape
and temperament: they take Polars' `slice(offset, length)` — a negative
`offset` counts from the end, an omitted `length` runs to the end, a given
one saturates at what remains, and a negative one is empty — and they never
raise, where the old half-open `[start, end)` form raised
`IndexOutOfBounds` / `InvalidOperation` on a window it would not honour:

```moonbit
// before
df.slice(1, 3)          // rows [1, 3), raising on bad bounds

// after
df.slice(1, length=2)   // the same two rows
df.slice(-2)            // the last two rows (new: negative offset)
df.slice(1)             // row 1 to the end (new: omitted length)
```

An `explain` node renders the new shape: `SLICE [1: 2]`, and `SLICE [-2: ]`
when the length is omitted.

### `head` / `tail` with a negative `n` drop from the opposite end

`DataFrame::head` / `tail` (and the `Series` twins, and `limit`) follow
Polars' convention where they used to clamp a negative `n` to an empty
frame: `head(-2)` keeps every row but the last two, `tail(-2)` every row
but the first two, and a `|n|` past the frame's height leaves nothing.
`df.head(-1)` was `0×N`; it is now `(N-1)×N`.

### `Series::sort` places nulls first by default

The default for `nulls_last` moves from `true` to `false` — Polars' own
default, which places missing cells at the head of an ascending sort. An
omitted flag used to read `sort(nulls_last=true)`; it now reads
`sort(nulls_last=false)`. `DataFrame::sort` / `LazyFrame::sort` keys spell
both flags explicitly and are unchanged, as is the rule that missing
placement does not flip with `descending`.

### Nullable series construction is one constructor

`Series::from_int_options` / `from_float_options` / `from_bool_options` /
`from_string_options` leave the public surface — the engine still builds
nullable columns through them, but a caller constructs one through the new
`Series::from_scalars`, Polars' `pl.Series(name, [1, None])` translated to a
statically-typed language: the cells carry their own nullness as `Scalar`, and
the dtype is inferred from the first non-null cell or locked with `dtype~`:

```moonbit
// before
Series::from_int_options("score", [Some(1), None, Some(3)])

// after
Series::from_scalars("score", [
  Scalar::Int(1),
  Scalar::Null,
  Scalar::Int(3),
])
```

Every non-null cell must carry the target dtype exactly — an `Int` cell in a
`Float` column is a `cast`, not a construction, so it `raise`s
`TypeMismatch`. An all-null column needs `dtype~` (nothing can be inferred,
`InvalidOperation`), and `dtype~ = Null` names no physical column
(`Unsupported`). The null-free `from_ints` / `from_floats` / `from_bools` /
`from_strings` stay as they were. `from_scalars` is also the first public way
to build a `Date` column: `from_scalars("d", [Scalar::Date(5L), Scalar::Null])`.

### `@io.ChartSpec` is `@chart.ChartSpec`

Chart export (Vega-Lite) moved from `io` to the new `chart` package, along
with `ChartKind` / `VegaType` / `format_vega_lite` / `write_vega_lite`. The
root facade re-exports them from the new home, so `@moonframe.ChartSpec` and
the unqualified facade spellings keep working; only code that names the chart
types through `@io` moves:

```moonbit
// before
let spec : @io.ChartSpec = @io.ChartSpec::bar("region", "revenue")
@io.write_vega_lite("chart.vl.json", df, spec)

// after
let spec : @chart.ChartSpec = @chart.ChartSpec::bar("region", "revenue")
@chart.write_vega_lite("chart.vl.json", df, spec)
```

### The string-level serialisers left the root facade

`parse_csv_str` / `parse_json_str` / `parse_ndjson_str` and `format_csv` /
`format_json` / `format_ndjson` are still public in `io` — same signatures —
but the root facade no longer re-exports them. Import the io package and
qualify:

```moonbit
// before (through the facade)
let df = parse_csv_str("a,b\n1,2\n")

// after
let df = @io.parse_csv_str("a,b\n1,2\n")
```

The file-level verbs (`read_csv` / `read_json` / `read_ndjson` /
`write_csv` / `write_json` / `write_ndjson`), the three option types, and
`OnParseError` stay on the facade.

## v0.5.8 → v0.6.0

v0.6 is a pre-1.0 breaking release — the API-convergence one. Where two
spellings existed for building or configuring the same value, v0.6 keeps a
single entry point; there are no deprecated aliases.

### A declared `nullable` survives the projections

`Field.nullable = false` used to be reset by any op that re-derived a schema,
so a projection could quietly widen a caller's declared constraint. It is now
carried by every op that only moves a column, and re-derived only by ops that
compute cells. Nothing needs rewriting to compile; what changes is the schema
of the result — and, through the derived `Eq`, frame equality.

| expression (over a `from_rows` frame declaring `id` non-nullable) | v0.5 | v0.6 |
| --- | --- | --- |
| `df.select([col("id")]).schema().field("id").nullable()` | `true` | `false` |
| `df.drop([col("other")]).schema().field("id").nullable()` | `true` | `false` |
| `df.with_columns([lit_int(0).with_alias("n")])` … `id` | `true` | `false` |
| `df.with_row_index()` … `id` | `true` | `false` |
| `df.select([(col("id") + lit_int(1)).with_alias("id")])` … `id` | `true` | `true` |

If you were relying on a projection to *widen* a declared field — using
`select` to hand a non-nullable column to code that expects a nullable one —
state it explicitly: rebuild through `DataFrame::from_rows` with the schema you
want, or `DataFrame::DataFrame(df.column_series())`, whose derived schema
declares everything nullable.

### A column-less frame keeps its rows

Projecting a frame to zero columns used to return `0×0`, discarding the height.
It now returns `N×0`. Nothing needs rewriting to compile — but code that
*asserted* the old shape, or that treated "no columns" as "no rows", changes:

| expression | v0.5 | v0.6 |
| --- | --- | --- |
| `df.select([]).shape()` (`df` 3-row) | `(0, 0)` | `(3, 0)` |
| `df.drop(every_column).shape()` | `(0, 0)` | `(3, 0)` |
| `from_rows(Schema::Schema([]), [[], []]).shape()` | `(0, 0)` | `(2, 0)` |
| `parse_json_str("[{},{}]").shape()` | `(0, 0)` | `(2, 0)` |
| `df.select([]).is_empty()` | `true` | `false` |

`DataFrame::DataFrame([])` is unchanged at `0×0` — it infers its height from
the columns it is given. If you relied on a zero-column result reporting
`is_empty()`, test `ncols() == 0` instead. `check_invariants()`' INV7 changed
with it: from "a column-less frame is row-less" to `nrows >= 0`.

### `Field` has one constructor, and its fields are private

| v0.5 | v0.6 |
| --- | --- |
| `Field::new("age", Int)` | `Field::Field("age", Int)` |
| `Field::with_nullable("id", Int, false)` | `Field::Field("id", Int, nullable=false)` |
| `f.name` / `f.dtype` / `f.nullable` | `f.name()` / `f.dtype()` / `f.nullable()` |

`struct Field` is opaque: a record literal (`{ name: "age", dtype: Int,
nullable: true }`) outside `types` no longer compiles — build through
`Field::Field(...)` — and the three fields are `priv`, read through the
accessors of the same names. Reading a field was the smaller half of what
public fields allowed; the larger half was destructuring one, and since a
struct pattern must name every field or carry `..`, that would have made any
field this type gains later a breaking change. The options records
(`CsvReadOptions`, `CsvWriteOptions`, `JsonReadOptions`, `HtmlOptions`,
`JoinOptions`, `ChartSpec`) keep their readable fields — inspecting them is
their read API — at that same documented cost. The exceptions are the fields
holding a mutable array, `CsvReadOptions.null_values` and `JoinOptions`' three
key lists: reading one of those would hand back the array itself, so each is
private behind a copying accessor (`null_values()`, `on_keys()` /
`left_keys()` / `right_keys()`).

### IO options are built by constructor

| v0.5 | v0.6 |
| --- | --- |
| `CsvReadOptions::default()` | `CsvReadOptions::CsvReadOptions()` |
| `{ has_header: true, delimiter: ';', infer_schema_rows: 100, null_values: [""], strict_column_count: false, on_parse_error: Raise, allow_nonfinite_floats: true }` | `CsvReadOptions::CsvReadOptions(delimiter=';')` |
| `CsvWriteOptions::default()` | `CsvWriteOptions::CsvWriteOptions()` |
| `JsonReadOptions::default()` | `JsonReadOptions::JsonReadOptions()` |
| `NdjsonReadOptions::default()` | `JsonReadOptions::JsonReadOptions()` |
| `parse_csv_str(text, options, strict_quotes=true)` | `parse_csv_str(text, options=CsvReadOptions::CsvReadOptions(strict_quotes=true))` |
| `format_csv(df, options, sanitize_formulas=true)` | `format_csv(df, options=CsvWriteOptions::CsvWriteOptions(sanitize_formulas=true))` |
| `options.null_values` | `options.null_values()` |

`CsvReadOptions`, `CsvWriteOptions`, and `JsonReadOptions` are `pub` rather than
`pub(all)`, so a record literal no longer compiles outside `io`; every field has
a constructor parameter with the previous default, and only what differs needs
naming. Their fields stay readable — with one exception, `null_values` below —
which is the point of an options record, and also why a field added later is
*not* additive: a public field can be destructured, and a struct pattern must
name every field or carry `..`. Field additions to these types ride the minor
version, like a new `pub(all)` enum variant.

`NdjsonReadOptions` is removed: what took it in v0.5 — the NDJSON reader and
the then-current `scan_ndjson_with_options` — takes `JsonReadOptions`, which has
the same two fields. (Those `*_with_options` names are themselves v0.5 spellings;
the same release folded them into the plain entry points, so the v0.6 call is
`scan_ndjson(path, options=…)`. See the table below.)

The `strict_quotes` and `sanitize_formulas` parameters are gone from the v0.5
`parse_csv_str` / `read_csv_with_options` / `read_csv_projected` and
`format_csv` / `write_csv_with_options`; set them on the options instead. The
lazy scan picks up strict quote validation this way, which the parameter form
could not express.

`CsvReadOptions.null_values` is now private, read through `null_values()`, which
returns a copy — as does the constructor, so mutating either array cannot change
what a reader (or a captured `scan_csv` plan) treats as null.

### A filtered file scan can no longer report a dropped row's parse error

`scan_csv` / `scan_ndjson` now push a predicate into the read. Nothing about
values or dtypes changes — inference still walks the whole file — but a
`ParseError` in a row the predicate drops, in a column the predicate does not
read, is no longer raised, because those cells are never parsed. This is the
same trade projection push-down has always made for dropped *columns*. Code
that relied on a lazy pipeline failing on a malformed row it filters away
should read eagerly (`read_csv(path).filter(...)`) instead.

### The JSON entry points complete the verb grid

| v0.5 | v0.6 |
| --- | --- |
| `parse_json_records_str(text)` | `parse_json_str(text)` |
| `format_json_records(df)` | `format_json(df)` |
| `write_json_records(path, df)` | `write_json(path, df)` |

`read_json` already dropped the qualifier, so the records shape now has the
same four-verb spelling as CSV and NDJSON — `read` / `write` / `parse_*_str` /
`format` — and the wire shape (`[{...}, ...]`) is documented on the functions
rather than in their names.

### `SortOrder` / `NullOrder` moved to `types`

They now live beside `DataType` / `Scalar`, because `Series::sort` (new in
v0.6) names them and `series` sits below `frame`. Through the facade nothing
changes — `SortOrder::Desc` still resolves — but a direct package import needs
the new home:

| v0.5 | v0.6 |
| --- | --- |
| `@frame.SortOrder::Desc` | `@types.SortOrder::Desc` |
| `@frame.NullOrder::NullsLast` | `@types.NullOrder::NullsLast` |

### `DataError::TypeMismatch` / `ParseError` carry structured detail

In v0.5 both variants held a flat `String`. They now hold typed detail enums —
`TypeMismatchDetail` and `ParseErrorDetail` — so a handler can branch on the
failure instead of parsing a message. The rendered text
(`DataError::message()`) is unchanged, so a `catch` that only formats the error
needs no change; a `match` that bound the string does:

| v0.5 | v0.6 |
| --- | --- |
| `TypeMismatch(msg)` — `msg : String` | `TypeMismatch(detail)` — `detail : TypeMismatchDetail` |
| `ParseError(msg)` — `msg : String` | `ParseError(detail)` — `detail : ParseErrorDetail` |
| `e.message()` | `e.message()` (unchanged) |

### `Expr` is opaque; `ClosedInterval` moved to `types`

The expression tree is no longer a matchable `pub enum Expr`. It is an opaque
handle whose AST (`ExprNode` and the `BinOp` / `UnOp` / `AggOp` / `StrOp` tags)
lives in the module-internal `internal/ir` package. Building expressions is
unchanged; code that *matched* an `Expr`'s variants from outside `MoonFrame`
must instead render it with `Expr::to_string` (the AST was never an intended
consumption surface):

| v0.5 | v0.6 |
| --- | --- |
| `match expr { @expr.Col(name) => … }` | `expr.to_string()` (no variant match) |

`ClosedInterval` (the `is_between` `closed?` argument) is new in v0.6 and lives
in `types`, beside the AST that carries it — `@moonframe.ClosedInterval` through
the facade, `@types.ClosedInterval` through a direct sub-package import. There
is nothing to move: v0.5 had no such type.

### `Expr` and `JoinOptions` no longer compare with `==`

Expression equality compared the internal tree, which made *how an operator
lowers* observable: a release that normalised a tree or merged two node kinds
would have changed what compared equal, without changing what any expression
means. The impl is removed rather than promised. `JoinOptions` holds
expressions as its key lists, so its derived equality goes too.

Compare renderings, which is what `explain()` prints and what stays stable:

| v0.5 | v0.6 |
| --- | --- |
| `assert_eq(built, col("a") + lit_int(1))` | `assert_eq(built.to_string(), (col("a") + lit_int(1)).to_string())` |
| `opts_a == opts_b` | compare `how` / `suffix` / `coalesce` and the rendered `on_keys()` / `left_keys()` / `right_keys()` |

Rendering does not distinguish what it does not print: a `lit_series` shows as
its name and length, so two literal series over different cells render alike.

### `unique` takes a subset, and is now fallible

`DataFrame::unique` gained Polars' `subset` — the columns whose values form the
duplicate key — which makes it `raise DataError` (`ColumnNotFound`) instead of
total. Existing calls keep their behaviour but now need a `raise` context (or a
`catch`), exactly like `filter` / `select` beside them:

| v0.5 | v0.6 |
| --- | --- |
| `let out = df.unique()` (total) | `let out = df.unique()` (raises) |
| — | `df.unique(subset=[col("id")], keep=Last)` |

`LazyFrame::unique` takes the same `subset?` and stays total at build time; an
unknown name surfaces at `collect`.

### One name per concept

| v0.5 | v0.6 |
| --- | --- |
| `df.take(indices)` | `df.gather(indices)` |

`Series::gather` is unchanged; `DataFrame::take` took the same name as in
Polars.

Regex string matching is new in v0.6 and arrives as a `literal? : Bool` argument
on the existing methods (`expr.str_contains(pat, literal=false)`), not as a
separate `*_regex` name. The default stays `true`, so every v0.5 call is
unaffected and renders in `explain` exactly as before.

`Expr::children` / `referenced_columns` / `output_name` are now `#internal`
(engine seams). `LazyFrame::unique` accepts `keep?` like the eager verb — a
pure addition.

### Canonical constructors are the type's own name

| v0.5 | v0.6 |
| --- | --- |
| `DataFrame::new(columns)` | `DataFrame::DataFrame(columns)` |
| `Schema::new(fields)` | `Schema::Schema(fields)` |
| `lazy_frame(df)` | `LazyFrame::LazyFrame(df)` |

Construction is one spelling everywhere: `Type::Type(...)`. These three renames
put the data types on it, and the constructors listed in the sections above
(`Field::Field`, `CsvReadOptions::CsvReadOptions`, `HtmlOptions::HtmlOptions`,
…) are written the same way — no constructor is exposed as a free function, so
the `lazy_frame` the facade re-exported is gone with them. The spelling reads
the same through the facade (`@moonframe.DataFrame::DataFrame(...)`) as through
a direct package import (`@frame.DataFrame::DataFrame(...)`).

A type whose construction genuinely has several shapes keeps a named
constructor per shape, so `DataFrame::empty`, `DataFrame::from_rows`, the eight
`Series::from_*`, `JoinOptions::on` / `left_on` / `cross`, and
`ChartSpec::bar` / `line` / `point` / `area` are unchanged.

### Duplicate entry points are removed

| v0.5 | v0.6 |
| --- | --- |
| `Expr::col("a")` | `col("a")` |
| `Expr::lit(scalar)` | `lit(scalar)` |
| `expr.explain()` | `expr.to_string()` |
| `LazyFrame::from(df)` | `LazyFrame::LazyFrame(df)` |
| `Series::new(name, storage)` / `Series::from_builtin(name, column)` | `Series::from_ints` / `from_floats` / `from_strings` / `from_bools` / `from_*_options` |

`LazyFrame::explain` is untouched — it renders an actual query plan, not a
string alias. Inside the (now private) column layer, `NumericColumn::from_int64s`
/ `from_doubles` and `ColumnStorage::from_builtin` / `from_numeric` collapsed
into `from_ints` / `from_floats` and the enum variants.

### The engine seams and text helpers are no longer public

`compare_string_lex`, `is_decimal_int_literal`, and `format_scalar_literal`
were re-exported by the facade in v0.5; they are gone from it. They — plus
`escape_debug` and the two literal parsers — now live in the private packages
`internal/text` / `internal/literal`, and `types`' `fold_extremum` /
`double_fits_int64` in `internal/numeric`; downstream code cannot import any of
them, since MoonBit refuses a cross-module `internal/` import outright. They are
not hidden-but-present in `types`: that package declares none of them any more.
Their behaviour is still part of the library's contract where it is observable:
string ordering is by Unicode code point (`Series::sort` / `DataFrame::sort` /
`Scalar::lt`), and literal parsing drives CSV / JSON type inference.

`series`' kernel functions (`gather_series`, `reducer_for`, `key_cell`, …, plus
`ReduceOp` / `KeyCell`) and `io`'s `read_csv_projected` /
`read_ndjson_projected` take the other route: they stay in place, marked
`#internal` — still `pub` for the library's own use across packages, but absent
from the generated interfaces and warned about from another module. Use the
`Series` methods and `DataFrame` verbs built on them, and `scan_csv` /
`scan_ndjson` for projection push-down.

### The storage-backend methods are engine seams

`Series::storage` / `storage_kind` / `is_canonical` / `mean_opt` and
`DataFrame::to_scalar_matrix` are no longer public API. They remain `pub`
because another package in the library needs them, but they are marked
`#internal`, so they are absent from the generated interface and calling them
from another module warns.

`DataFrame::storage_kinds`, `Series::to_numeric` / `to_builtin` and
`DataFrame::to_numeric` / `to_builtin` are gone outright rather than hidden.
Nothing selects a backend: a column takes the unboxed fast path when the
operation that produced it canonicalises *and* its content allows it (see
[`performance.md`](performance.md#the-numeric-fast-path)), and the constructors
are the closest thing to asking for one —
`from_ints` / `from_floats` build a `Numeric` column, the nullable
`from_*_options` a `Builtin` one.

They existed to expose the columnar backend, which moved to `internal/column`
in v0.6. Value-level access covers the user-facing cases: `Series::get` /
`to_scalars` and the typed constructors instead of a `ColumnStorage`,
`DataFrame::rows` / `row` / `item` instead of `to_scalar_matrix`, and
`Series::mean` (catching its error) instead of `mean_opt`.

### Builders fold into their constructors

| v0.5 | v0.6 |
| --- | --- |
| `HtmlOptions::default()` | `HtmlOptions::HtmlOptions()` |
| `HtmlOptions::default().with_max_rows(20).with_caption("S")` | `HtmlOptions::HtmlOptions(max_rows=20, caption="S")` |
| `df.to_html_with_options(opts)` | `df.to_html(options=opts)` |
| `df.to_markdown_with_limit(10)` | `df.to_markdown(max_rows=10)` |
| `JoinOptions::on(keys).with_how(Left)` | `JoinOptions::on(keys, how=Left)` |
| `JoinOptions::on(keys).with_coalesce(true)` | `JoinOptions::on(keys, coalesce=true)` |
| `JoinOptions::left_on(l).with_right_on(r)` | `JoinOptions::left_on(l, right_on=r)` |
| `JoinOptions::cross().with_suffix("_r")` | `JoinOptions::cross(suffix="_r")` |
| `ChartSpec::bar(x, y).with_color("region").with_title("T")` | `ChartSpec::bar(x, y, color="region", title="T")` |

Two shapes stop compiling by design. `JoinOptions::left_on(keys)` on its own is
gone — `right_on~` is required, so a sided join always names both sides — and
there is no longer a way to set `on` *and* `left_on` / `right_on` on the same
options, which used to be a runtime `InvalidOperation`.

An options value is built like every other constructor —
`let opts = HtmlOptions::HtmlOptions(max_rows=20)`, or inline at the call.

### `*_with_options` is folded into an optional parameter

| v0.5 | v0.6 |
| --- | --- |
| `read_csv_with_options(path, opts)` | `read_csv(path, options=opts)` |
| `write_csv_with_options(path, df, opts)` | `write_csv(path, df, options=opts)` |
| `read_json_with_options(path, opts)` | `read_json(path, options=opts)` |
| `read_ndjson_with_options(path, opts)` | `read_ndjson(path, options=opts)` |
| `scan_csv_with_options(path, opts)` | `scan_csv(path, options=opts)` |
| `scan_ndjson_with_options(path, opts)` | `scan_ndjson(path, options=opts)` |
| `parse_csv_str(text, opts)` | `parse_csv_str(text, options=opts)` |
| `parse_json_records_str(text, opts)` | `parse_json_str(text, options=opts)` |
| `parse_ndjson_str(text, opts)` | `parse_ndjson_str(text, options=opts)` |
| `format_csv(df, opts)` | `format_csv(df, options=opts)` |
| `parse_csv_str(text, CsvReadOptions::CsvReadOptions())` | `parse_csv_str(text)` |

The options parameter is optional and labelled, so it has to be named at the
call site — and a call that only wanted the defaults can drop it entirely.
`read_csv_projected` / `read_ndjson_projected`, the engine seam behind
projection push-down, keep their positional options.

## v0.5.7 → v0.5.8

No source-level migration steps. v0.5.8 is a fix patch: every v0.5.7 symbol and
signature is unchanged, the root facade `.mbti` is byte-for-byte identical, and
nothing is renamed, removed, re-signed, or given a new required `match` arm. Two
correctness fixes refine edge-case behaviour without touching any API — string
ordering now compares by Unicode code point (so supplementary-plane characters
such as emoji sort by their true scalar value; ordering within the Basic
Multilingual Plane is unchanged), and float-overflow detection during parsing no
longer depends on the standard library's error-message text (parse results are
unchanged). See the [release notes](https://github.com/ihb2032/MoonFrame/releases).

## v0.5.6 → v0.5.7

No source-level migration steps. v0.5.7 is an internal-refactor patch: every
v0.5.6 symbol, signature, and behaviour is unchanged, and nothing is renamed,
removed, re-signed, or given a new required `match` arm. The implementation is
rewritten with current MoonBit syntax with no new or changed surface, so nothing
a consumer imports differs. (The `expr` / `frame` / `lazy` sub-package `.mbti`
files show `#as_free_fn` / `#alias` attributes on `col` / `lit` / `limit`, but
those symbols stay callable exactly as before — see the
[release notes](https://github.com/ihb2032/MoonFrame/releases).)

## v0.5.5 → v0.5.6

No source-level migration steps. v0.5.6 is an additive patch: every v0.5.5
symbol and signature is unchanged, and nothing is renamed, removed, re-signed,
or given a new required `match` arm. The new surface is a `moon bench` benchmark
suite (test-scope only — nothing a consumer imports changes), a declared
`supported_targets` in `moon.mod`, and documentation corrections (see the
[release notes](https://github.com/ihb2032/MoonFrame/releases)).

## v0.5.4 → v0.5.5

No source-level migration steps. v0.5.5 is an additive patch: every v0.5.4
symbol and signature is unchanged, and nothing is renamed, removed, re-signed,
or given a new required `match` arm. The new surface is purely additive — two
introspection predicates, `Series::is_canonical()` and
`BuiltinColumn::placeholders_normalized()`, that assert internal representation
invariants (see the [release notes](https://github.com/ihb2032/MoonFrame/releases)).

## v0.5.3 → v0.5.4

No source-level migration steps. v0.5.4 is an additive patch: every v0.5.3
symbol and signature is unchanged, and nothing is renamed, removed, re-signed,
or given a new required `match` arm. The new surface is purely additive — the
API-consistency aliases (`NumericColumn::from_ints` / `from_floats`,
`JoinOptions::with_left_on`, `DataFrame::limit`) and the `format_scalar_literal`
facade re-export listed in the [release notes](https://github.com/ihb2032/MoonFrame/releases).

## v0.5.2 → v0.5.3

No source-level migration steps: no renames, no signature changes, and no new
required `match` arms. v0.5.3 is a correctness and robustness patch, so the only
changes are behavioural fixes that code should not have depended on:

- A chain of `fill_null` / `fill_nan` now builds in linear time instead of an
  exponentially-sized tree; the results are identical.
- Out-of-range indices in the row-gather path (reached through `DataFrame::take`
  and the join planner) yield a null cell instead of panicking. Code that
  relied on the panic to flag a bad index should validate indices itself.
- `Series::variance` / `std` saturate to `+inf` on intermediate Welford
  overflow rather than returning a spurious finite value.
- A read projection (`read_csv_projected` / `read_ndjson_projected`, and the
  `lazy` scans built on them) that names no column present in the header now
  falls back to reading the full file instead of yielding an empty frame.

## v0.5.1 → v0.5.2

Additive plus two behaviour fixes; no renames.

- `DataError` gains a `NullInNonNullable(String)` variant. A new enum variant
  is the one change the post-v0.5 surface allows: an exhaustive `match` over
  `DataError` without a wildcard arm must add a `NullInNonNullable(_)` case.
- `DataFrame::from_rows` now raises `NullInNonNullable(name)` when row data
  places a null in a field declared `nullable = false` (previously it built the
  frame silently). Declare the field `nullable = true` — the default, via
  `Field::new` — to keep the old behaviour.
- Raw constructors (`Series` / `BuiltinColumn` / `NumericColumn`'s `from_ints` /
  `from_floats` / `from_bools` / `from_strings`) now defensively copy their
  input array. Code that mutated the source array after construction to alter
  the column (the previously-documented footgun) no longer has that effect —
  mutate the array before constructing, or build a fresh one.

## v0.4 → v0.5

v0.5 is a pre-1.0 breaking release. (It was announced as the last one; v0.6 is
one more — the API-convergence release above — after which the public surface
evolves compatibly.) It
converges the eager and lazy APIs onto a single, Polars-shaped expression
engine. The duplicate `*_exprs` verbs, the closure `filter`, the `AggSpec`
reduction specs, the rich `RowView`, the per-type `*_join` methods, the
column-scalar reductions, and a tail of non-Polars names are all **removed
outright** — there are no deprecated aliases. Everything below is a pure rename
or a mechanical rewrite; for the feature side of the same release see
the [release notes](https://github.com/ihb2032/MoonFrame/releases).

### The four verbs take expressions

`select` / `filter` / `agg` / `with_columns` each now take an `Array[Expr]` (or
a single `Expr`), on both `DataFrame` and `LazyFrame`. The v0.4 `*_exprs` /
`*_where` twins that introduced the expression form are gone — the plain verb
*is* the expression form.

| v0.4 | v0.5 |
|---|---|
| `df.select(["region", "revenue"])` | `df.select([col("region"), col("revenue")])` — or `df.select(cols(["region", "revenue"]))` |
| `df.select_exprs([col("a") + col("b")])` | `df.select([col("a") + col("b")])` |
| `df.filter(row => row.get_int("x") > 0)` | `df.filter(col("x").gt(lit_int(0)))` |
| `df.filter_where(expr)` | `df.filter(expr)` |
| `grouped.agg([AggSpec::sum("x").with_alias("t")])` | `grouped.agg([col("x").sum().with_alias("t")])` |
| `grouped.agg_exprs([expr])` | `grouped.agg([expr])` |
| `df.with_column(series)` | `df.with_columns([lit_series(series)])` |
| `lf.select_exprs(...)` / `lf.filter_where(...)` | `lf.select(...)` / `lf.filter(...)` |

The `AggSpec` struct and its `AggKind` enum (`AggSpec::sum` / `mean` / `min` /
`max` / `count` / `with_alias`) are removed; the equivalent reductions are the
`Expr` methods `col("x").sum()` / `.mean()` / `.min()` / `.max()` / `.count()`,
which additionally compose over a *derived* column — `(col("revenue") -
col("cost")).sum()` — the thing `AggSpec` could not express.

**Arbitrary row predicates.** The old closure `filter` could run any MoonBit
code per row. Its reified replacement is the `map_many` escape hatch — a closure
over the row's cells as `Scalar`s, carried by an inspectable `Expr`:

```moonbit
// v0.4
df.filter(row => row.get_string("product") == "widget")
// v0.5
df.filter(
  map_many(label="is_widget", [col("product")], cells => Scalar::Bool(
    cells[0].as_string() == "widget",
  )),
)
```

`map_elements` is the single-input form: `col("q").map_elements(label="...", s
=> ...)`.

### Sort / group_by / join / drop keys take expressions

The key-bearing verbs now name their keys with `Expr`, so a key can be a derived
column, not just a name. `sort_by` is renamed `sort` to match Polars.

| v0.4 | v0.5 |
|---|---|
| `df.sort_by([("revenue", Desc, NullsLast)])` | `df.sort([(col("revenue"), Desc, NullsLast)])` |
| `df.group_by(["region"])` | `df.group_by([col("region")])` |
| `df.drop(["tmp"])` | `df.drop([col("tmp")])` |
| `df.drop_nulls_in(["revenue"])` | `df.drop_nulls(subset=[col("revenue")])` |
| `lf.sort_by(...)` / `lf.group_by([name])` | `lf.sort(...)` / `lf.group_by([col(name)])` |

`drop_nulls()` with no argument is unchanged (drop every row with a null in any
column); it just gained an optional `subset`, which retired the separate
`drop_nulls_in`. `rename` is unchanged — it takes `Array[(String, String)]`,
matching Polars' dict form, not expressions.

### Join — one method, expression keys

The per-type convenience joins are removed; `join` with a `JoinOptions` is the
only form (as in Polars). Keys are `Expr`, and `left_on` / `right_on` support
differently-named or derived keys.

| v0.4 | v0.5 |
|---|---|
| `left.inner_join(right, ["id"])` | `left.join(right, JoinOptions::on([col("id")]))` — inner is the default `how` |
| `left.left_join(right, ["id"])` | `left.join(right, JoinOptions::on([col("id")]).with_how(Left))` |
| `left.right_join(...)` / `left.outer_join(...)` | `.with_how(Right)` / `.with_how(Outer)` |
| `left.cross_join(right)` | `left.join(right, JoinOptions::cross())` |
| `JoinOptions::on(["id"])` | `JoinOptions::on([col("id")])` |
| *(no equivalent)* | `JoinOptions::left_on([col("a")]).with_right_on([col("b")])` for differently-named keys |

`with_how` / `with_coalesce` / `with_suffix` and the null-key / NaN-key /
suffix semantics are unchanged. One behaviour change: the `coalesce = None`
default now follows Polars per `how` — a `Left` / `Right` join coalesces its
key into one column instead of keeping both (`Inner` already coalesced, `Outer`
still keeps both); pass `with_coalesce(false)` for the old two-column
Left / Right output.

### Row access — `row(i)` returns a tuple, new `rows()`

The rich `RowView` (and the unchecked `row_view`) are removed in favour of
Polars' positional row access. `df.row(i)` now returns an `Array[Scalar]` (by
column order); `df.rows()` returns every row. For a single typed value, read the
column and index it, then narrow the `Scalar`.

| v0.4 | v0.5 |
|---|---|
| `df.row(i)` → `RowView` | `df.row(i)` → `Array[Scalar]` |
| `df.row_view(i)` (unchecked) | *removed* — use `df.row(i)` |
| `df.row_view(i).get_int("c")` | `df.get_column("c").get(i).as_int()` — likewise `as_float` / `as_bool` / `as_string` |
| `df.row(i).get_string("c")` | `df.get_column("c").get(i).as_string()` |
| `view.is_null("c")` | `df.get_column("c").get(i).is_null()` |
| *(iterate rows)* | `df.rows()` → `Array[Array[Scalar]]` |

### Whole-frame reductions — `df.sum()` returns a frame

`df.sum(col)` returning a scalar is removed (it has no Polars analogue). Polars'
two forms take its place: `df[col].sum()` for a single scalar — here
`df.get_column(col).sum()` — and the no-argument `df.sum()` reducing every
numeric column to a **one-row `DataFrame`**.

| v0.4 | v0.5 |
|---|---|
| `df.sum("revenue")` → `Scalar` | `df.get_column("revenue").sum()` → `Scalar` |
| `df.mean("revenue")` → `Double` | `df.get_column("revenue").mean()` → `Double` |
| `df.min("x")` / `df.max("x")` / `df.count("x")` | `df.get_column("x").min()` / `.max()` / `.count()` |
| *(no equivalent)* | `df.sum()` / `mean()` / `min()` / `max()` / `count()` → one-row `DataFrame` |

The frame-wide `df.sum()` reduces only `Int` / `Float` columns (a `Bool` /
`String` column becomes a `Null` cell of its source dtype); `df.count()` is the
per-column non-null count. Note `df.get_column(c).sum()` *raises* on a
non-numeric column, while the frame-wide `df.sum()` tolerates it by nulling — the
two reductions differ on purpose.

### `fill_null` moves to the expression layer

The per-column `df.fill_null(name, value)` is removed; per-column filling is now
an `Expr` method, and there is a new whole-frame form.

| v0.4 | v0.5 |
|---|---|
| `df.fill_null("note", Scalar::String("n/a"))` | `df.with_columns([col("note").fill_null(lit_str("n/a"))])` |
| *(no equivalent)* | `df.fill_null(Scalar::Int(0))` — fills the null cells of every dtype-compatible column |

`Series::fill_null(Scalar)` is unchanged. The `Expr` form is more capable than
the old frame method: the fill value is any `Expr` (a literal, another column for
a coalesce, or a computed tree), and `Int` / `Float` operands unify.

### `replace_column` retired

`replace_column` is removed; `with_columns([lit_series(...)])` replaces a column
by name. Rename the series to the target name first if it differs.

| v0.4 | v0.5 |
|---|---|
| `df.replace_column("x", series)` | `df.with_columns([lit_series(series.rename("x"))])` |

Two behaviour differences, by design: where the old method raised
`ColumnNotFound` on a missing name, `with_columns` *appends* the column; and
where it raised `LengthMismatch` on any off-length series, `lit_series`
broadcasts a length-1 series.

### Naming finalisation

The last non-Polars public names are aligned — mechanical renames, or a fold
into `cast`.

| v0.4 | v0.5 |
|---|---|
| `series.min_value()` / `max_value()` | `series.min()` / `series.max()` |
| `series.take([...])` | `series.gather([...])` |
| `series.unique_count()` | `series.n_unique()` |
| `series.to_int()` / `to_float()` / `to_string_series()` | `series.cast(DataType::Int)` / `cast(DataType::Float)` / `cast(DataType::String)` |
| `series.null_rate()` | *removed* — compute `series.null_count() / series.len()` |
| `series.describe()` | *removed* — wrap in a frame: `DataFrame::new([series]).describe()` |
| `df.get(i, "c")` | `df.item(i, "c")` |
| `@io.format_csv_str(df, opts)` | `@io.format_csv(df, opts)` |

The same `min_value` → `min`, `max_value` → `max`, and `to_int` / `to_float` →
`cast` renames apply to the column backend types (`NumericColumn`,
`BuiltinColumn`, `ColumnStorage`) for callers who reach them directly;
`to_string_column` is kept (it returns a `BuiltinColumn`, not a `cast`'s `Self`).

### `Series` moved to its own package

`Series` was extracted from `frame` into a new `series` package so the
expression layer can build on the per-column unit. Facade users are unaffected —
`@moonframe.Series` still names the same type, with the same constructors and
methods. Only code that imported the type **directly** from `frame` needs the
new path.

| v0.4 | v0.5 |
|---|---|
| `ihb2032/MoonFrame/frame.Series` | `ihb2032/MoonFrame/series.Series` |
| facade `@moonframe.Series` | unchanged |

### Purely additive (no action needed)

v0.5 also *adds*, with nothing to migrate: the `map_elements` / `map_many`
closure escape hatch; the aggregations `std` / `variance` / `median` /
`n_unique` / `first` / `last`; the `Expr` string namespace (`str_to_uppercase` /
`str_contains` / `str_replace` / …); `lit_series` and the `cols` name helper;
`DataFrame::unique()` (first-appearance row dedup); and the lazy file sources
`scan_csv` / `scan_ndjson` (with `_with_options` variants) with projection
pushdown.

### One deliberate non-alignment

`sort` treats a `Float` `NaN` as **missing** (ordered by the tuple's
`NullOrder`), not as a value. This is the only place v0.5 knowingly differs from
Polars, where `NaN` is a value that sorts last independently of `nulls_last`.
Everything else above matches Polars' shape and behaviour.

## v0.3 → v0.4

**Additive — nothing to change.** v0.4 only *adds* symbols: the new `expr`
package (`Expr`, `col` / `lit_*` / `when`, the operators and methods), the new
`lazy` package (`LazyFrame` / `LazyGroupBy`, `lazy_frame`), and new `DataFrame`
/ `GroupedDataFrame` methods (`with_columns` / `select_exprs` / `filter_where`
/ `agg_exprs`). No v0.2 / v0.3 type, method, or enum variant changed, so
existing code compiles and behaves identically. The two new public
sub-packages are available directly for callers who want a slice of the
surface, while callers who import only the facade `ihb2032/MoonFrame` get the
same symbols there. (The `Series`-into-its-own-package split, which *will*
touch existing code, is deferred to v0.5.)

## v0.2 → v0.3

v0.3 is a pre-1.0 breaking release. The source-level breaks:

| v0.2 | v0.3 |
|---|---|
| `Series::storage() -> @column.BuiltinColumn` | `-> @column.ColumnStorage`; the `.data()` / `.validity()` reading surface is unchanged, so column-reading call sites still compile. Use `.to_builtin()` when you need the concrete `BuiltinColumn` |
| `Series::new(name, BuiltinColumn)` | `Series::new(name, ColumnStorage)`; pass `ColumnStorage::from_builtin(col)`, or keep `Series::from_builtin(name, col)` (signature unchanged) |
| `pub(all) enum JoinType { Inner; Left; Cross }` | gained `Right` / `Outer`; an exhaustive `match` over `JoinType` must now handle the two new variants |

The CSV / JSON / NDJSON `*ReadOptions` structs also gained `pub(all)` fields
(read resilience — `on_parse_error`, plus CSV's `allow_nonfinite_floats`): a
full struct literal must add them or switch to `::default()`. The defaults
reproduce the prior behaviour exactly.

## v0.1 → v0.2

| v0.1 | v0.2 |
|---|---|
| `@ops.select(df, names)` (free function) | `df.select(names)` (method) |
| `op(df, ...) -> Result[T, DataError]` + `.bind` / `.map` / `.unwrap` | `df.op(...) -> T raise DataError`, chained directly |
| pattern-match `Ok(x)` / `Err(e)` on the result | call directly in a `raise` context, or `Ok(expr) catch { e => Err(e) }` for a `Result` |
| `filter_try(df, row => row.get_int("x").map(v => v > 0))` | `df.filter(row => row.get_int("x") > 0)` |
| `sort_by(df, spec)` / `sort_by_many(df, specs)` | `df.sort_by([(col, order, nulls), ...])` |
| `Series::min()` / `max()` (`Result`-wrapped) | `Series::min_value()` / `max_value()` (total) |
| `@io.to_markdown(df)` | `df.to_markdown()` |
| `import ... @ops` | gone — verbs live on `DataFrame` in `@frame` |

`format_csv_str` / `format_json_records` / `parse_csv_str` / `read_csv` /
`write_csv` and the JSON / NDJSON equivalents are still `io` free functions (the
`read_*` / `write_*` / `parse_*` ones now `raise`; the `format_*` ones are total
and return a `String`).
