Skip to content

Dataset snapshots cannot verify table or copied-media integrity after transfer #397

Description

@Galabavamsi

Current behavior

Dataset snapshot format v1 identifies the format, version, media mode, media URI base, and table filenames in format.json. It does not record file sizes, row counts, hashes, or a copied-asset inventory, and HFlow has no snapshot verification API or CLI command.

The atomic staging/activation path proves that HFlow finished writing a snapshot. It does not let a recipient distinguish those original bytes from a snapshot damaged or changed after export.

Controlled result

Tested at 81a13f81f5cf97d0b3048f0a660e3a1e701d50cb (v0.2.5-3-g81a13f8) with a one-episode, two-measurement, one-tag snapshot exported through the public API in copy media mode.

The original marker contained exactly:

format
format_version
media_mode
media_uri_base
tables

I made three independent copies and changed one thing in each:

Mutation after export format.json changed? Current observation
Replaced the copied media bytes No All Parquet tables still read normally; there is no signal that the asset changed
Deleted tags.parquet No The destination is still recognized as an overwriteable HFlow snapshot; DuckDB later raises “No files found”
Truncated samples.parquet to 64 bytes No The destination is still recognized as an overwriteable HFlow snapshot; DuckDB later raises “No magic bytes found at end of file”

hasattr(hflow, "verify_dataset_snapshot") was false, and hflow export snapshot --help exposes export options but no verification path.

This means the format marker can identify a snapshot while being unable to say whether its required tables and copied assets are the bytes HFlow actually published.

Why this matters

Snapshots are the delivery artifact intended to move independently of the catalog. A successful export followed by an interrupted copy, storage corruption, or accidental asset replacement currently looks valid until a consumer happens to read the affected file. Modified copied media may remain completely silent.

This is also consistent with adjacent dataset-format practice: Croissant strongly recommends SHA-256 checksums for every FileObject in a versioned dataset, and Hugging Face Datasets verification covers expected files, split metadata, and optionally checksums.

Design questions

A v2 marker plus a public verifier appears to be one possible shape, but the format contract should be decided before implementation:

  1. Should every required table record path, size_bytes, sha256, and perhaps row_count?
  2. In copy mode, should every copied asset receive the same coverage, or should the marker point to a separate deterministic asset manifest?
  3. Should there also be one digest over the normalized manifest so that the delivered set itself has an identity?
  4. How should v1 behave: recognizable but explicitly “unverifiable”, or rejected by a strict verifier?
  5. In references mode, should verification cover only local tables/metadata and report remote media as unverified unless network access is explicitly requested?
  6. Are unlisted extra files allowed?

Definition of done

  • Every required Parquet table in a newly exported snapshot is covered by deterministic integrity metadata.
  • Every local asset in copy mode is covered.
  • A public library and/or CLI verification path detects a missing file, truncation, and same-path byte replacement.
  • An unchanged snapshot passes.
  • v1 compatibility and reference-mode semantics are deliberate and tested.
  • Default verification does not fetch remote media.
  • The snapshot format documentation explains what is and is not guaranteed.

Non-goals

  • Cryptographic signing or publisher authenticity.
  • Proving continued availability of remote reference-mode media.
  • Changing the logical contents of snapshot tables.
  • Making the whole catalog content-addressed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    advancedNeeds codebase familiarity; not a starter issueenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions