fix: camera stream bug #3107
No reviewers
Labels
No labels
1week
2weeks
Failed compliance check
IP cameras
NATS
Possible security concern
Review effort 1/5
Review effort 2/5
Review effort 3/5
Review effort 4/5
Review effort 5/5
UI
aardvark
accessibility
amd64
api
arm64
auth
back-end
bgp
blog
bug
build
checkers
ci-cd
cleanup
cnpg
codex
core
dependencies
device-management
documentation
duplicate
dusk
ebpf
enhancement
eta 1d
eta 1hr
eta 3d
eta 3hr
feature
fieldsurvey
github_actions
go
good first issue
help wanted
invalid
javascript
k8s
log-collector
mapper
mtr
needs-triage
netflow
network-sweep
observability
oracle
otel
plug-in
proton
python
question
reddit
redhat
research
rperf
rperf-checker
rust
sdk
security
serviceradar-agent
serviceradar-agent-gateway
serviceradar-web
serviceradar-web-ng
siem
snmp
sysmon
topology
ubiquiti
wasm
wontfix
zen-engine
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
carverauto/serviceradar!3107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refs/pull/3107/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from GitHub pull request.
Original GitHub pull request: #3109
Original author: @mfreeman451
Original URL: https://github.com/carverauto/serviceradar/pull/3109
Original created: 2026-04-01T00:30:44Z
Original updated: 2026-04-01T00:35:19Z
Original head: carverauto/serviceradar:bug/camera-streams-not-opening
Original base: staging
Original merged: 2026-04-01T00:31:07Z by @mfreeman451
IMPORTANT: Please sign the Developer Certificate of Origin
Thank you for your contribution to ServiceRadar. Please note, when contributing, the developer must include
a DCO sign-off statement indicating the DCO acceptance in one commit message. Here
is an example DCO Signed-off-by line in a commit message:
Describe your changes
Issue ticket number and link
Code checklist before requesting a review
Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/3109#issuecomment-4166590444
Original created: 2026-04-01T00:30:57Z
Review Summary by Qodo
Fix camera stream opening with idempotent error recovery
🐞 Bug fixWalkthroughs
Description
Diagram
File Changes
1. elixir/serviceradar_core/lib/serviceradar/camera/relay_session_manager.ex
🐞 Bug fix+41/-22. elixir/serviceradar_core/test/serviceradar/camera/relay_session_manager_test.exs
🧪 Tests+59/-0Imported GitHub PR comment.
Original author: @qodo-code-review[bot]
Original URL: https://github.com/carverauto/serviceradar/pull/3109#issuecomment-4166590527
Original created: 2026-04-01T00:30:58Z
Code Review by Qodo
🐞 Bugs (2)📘 Rule violations (1)📎 Requirement gaps (0)1. New test uses Ecto.UUID.generate()
📘 Rule violation⚙ Maintainability2. Recovery logs warn too often
🐞 Bug✧ Quality3. Active recovery drops open metadata
🐞 Bug≡ CorrectnessImported GitHub PR review comment.
Original author: @Copilot
Original URL: https://github.com/carverauto/serviceradar/pull/3109#discussion_r3019139696
Original created: 2026-04-01T00:35:04Z
Original path: elixir/serviceradar_core/lib/serviceradar/camera/relay_session_manager.ex
Original line: 228
mark_session_opening_safely/7rescues all exceptions and then attempts to treat them as an idempotent state transition. This can hide unexpected programming/runtime errors (e.g., KeyError/FunctionClauseError) and potentially return{:ok, session}even whenmark_openingcrashed for an unrelated reason. Consider rescuing only the specific Ash/state-machine transition errors that indicate the session already moved past:requested, and re-raising (or returning{:error, error}without recovery) for anything else.Imported GitHub PR review comment.
Original author: @Copilot
Original URL: https://github.com/carverauto/serviceradar/pull/3109#discussion_r3019139716
Original created: 2026-04-01T00:35:04Z
Original path: elixir/serviceradar_core/lib/serviceradar/camera/relay_session_manager.ex
Original line: 236
The warning log includes
inspect(reason). Whenreasonis an Ash error/changeset it can include request attributes (e.g., lease token / command id) and may leak sensitive data into logs. Consider logging only the exception module/message (or a sanitized subset) and attach structured metadata instead ofinspect/1on the whole error term.Imported GitHub PR review comment.
Original author: @Copilot
Original URL: https://github.com/carverauto/serviceradar/pull/3109#discussion_r3019139730
Original created: 2026-04-01T00:35:04Z
Original path: elixir/serviceradar_core/lib/serviceradar/camera/relay_session_manager.ex
Original line: 117
If
mark_session_opening_safely/7returns{:error, reason}(i.e., it couldn't recover by reloading an:opening/:activesession),request_open/3currently just returns that error and leaves the newly-created relay session in:requestedwithout marking it failed or emitting a health failure event. Consider handling the non-recoverable{:error, reason}case similarly to the dispatch failure path (callmark_failedandmaybe_record_session_failure) to avoid orphaned/stuck sessions.