Skip to content

Delete video event#1679

Merged
LeonardoRosaa merged 44 commits into
mainfrom
horatiu-lig-10189-edit-events-3
Jul 22, 2026
Merged

Delete video event#1679
LeonardoRosaa merged 44 commits into
mainfrom
horatiu-lig-10189-edit-events-3

Conversation

@horatiualmasan

@horatiualmasan horatiualmasan commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What has changed and why?

Delete a video event from the timeline

How has it been tested?

New test and manual test

delete.mp4

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Summary by CodeRabbit

  • New Features

    • Added the ability to delete video classification events from the video event timeline.
    • Delete controls are shown only for editable timelines, and deletion triggers success/error notifications with the video details updating afterward.
    • Wired the delete action through the video player to the event timeline and video details refresh.
  • Tests

    • Added/updated unit tests to verify delete button visibility, callback invocation with the correct event, and that clicking delete does not trigger seek.

horatiualmasan and others added 30 commits July 7, 2026 17:54
…ions' into horatiu-lig-9805-import-activitynet-style-event-annotations-3
Previously, filtering and counting video annotations only considered
annotations attached to a video's frames. Videos can also carry
annotations directly (e.g. ActivityNet-style event/classification labels
on the whole video). This makes both the video filter and the annotation
counter consider these direct video annotations in addition to frame
annotations.
…ions-3' into horatiu-lig-9806-filter-videos-by-event-metadata
Mirrors a <video> element's playback state into reactive fields and
exposes intent callbacks (seek, play/pause, mute, fullscreen) for a
custom control bar. Listening via native events keeps it composable
with handlers on the element. Covered by a harness-driven unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Compose useVideoPlayback + VideoControls, forcing native <video controls>
off so the full-width scrubber can host aligned timeline overlays. Adds a
startTimeS prop (null waits for a deep-link timestamp) and a region ref
for fullscreen. Updates tests and stories accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hand the deep-linked frame's timestamp to VideoPlayer via startTimeS
instead of seeking after load, and remount on frame-number change with
a composite #key. Align the annotation overlay to the <video> box and
fix min-h-0 layout so the player fills its card. Adds a VideoDetails
test covering the frame-load branch and deep-link handoff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Full-width scrubber + transport buttons that own no playback state and
call back on user intent. Includes helpers (formatTime, clampPercent,
timeFromClientX) and unit tests. Exported from the components barrel.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Interactive Playground plus paused / near-end states, on a dark backdrop
matching how the bar overlays a video.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Mirrors a <video> element's playback state into reactive fields and
exposes intent callbacks (seek, play/pause, mute, fullscreen) for a
custom control bar. Listening via native events keeps it composable
with handlers on the element. Covered by a harness-driven unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Compose useVideoPlayback + VideoControls, forcing native <video controls>
off so the full-width scrubber can host aligned timeline overlays. Adds a
startTimeS prop (null waits for a deep-link timestamp) and a region ref
for fullscreen. Updates tests and stories accordingly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hand the deep-linked frame's timestamp to VideoPlayer via startTimeS
instead of seeking after load, and remount on frame-number change with
a composite #key. Align the annotation overlay to the <video> box and
fix min-h-0 layout so the player fills its card. Adds a VideoDetails
test covering the frame-load branch and deep-link handoff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…github.com:lightly-ai/lightly-studio into horatiu-lig-9807-show-event-bars-on-the-timeline.d
horatiualmasan and others added 12 commits July 16, 2026 23:49
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ts-model' into horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-timeline
…ts-timeline' into horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-wiring
…ts-wiring' of github.com:lightly-ai/lightly-studio into horatiu-lig-9807-show-event-bars-on-the-timeline-3-events-wiring
@horatiualmasan
horatiualmasan requested a review from a team as a code owner July 17, 2026 15:08
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8c727e7e-0266-4e61-b2b1-85d7446409de

📥 Commits

Reviewing files that changed from the base of the PR and between 8c5ed52 and 3cec246.

📒 Files selected for processing (1)
  • lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte
💤 Files with no reviewable changes (1)
  • lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte

📝 Walkthrough

Walkthrough

Adds delete controls for editable video events, wires deletion through VideoPlayer and VideoDetails, and updates related tests. Storybook scripts also separate instance state and isolate short-clip/playhead state.

Changes

Video event deletion

Layer / File(s) Summary
Timeline delete control and validation
lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.svelte, lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.test.ts
Editable event bars render a delete button when onDelete is provided; clicks invoke the callback without triggering seeking, with corresponding tests.
Player and details deletion flow
lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.svelte, lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte, lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.test.ts, lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
onEventDelete is forwarded to the timeline, and VideoDetails deletes the annotation, refreshes the video, and displays result toasts.

Storybook state scoping

Layer / File(s) Summary
Story state and script boundaries
lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte, lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte
Story instance scripts and state declarations are adjusted so story-local playback state is scoped independently.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant VideoEventTimeline
  participant VideoPlayer
  participant VideoDetails
  participant useDeleteAnnotation
  User->>VideoEventTimeline: Click delete-event-button
  VideoEventTimeline->>VideoPlayer: Invoke onDelete(event)
  VideoPlayer->>VideoDetails: Invoke onEventDelete(event)
  VideoDetails->>useDeleteAnnotation: Delete event by id
  useDeleteAnnotation-->>VideoDetails: Return deletion result
  VideoDetails->>VideoDetails: Refresh video and show toast
Loading

Possibly related PRs

