Skip to content

Reader checklist

Applies to SEAM 1

A conforming reader works in this order. Each step links to the page that defines it.

  1. MANIFEST peek. Read the first 24 bytes of data/MANIFEST without writing anything. If store_format or manifest_format is newer than the build, fail with NewerFormat and leave the directory byte-identical. See Header and Open sequence.
  2. Keyring. Authenticate the keyring with the master key and confirm the current data key is present.
  3. MANIFEST records. Every record must authenticate with the AAD built from the header and its sequence number. Stop at the torn tail. Zero valid records is Corrupt. See Reading and the torn tail.
  4. Each listed local file. The size is a multiple of 4096. The footer authenticates. The flags are legal for the footer revision. The file id and the section bounds match.
  5. Each data frame. It authenticates with its block index in the AAD, and its frame header is sane.
  6. Block decoders. Each consumes its input exactly, and every count is within its limit.
  7. WAL. Block generation equals the epoch in the block’s nonce, record CRC32C matches, and stream offsets are contiguous. See Recovery.
  1. Every frame and the footer authenticate under the AAD of their position.
  2. Footer: magic, revision range, legal flag combination, file id, section bounds and order.
  3. Index offsets and lengths lie inside [0, bloom_off), and the stats count equals the index entry count.
  4. raw_len is at most 64 MiB, and the decompressed size equals raw_len. See Frame.
  5. Every block decoder consumes its input exactly and checks every count against its limit.
  6. Within a file, entries are strictly increasing in (user key ascending, ts descending). A writer that sees otherwise fails with Corrupt("keys out of order").
  7. Columnar decoders reject unknown codec ids, out-of-range widths, reference indices at or above the column index, and expansion mismatches. See Columnar limits.

Details for each file-level check are on Reader invariants.

  • All length arithmetic is checked. An overflow is Corrupt, never a panic (SPEC V59).
  • Counts are bounded by the remaining input or by a documented limit before anything is allocated (SPEC V36, V59). See count(limit).
  • Varints are at most 10 bytes. Writers always emit the shortest form; readers do not reject longer forms. See varint.