Skip to content

fix: validate chunk CRCs when reading canonical episodes after sync - #477

Closed
mulkakhileshmj wants to merge 1 commit into
Hebbian-Robotics:mainfrom
mulkakhileshmj:fix/issue-474
Closed

mulkakhileshmj wants to merge 1 commit into
Hebbian-Robotics:mainfrom
mulkakhileshmj:fix/issue-474

Conversation

@mulkakhileshmj

Copy link
Copy Markdown
Contributor

Closes #474.

Problem

Every post-sync read of a canonical episode ran with chunk CRC validation off. Episode._reader opened the file through open_reader(path), whose default is validate_crcs=False, and the META lane, the relabel lane, and the online re-check flow all consume that reader. A canonical episode that decayed on disk after sync was therefore re-read and re-certified: checks stamped fresh measured findings over bytes that fail the file's own integrity stamp, and those rows are what curation and export trust.

Fix

Episode._reader now opens with validate_crcs=True. On a damaged episode every data-reading check records a diagnosed CRCValidationError per episode instead of fresh evidence, so the catalog never certifies the file and default_dataset_sql never ships it. A healthy canonical runs the check lanes unchanged, and the CRC pass rides on decompression that was already happening (#462 carries the cost measurement).

I audited the other open_reader call sites: app.py (sync-reuse witness), importers/lerobot.py, and runtime/_templates.py read only summary and metadata records, which chunk CRCs cannot vouch for, so they keep the default. The open_reader docstring now states that rule instead of the "already identified by content hash" claim the issue debunked.

No TRANSFORM_BEHAVIOR_VERSION bump: the transform writes identical bytes, only reads changed.

Coverage

New regression test in tests/test_processing_regressions.py following the issue's repro: process a synthesized episode, flip one bit of the first chunk's stored uncompressed_crc (helper added to tests/reuse_test_helpers.py beside the existing corruption helper), and assert the META re-run reports content_digest as ERROR with the CRC diagnosis and stamps no fresh measurements, while a healthy control run stays fully MEASURED.

Validation

Run on WSL2 Ubuntu, Python 3.12:

uv sync --locked
uv run ruff check          # All checks passed
uv run ruff format --check # already formatted
uv run ty check            # All checks passed
uv run pytest -q           # 1712 passed, 6 skipped

Mutation check per the issue's definition of done: with the one-line fix reverted the pinning test fails; restored, it passes. The touched test file also passes under Python 3.11.

Episode._reader opened canonical files with CRC validation off, so the
META, relabel and re-check lanes could re-certify an episode that had
decayed on disk after sync. The checks stamped fresh measured findings
over bytes that no longer match the file's own integrity stamp.

Episode._reader now opens with validate_crcs=True. On a damaged episode
the data reading checks record a diagnosed CRCValidationError per
episode instead of fresh evidence, so the catalog never certifies the
file. A healthy episode runs the check lanes unchanged, and the CRC
pass rides on decompression that was already happening.

The open_reader docstring now states the actual rule, and a regression
test flips a canonical chunk's stored CRC and asserts the META lane
refuses it with the CRC diagnosis while a healthy control stays green.

Closes Hebbian-Robotics#474
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

👋 Hi @mulkakhileshmj — thanks for the contribution! To keep starter issues available
for other contributors and give every pull request a real review, we accept
1 open pull request per contributor at a time.

You already have #476 open, so this one is being closed automatically.
Once your open pull request is merged or closed, feel free to reopen this one —
no work is lost.

@github-actions github-actions Bot closed this Sep 9, 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.

check lanes re-certify a decayed canonical episode: post-sync reads never validate chunk CRCs

1 participant