Skip to content

fix: ROSBag skips a truncated message with a warning, instead of stopping with a struct.error - #319

Merged
petercorke merged 4 commits into
mainfrom
bug/rosbag-truncated-message
Nov 26, 2026
Merged

petercorke merged 4 commits into
mainfrom
bug/rosbag-truncated-message

Conversation

@petercorke

Copy link
Copy Markdown
Owner

A bag that was cut short, for example by a recording that stopped mid-write, has a last message that cannot be decoded. ROSBag raised a bare struct.error and stopped, so none of the good messages before it were usable.

ROSBag now skips the damaged message and carries on. It issues one RuntimeWarning per topic. With verbose=True it prints the message type, topic and error for each skipped message. Three tests in tests/test_ros_truncated.py build a damaged bag and check the warning, the quiet default and the verbose output.

An AI assistant (Claude Code) wrote this change and has read the diff. I ran the new tests, but not against a real damaged bag.

🤖 Generated with Claude Code

…ping with a struct.error

A message that ends before its type says it should, such as the last message of a
recording that was cut short, raised a bare struct.error and ended the iteration.
It is now skipped, with one RuntimeWarning per topic that says what happened, or one
line for each when verbose.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 0 duplication

Metric Results
Complexity 8
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

petercorke and others added 3 commits November 26, 2026 12:59
…e struct.error in a SerdeError

rosbags 0.11.10 raises SerdeError for a message that ends early; 0.11.5 let the
struct.error through. The two new truncation tests failed on CI, which has the
newer version. Checked on both.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@petercorke
petercorke merged commit 5de13cd into main Nov 26, 2026
33 of 34 checks passed
@petercorke
petercorke deleted the bug/rosbag-truncated-message branch November 26, 2026 04:15
@github-actions github-actions Bot mentioned this pull request Nov 26, 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.

1 participant