Skip to content

Agent: already show current file/segment even when not yet finished - #662

Merged
matteius merged 2 commits into
opensensor:mainfrom
matteius:agent/issue-482-39052526134
Oct 18, 2026
Merged

matteius merged 2 commits into
opensensor:mainfrom
matteius:agent/issue-482-39052526134

Conversation

@matteius

Copy link
Copy Markdown
Contributor

Refs #482

Agent-generated change from a maintainer-labeled issue. Review the diff and CI results before merging. Close the issue only when its acceptance criteria are complete.

DigitalOcean session: lightnvr-public-issue-482-39052526134.

…pensensor#482)

With long segment durations, a stream's current segment was invisible in
the recordings overview and timeline until rotation finalized it.  The
recorder inserts the segment's DB row at its first keyframe, so the read
paths were hiding it behind the is_complete filter for the whole segment
lifetime.

Read-side changes:
- get_recording_count()/get_recording_metadata_paginated() gain an
  include_in_progress opt-in that also matches incomplete rows while
  their start_time is fresh (2x the stream's segment_duration, schema
  default 900 s when the config row is missing), so zombie rows left
  behind by a killed writer thread self-expire out of the views.
- GET /api/recordings opts in and exposes the live segment with
  in_progress: true, end_time/end_time_unix: null and a live elapsed
  duration; GET /api/recordings/:id reports the same.
- Timeline segment and coverage queries include the live segment with an
  effective end of "now" and return in_progress per segment.
- Playback of an unfinished segment fails fast with HTTP 409, since the
  MP4 moov atom only exists once the segment is finalized.
- Batch-delete/retention/storage-cache callers keep passing false so a
  segment that is still being written is never touched mid-write.

Web UI: a pulsing "Recording" state in the recordings grid/table with a
live elapsed duration, a clear message instead of a broken modal when
playing a live segment, and the timeline renders the live segment as a
pulsing bar through "now" with a matching legend entry.

Tests: unit coverage for the opt-in predicate, zombie self-expiry, the
recordings-list contract, the playback 409 and timeline segment
inclusion.
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

@matteius
matteius merged commit 927148f into opensensor:main Oct 18, 2026
11 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.

1 participant