Declare default config (declarations) so the dataset viewer can load it
Browse files## What was broken
The dataset viewer / datasets-server cannot load this dataset. Re-checked on 2026-09-26 against `main` @ `b93a14cd411e7e9168819cf86915f1a02c6bfa2b` (last modified 2026-07-22T10:49:34Z):
```
$ curl -s "https://datasets-server.huggingface.co/is-valid?dataset=SZLHOLDINGS/lean-theorem-tree"
{"preview":false,"viewer":false,"search":false,"filter":false,"statistics":false}
$ curl -s "https://datasets-server.huggingface.co/first-rows?dataset=SZLHOLDINGS/lean-theorem-tree&config=default&split=train"
{"error":"Cannot load the dataset split (in streaming mode) to extract the first rows.","cause_exception":"CastError",
"cause_message":"Couldn't cast\nmeta: struct<title: string, repo: string, commit: string, commit_date: timestamp[s], ...
to\n{'canonical_flagship': Value('string'), ... 'schema': Value('string')}\nbecause column names don't match", ...}
```
The card has no `configs:`, so the auto-detected `default` config takes **every** JSON file in the repo as one `train` split. The repo has two JSON files with different schemas:
| File | Size | Shape | What it is |
|---|---|---|---|
| `SZL_ESTATE_MANAGED.json` | 685 B | 1 flat object with 13 keys (`canonical_flagship`, `repo_id`, `schema`, ...) | estate-management receipt, not dataset content |
| `data/lean_theorem_tree.json` | 86,972 B | 1 object `{meta: {14 keys}, declarations: [269 objects]}` | the actual data |
The features were inferred from the receipt, and the data file then fails to cast to them. Even without the receipt, the data file would load as a single row holding a `meta` struct and a 269-item list. Users expect one row per declaration.
**Behavior change for consumers:** before 2026-07-22, when `SZL_ESTATE_MANAGED.json` was added, `default/train` loaded as 1 row `{meta, declarations}`. With this change it loads as 269 rows with 9 columns, one per declaration.
## What changed
One file changes: `README.md`. The only edit is a `configs:` block added to the YAML front matter just before the closing `---`. Every other YAML key and the whole markdown body are byte-for-byte unchanged.
```diff
@@ -26,6 +26,12 @@
task_categories:
- other
ecosystem-stage: generated-mirror
+configs:
+- config_name: default
+ data_files:
+ - split: train
+ path: data/lean_theorem_tree.json
+ field: declarations
---
```
- **`default` / `train`** now reads only `data/lean_theorem_tree.json`. It uses the JSON builder's `field: declarations` option, so each of the 269 declarations is one row. The columns are `id, name, kind, file, file_sha, line, status, runtime_gate, axiom_deps`.
- **`SZL_ESTATE_MANAGED.json`** is left out of every config. It is repo-management metadata, not something a dataset user would load. It stays in the repo and can still be downloaded as a raw file.
- **The `meta` block** in `data/lean_theorem_tree.json` is not exposed as a config. With `field: meta`, the JSON builder returns 3 malformed rows: the nested `status_counts` dict is split into one scalar per row (247 / 22 / 0), and every other meta value is repeated on each row. Its headline facts are already in the card text: 269 declarations @ `c4d13795` from 2026-05-29, Lean v4.14.0-rc1, 247 GREEN / 22 TRACKED, and the thesis and Lean DOIs. Its other values (`total_lean_files`, the `generated` timestamp, `mathlib_version` and the note that line numbers are sampled) are only in the raw file, which is unchanged.
- **No `features` declared.** The inferred types are already consistent: `id` and `line` are int64, the other scalar columns are string, and `axiom_deps` is list<string>, which 21 of 269 rows populate. The loaded rows equal the source exactly. That includes the 11 `file_sha` values that are all digits, which stay strings.
## How it was verified
A local snapshot of the repo at `b93a14cd` was checked by sha256 against the Hub copy. I used `datasets` 5.0.1 and `huggingface_hub` 2.0.0 with a fresh, empty datasets cache.
**The original README reproduces the server error**, with the same cast target: the receipt's 13 keys.
```
[default streaming=False] ERROR: DatasetGenerationError An error occurred while generating the dataset
[default streaming=False] caused by: CastError Couldn't cast | meta: struct<title: string, repo: string, commit: string, commit_date: timestamp[s], ...
[default streaming=True] ERROR: CastError Couldn't cast | meta: struct<title: string, ...
CastError ... 'runtime': Value('null'), 'schema': Value('string')}
because column names don't match
```
**New README:**
```
configs: ['default']
[default streaming=False] train num_rows: 269
[default streaming=False] features: {'id': Value('int64'), 'name': Value('string'), 'kind': Value('string'), 'file': Value('string'), 'file_sha': Value('string'), 'line': Value('int64'), 'status': Value('string'), 'runtime_gate': Value('string'), 'axiom_deps': List(Value('string'))}
[default streaming=True] train rows: 269
streaming=False: rows=269 equal_to_source=True
streaming=True: rows=269 equal_to_source=True
builder config: JsonConfig field= declarations data_files= {'train': ['/data/lean_theorem_tree.json']}
remote hf:// streaming field=declarations: rows=269 equal_to_source=True
card configs: [{'config_name': 'default', 'data_files': [{'split': 'train', 'path': 'data/lean_theorem_tree.json'}], 'field': 'declarations'}]
non-configs YAML keys identical: True
markdown body identical: True
```
`equal_to_source=True` means the loaded rows equal `json.load(...)["declarations"]` exactly. The check compares the full list, every row and every field. The count also matches `meta.total_declarations` (269).
**The datasets-server first-rows read path**, `ds.decode(False) if ds.features else ds` followed by `islice(..., 101)` on the streaming split:
```
verify_orig split names: ['train']
verify_orig ERROR: CastError because column names don't match
verify_new split names: ['train']
verify_new first-rows-style read: 101 rows; keys: ['id', 'name', 'kind', 'file', 'file_sha', 'line', 'status', 'runtime_gate', 'axiom_deps']
```
**Hub metadata validator** (`DatasetCard.validate(repo_type="dataset")`, a read-only call to `/api/validate-yaml`):
```
fresh/README.md validate: OK
staging/README.md validate: OK
```
## What this verification does NOT prove
- It does not prove the Hub datasets-server will build first-rows, parquet, size and statistics for this config. The server runs its own `datasets` version on Python 3.14. I tested only `datasets` 5.0.1, locally and over `hf://`. After merging, re-run `/is-valid` and `/first-rows?config=default&split=train`. Those jobs can take a few minutes.
- I did not test older `datasets` releases. The YAML `field` pass-through to `JsonConfig` has existed for a long time, but I did not run it here.
- It says nothing about whether the data is accurate or current. The card itself says this is a snapshot at `c4d13795`, and the `meta.note` says line numbers are sampled.
- If a generator regenerates this card from a template without the `configs:` block, a later regeneration would remove this fix.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
@@ -26,6 +26,12 @@ size_categories:
|
|
| 26 |
task_categories:
|
| 27 |
- other
|
| 28 |
ecosystem-stage: generated-mirror
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
---
|
| 30 |
|
| 31 |
<!-- SZL-ESTATE-CARD:v2:START -->
|
|
|
|
| 26 |
task_categories:
|
| 27 |
- other
|
| 28 |
ecosystem-stage: generated-mirror
|
| 29 |
+
configs:
|
| 30 |
+
- config_name: default
|
| 31 |
+
data_files:
|
| 32 |
+
- split: train
|
| 33 |
+
path: data/lean_theorem_tree.json
|
| 34 |
+
field: declarations
|
| 35 |
---
|
| 36 |
|
| 37 |
<!-- SZL-ESTATE-CARD:v2:START -->
|