Local dataset import and export
yb dataset converts caller-owned files to and from schema-version-1 evaluation revisions. It makes no network requests and does not upload, assign a tenant, or evaluate the payload. Existing yb evaluate guards --revision can consume the generated revision when its payload matches the guard evaluator's schema.
Validate an interchange file before creating a revision:
yb dataset import --format jsonl --input samples.jsonl --preview
yb dataset import --format jsonl --input samples.jsonl --output revision.json
yb dataset export --format csv --input revision.json --output samples.csv
Choose jsonl or csv explicitly. Input and output are local paths. The output path must be new. Output is staged in its directory and published only after writing succeeds; the filesystem must support hard links. Files are created with private permissions. Preview writes no output file and returns nonzero on invalid input.
JSONL contains one object per line:
{"schema_version":1,"dataset_id":"demo","id":"sample-a","payload":{"text":"hello","type":"clean","expect":"clean"}}
CSV has exactly four columns:
schema_version,dataset_id,sample_id,payload_json
1,demo,sample-a,"{""text"":""hello"",""type"":""clean"",""expect"":""clean""}"
Every row repeats the same nonempty dataset ID and schema version. Sample IDs are nonempty and unique; order is preserved. Payloads must be JSON objects, with no duplicate keys. Unknown fields or columns, including org_id, are rejected. This command transports opaque objects; a downstream evaluator applies its own payload schema.
Input, canonical revision output, and exported output are bounded to 8 MiB; imports support at most 10,000 rows. Malformed rows, repeated IDs, inconsistent dataset IDs, unsupported schema versions, empty input and oversized files reject the entire import. Preview reports deterministic physical line/field diagnostics with generic error codes, without copying source values. CSV syntax damage that consumes an unterminated quoted record stops parsing; subsequent record positions cannot be inferred reliably. Fix the reported source row and run preview again. Files with more than 10,000 rows stop validation at the row limit.
Repeated imports of the same valid file produce byte-identical canonical JSON without generated IDs or timestamps. Repeated exports preserve sample order and are deterministic. Revision IDs are the SHA-256 of exact revision bytes; interchange file digests are separate.
CSV exports protect dataset and sample identifiers beginning with spreadsheet formula characters (=, +, -, @, tab, carriage return, also after leading ASCII whitespace) by prefixing an apostrophe. A literal leading apostrophe is doubled. Import reverses this convention exactly. Payload objects remain compact JSON cells. Quoted multiline identifiers, including CRLF values, roundtrip without normalization. This convention does not guarantee the behavior of every spreadsheet application's import settings; import treats values as data and never evaluates a formula.
To recover from an output collision, select a fresh output path. A failed import leaves the requested destination absent and preserves existing files. No existing corpus or revision is rewritten by these commands.