Suggested reviewers: leonardorosaa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: deleting a video event.
Description check ✅ Passed The description matches the template well, covering the change, testing, and changelog status.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch horatiu-lig-10189-edit-events-3

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Base automatically changed from horatiu-lig-10189-edit-events-2 to main July 21, 2026 20:36
@IgorSusmelj

Copy link
Copy Markdown
Contributor

UX looks good to me

@lightly-fast-track-bot

lightly-fast-track-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

❌ Fast Track: checks did not pass

Failed guardrails: frontend/complexity (Guardrail threw: Cannot find module 'eslint'
Require stack:

  • /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json), frontend/coverage ( [FAIL] lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte: coverage data not found
    [FAIL] lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.svelte: coverage data not found
    [FAIL] lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.svelte: coverage data not found)
Guardrail Result Message
dummy Always passes.
frontend/complexity Guardrail threw: Cannot find module 'eslint' Require stack: - /home/runner/work/lightly-studio/lightly-studio/lightly_studio_view/package.json
backend/complexity 0 file(s) checked.
backend/coverage 0 file(s) checked.
diff-size PR adds 96 line(s) (limit: 215).
frontend/coverage [FAIL] lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte: coverage data not found [FAIL] lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.svelte: coverage data not found [FAIL] lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.svelte: coverage data not found

Reflects 3cec246.

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.test.ts (1)

162-175: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover the editable-without-handler branch.

The test does not verify editable: true with no onDelete. A regression that renders a no-op delete button whenever editable is true would still pass. Add that intermediate rerender and assert the button is absent.

Suggested test addition
         expect(queryByTestId('delete-event-button')).toBeFalsy();

+        rerender({
+            events: [makeEvent({ id: 'a' })],
+            durationS: 10,
+            editable: true
+        });
+        expect(queryByTestId('delete-event-button')).toBeFalsy();
+
         rerender({
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.test.ts`
around lines 162 - 175, Add an intermediate rerender in the test “shows the
delete button only when editable with an onDelete handler” with editable set to
true and no onDelete handler, then assert delete-event-button is absent before
the existing editable-with-handler assertion.
lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.test.ts (1)

171-193: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Assert the forwarded callback is invoked.

This test only checks button presence. Click the button and assert that the supplied onEventDelete mock receives the event; that verifies the VideoPlayer-to-timeline callback contract rather than only rendering.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.test.ts`
around lines 171 - 193, Update the test “renders a delete affordance on events
in edit mode” to use a mock for onEventDelete, click the delete-event-button,
and assert the mock receives the configured event. Preserve the existing render
setup and presence assertion while verifying the VideoPlayer-to-timeline
callback contract.
lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts (1)

60-62: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make the deletion mock controllable and asynchronous.

The real deleteAnnotation returns Promise<void>, but this stub returns undefined and is not exposed for assertions. Use a stable mockResolvedValue/mockRejectedValue mock so tests can verify handleEventDelete refreshes on success and shows the error toast on failure.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts`
around lines 60 - 62, Update the useDeleteAnnotation mock in
VideoDetails.test.ts so it exposes a stable deleteAnnotation mock configured as
an asynchronous Promise<void>, allowing tests to switch between resolved and
rejected outcomes. Use that controllable mock to assert handleEventDelete
refreshes after success and displays the error toast after failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte`:
- Around line 10-16: Resolve the merge conflict in the script section of
VideoControls.stories.svelte by removing the `<<<<<<< HEAD`, `=======`, and
`>>>>>>> main` markers while retaining the closing module script tag and opening
instance script tag.

---

Nitpick comments:
In `@lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts`:
- Around line 60-62: Update the useDeleteAnnotation mock in VideoDetails.test.ts
so it exposes a stable deleteAnnotation mock configured as an asynchronous
Promise<void>, allowing tests to switch between resolved and rejected outcomes.
Use that controllable mock to assert handleEventDelete refreshes after success
and displays the error toast after failure.

In
`@lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.test.ts`:
- Around line 162-175: Add an intermediate rerender in the test “shows the
delete button only when editable with an onDelete handler” with editable set to
true and no onDelete handler, then assert delete-event-button is absent before
the existing editable-with-handler assertion.

In `@lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.test.ts`:
- Around line 171-193: Update the test “renders a delete affordance on events in
edit mode” to use a mock for onEventDelete, click the delete-event-button, and
assert the mock receives the configured event. Preserve the existing render
setup and presence assertion while verifying the VideoPlayer-to-timeline
callback contract.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 46e7dea7-6996-47bb-894e-7de25847f7f5

📥 Commits

Reviewing files that changed from the base of the PR and between 1699835 and 8c5ed52.

📒 Files selected for processing (8)
  • lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte
  • lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.svelte
  • lightly_studio_view/src/lib/components/VideoDetails/VideoDetails.test.ts
  • lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte
  • lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.svelte
  • lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.test.ts
  • lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.svelte
  • lightly_studio_view/src/lib/components/VideoPlayer/VideoPlayer.test.ts
💤 Files with no reviewable changes (1)
  • lightly_studio_view/src/lib/components/VideoEventTimeline/VideoEventTimeline.stories.svelte

Comment thread lightly_studio_view/src/lib/components/VideoControls/VideoControls.stories.svelte Outdated
@LeonardoRosaa
LeonardoRosaa enabled auto-merge July 22, 2026 13:27
@LeonardoRosaa
LeonardoRosaa added this pull request to the merge queue Jul 22, 2026
Merged via the queue into main with commit 7d01614 Jul 22, 2026
22 checks passed
@LeonardoRosaa
LeonardoRosaa deleted the horatiu-lig-10189-edit-events-3 branch July 22, 2026 13:42
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.

3 participants