Skip to content

Fix UnitError in temporal buffer trimming with nanosecond time coords#712

Open
SimonHeybrock wants to merge 1 commit intomainfrom
fix/711-timestamp-mismatch
Open

Fix UnitError in temporal buffer trimming with nanosecond time coords#712
SimonHeybrock wants to merge 1 commit intomainfrom
fix/711-timestamp-mismatch

Conversation

@SimonHeybrock
Copy link
Member

Summary

  • _trim_to_timespan hardcoded unit='s' for the cutoff scalar, but production detector data uses unit='ns' time coordinates — causing UnitError: Cannot subtract ns and s when the buffer reaches capacity
  • The bug was latent since the temporal buffer was introduced (Nov 2025) because trimming only triggers on buffer overflow (default capacity 10,000), which takes ~3–6 hours of continuous operation to reach
  • Fix: use sc.to_unit() to convert the timespan to match the time coordinate's unit

Fixes #711

Test plan

  • Two regression tests added with unit='ns' time coordinates (scalar and thick slice)
  • All 855 dashboard tests pass

🤖 Generated with Claude Code

The `_trim_to_timespan` method hardcoded `unit='s'` for the cutoff
computation, but production detector data uses `unit='ns'` for time
coordinates. This caused a `UnitError: Cannot subtract ns and s` when the
buffer reached capacity and trimming was triggered for the first time
(after ~3-6 hours of continuous operation with 10,000-element default
capacity).

Convert the timespan scalar to match the time coordinate's unit using
`sc.to_unit()` before subtraction.

Fixes #711

Prompt: Please use a new worktree and look into #711
@github-project-automation github-project-automation bot moved this to In progress in Development Board Feb 13, 2026
@SimonHeybrock SimonHeybrock moved this from In progress to Selected in Development Board Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Selected

Development

Successfully merging this pull request may close these issues.

Error in dashboard from mismatching timestamps

1 participant