Skip to content

fix(lerobot): declare every exported feature in info.json and check exported schemas - #781

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
Leo-Y-Zhang:lerobot-declare-features
Nov 13, 2026
Merged

kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
Leo-Y-Zhang:lerobot-declare-features

Conversation

@Leo-Y-Zhang

@Leo-Y-Zhang Leo-Y-Zhang commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #776 (the second finding; #777 fixed the first). The exported meta/info.json now declares every non-video feature that is written to the data files, including integer indexes and boolean flags such as episode_index, frame_index, index, task_index and next.done, with the source declaration unchanged. Declarations for columns that are not written are left out. Each written data file's schema is also checked against its source, so a silent type, nullability or metadata change now fails the export with an error naming the file and the first differing field.

Why

The registry filter kept only features whose dtype was float32. Integer and boolean columns stayed in the exported Parquet but disappeared from features, and a declared float32 feature with no output column would still have been listed. The new check enforces the guarantee from #777 on every export rather than only in tests: the earlier float64 widening passed the workflow and the verifier silently.

EXPORT_VERSION moves from lerobot-export-v2 to lerobot-export-v3 because meta/info.json changes for the same source and selection (the schema check alone would not need a bump). examples/README.md describes the registry and the check, says to regenerate v1/v2 exports, and drops the line saying the exporter runs official-API validation when lerobot is installed: _validate_v3 does structural checks only and never imports lerobot.

Validation

Rebased on main after #777 (93ad1b5); run in a clean python:3.12-bookworm container.

  • New tests: test_export_registry_matches_written_features (exact registry/column relationship, unchanged dtype/shape/names, selected cameras) and test_export_refuses_written_schema_mismatch (type, nullability, field metadata, schema metadata, missing, extra and reordered fields, including a failure in the second data file with the existing destination preserved). All 8 cases fail with export.py from main and pass with this change.
  • uv run pytest -q tests/test_lerobot_export.py: 40 passed.
  • uv run pytest -q -n 4: 2669 passed, 13 skipped. The two tests/test_ffmpeg.py failures also fail on main in this container (no system FFmpeg). test_keyframe_sampling_reads_a_fraction_of_a_long_recording failed only inside the parallel full run; it passes on its own on both this branch and main, and tests/test_byte_range_source.py passes in full (18) on this branch.
  • uv run ruff check ., uv run ruff format --check ., uv run ty check: all pass.

Checklist

  • I added or updated outcome-focused tests for changed business logic.
  • I updated documentation for changed behavior, flags, formats, or requirements.
  • I ran uv run ruff check --fix, uv run ruff format, and uv run ty check.
  • I ran the relevant pytest suite.
  • I did not add recordings, generated media, credentials, private URLs, or runtime artifacts.
  • I preserved stored-data compatibility or documented an explicit version change.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…xported schemas

The exported feature registry kept only float32 declarations, so integer
and boolean features written to the data files (episode_index,
frame_index, index, task_index, next.done) were missing from info.json.
Declare every written non-video feature with its source declaration, and
check each written data file's schema against its source so a silent
type or metadata change fails the export. EXPORT_VERSION moves to v3.

Refs Hebbian-Robotics#776
@greptile-apps

greptile-apps Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The exporter now keeps source declarations for written non-video features and checks every exported data file against its source schema.

  • The feature registry lists the data columns and cameras included in an export.
  • Each exported data file must keep the source schema before the export can be published.

Reviews (1) · Last reviewed commit: "fix(lerobot): declare every exported fea..." · Reviewed by Greptile

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Ruff, formatting, ty, and CI pass. The local suite had one intermittent runtime redirect test failure; it passed on rerun.

@kstonekuan
kstonekuan merged commit 5a22025 into Hebbian-Robotics:main Nov 13, 2026
5 checks passed
@kstonekuan kstonekuan mentioned this pull request Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: LeRobot v3 export silently widens float32 columns and drops Parquet schema metadata

2 participants