Skip to content

fix(checks): skip empty state streams in timestamp sync offsets (#691) - #695

Merged
kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
shobhitagnihotri69:fix/sync-empty-reference-state-stream
Oct 6, 2026
Merged

kstonekuan merged 1 commit into
Hebbian-Robotics:mainfrom
shobhitagnihotri69:fix/sync-empty-reference-state-stream

Conversation

@shobhitagnihotri69

Copy link
Copy Markdown
Contributor

Summary

Fixes #691. Mirrors the empty camera guard introduced in #668 by ensuring candidate reference state streams actually have recorded timestamps (stamps_ns.size > 0) before picking a sync reference and computing start/end offsets.

Problem

When an MCAP file has summary metadata indicating messages for a non-camera topic (message_count >= 2), but zero actual records are written to disk, timestamp_regularity picked that empty state stream as the reference stream and crashed with IndexError: index -1 is out of bounds for axis 0 with size 0 on ref_stamps[-1].

Changes

  • In _timestamp_regularity_keys: Filter state_topics to only those where episode.channel(topic).timestamps.size > 0.
  • In _measure_timestamp_regularity: Filter state_topics to only those where per_topic[topic].stamps_ns.size > 0.
  • If no populated state stream exists, cross-stream sync offsets are skipped gracefully. If other populated state streams exist, max() selects the densest populated state stream instead of the empty one.
  • Added comprehensive unit tests in tests/test_checks.py.

All 2,478 tests pass and linting checks are clean.

@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Filters empty state streams from timestamp sync reference selection.

The PR appears safe to merge.

What we checked:

  • Predicted sync keys differ from results: Both paths select the same topics and test the same channel timestamps. The measurement then writes the keys returned by the prediction function.
Summary

This PR updates timestamp_regularity to choose sync references only from state streams with recorded timestamps. If no selected state stream has timestamps, it still reports per-topic sample counts but emits no sync offsets.

  • Camera sync offsets now use only state streams with timestamps.

Reviews (1) · Last reviewed commit: "fix(checks): skip empty state streams in..."

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

@kstonekuan
kstonekuan merged commit 4ceb840 into Hebbian-Robotics:main Oct 6, 2026
5 checks passed
@kstonekuan kstonekuan mentioned this pull request Oct 8, 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]: IndexError in timestamp_regularity when sync reference state stream has empty timestamps

2 participants