Skip to content

fix(transform): classify mixed image formats as source-unsupported - #337

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
aadetya:fix/331-mixed-image-format-classification
Sep 1, 2026
Merged

kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
aadetya:fix/331-mixed-image-format-classification

Conversation

@aadetya

@aadetya aadetya commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Classify compressed-image channels that mix formats as source-unsupported.
  • Add a regression test using an MCAP camera channel containing both JPEG and PNG messages.
  • Update the exhaustive refusal lists in the exception docstring and converter guide.

Closes #331

Why

#203 established that transform failures caused by a recording’s contents should not be classified as infrastructure, since retrying the same recording cannot resolve them. #288 implemented that distinction by introducing SourceNotConforming and mapping it to source-unsupported for the four refusal cases in scope.

During review of #288, the mixed-image-format path was identified as the remaining inconsistency. It still raised a plain ValueError, causing classify_ingest_failure to treat it as infrastructure, even though the failure comes from the source recording.

This change brings that path in line with the classification introduced in #288. The existing error message remains unchanged.

Mixed-format inputs still fail before an output file is written, so no behavior version bump is needed.

Validation

  • uv sync --locked --all-extras
  • uv run ruff check --fix — passed
  • uv run ruff format — passed
  • uv run ty check — passed
  • uv run pytest -q tests/test_ingest_ledger.py — 9 passed
  • uv run pytest -q — 1315 passed, 11 skipped
  • Markdown link check — 360 OK, 0 errors

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.

@github-actions

Copy link
Copy Markdown

👋 Hi @aadetya — thank you so much for your first contribution to HFlow!

A maintainer will review your pull request as soon as possible. In the meantime:

💡 Tip: one open pull request per contributor at a time. Issues with an assignee are taken; everything else is fair game.

We are excited to have you here and appreciate your help making the project better! 🙌

@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.

LGTM, merging. Welcome.

This closes the gap exactly as measured. When I filed #331 the two adjacent refusals disagreed:

mixes image formats       -> infrastructure
unsupported single format -> source-unsupported

On your branch:

mixes image formats       -> source-unsupported
unsupported single format -> source-unsupported

Validated: ruff check, ruff format --check, ty check clean, 1320 passed / 6 skipped. Reverted your raise back to a plain ValueError and test_mixed_compressed_image_formats_classify_as_source_unsupported failed, so the test holds the classification rather than just describing it.

Driving it through write_canonical_episode with a real two-message MCAP instead of constructing the exception directly is what the four tests next to it do, and it's the difference between pinning the classifier and pinning the raise site as well. Your comment on the payload bytes is right too: the format consistency check runs before anything decodes the image, which is why a placeholder works there.

You also updated both places that enumerate the refusal categories, the SourceNotConforming docstring and the converter guide. I checked docs/CATALOG.md and it lists kinds rather than categories, so there was correctly nothing to do there.

@kstonekuan
kstonekuan merged commit 616494d into Hebbian-Robotics:main Sep 1, 2026
9 checks passed
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.

A camera topic mixing image formats is still filed as an infrastructure failure

2 participants