# Changelog

## 0.1.0

Read CRAM 3.0 and 3.1. Inspection is Elixir. Record decoding and region queries are delegated to noodles-cram 0.103.0. Writing is unsupported.

- CI and the release workflow build a precompiled NIF (NIF 2.15) for five targets. A prod install downloads the matching archive. `:dev` and `:test` compile from source.
- `mix ci` runs `cargo fmt --check`, Clippy with warnings denied, and `cargo test` for `native/cram_nif`.

### Stage 5

- Mutation tests cover length fields, ITF-8 prefixes, CRC bytes, oversized declarations, and truncation. No crashing input was minimized.
- `mix run bench/run.exs` measures info and read on the two-record synthetic fixture. The printed numbers are in `docs/benchmarks/stage-5.md`.
- Tutorials 01–09 are drafts. `mix cram.tutorials` checks their fences. They are not published.
- `CRAM.write/3` is still `reason: :unsupported`.

### Stage 4

- Parse `.crai` text in Elixir. Reject non-integers and oversized lines. Sequence id `-1` is the unmapped bin. Alignment start `1` is SAM position 1; `0` means no position.
- `CRAM.read/2` and `CRAM.stream/2` accept `:region` (`"sq0:1-4"` or `:unmapped`) and query through noodles `Reader::query`. The default index is `path.cram.crai`.
- `CRAM.write/3` is still `reason: :unsupported`.

### Stage 3

- Decode CRAM 3.0 and 3.1 records through a Rustler NIF pinned to noodles-cram 0.103.0. Elixir passes already resolved references. The NIF does not open a socket.
- `CRAM.stream/2` and `CRAM.read/2` return `%CRAM.Alignment{}` in batches (default 256). Halting the stream sets a cancellation flag checked between records.
- A missing shared library returns `reason: :native_unavailable`. Inspection still works. A container the crate cannot decode returns `%CRAM.Error{}` instead of aborting the VM.
- Writing is still unsupported.

### Stage 2

- Add an offline reference provider: local FASTA (and `.fai` when present), a checksum-named cache, and Refget only when `allow_network: true`.
- Check the SAM MD5 before returning bases. Missing and mismatched references return `reason: :reference_missing` or `:reference_checksum_mismatch` with the name and checksum, not the bases.
- Record raw slice headers, including whether an external reference is required. Inspection does not fetch sequences.

### Stage 1

- Inspect CRAM 3.0 and 3.1 file definitions, container and block boundaries, and SAM headers (raw or gzip).
- Add `CRAM.open/2`, `info/1`, `header/1`, `metadata/1`, `containers/1`, `export_context/1`, and `mix cram.info`.
- Reject truncated files, bad container CRCs, oversized blocks, and oversized landmark counts before allocating the declared buffer.
- CRAM 2.1 is reported and not walked. Record decoding and writing return structured unsupported errors.

### Stage 0

- Add ITF-8 and LTF-8 codecs, `CRAM.Error`, and bounded `CRAM.Source`.
- Record the CRAM 3.1 specification printing, the noodles-cram 0.103.0 bridge decision, and an initial capability matrix.
- `CRAM.open/2`, record decoding, indexing, and writing are not implemented.
