Skip to content

feat(cameras): allow admins to update a camera's angle of view - #716

Merged
MateoLostanlen merged 2 commits into
pyronear:mainfrom
Majyles:feat/camera-angle-of-view
Oct 22, 2026
Merged

MateoLostanlen merged 2 commits into
pyronear:mainfrom
Majyles:feat/camera-angle-of-view

Conversation

@Majyles

@Majyles Majyles commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

What
Adds PATCH /cameras/{camera_id}/angle_of_view (admin only) so a camera's field of view can be corrected after calibration, without recreating the camera.

How
Follows the existing /name and /trustable routes: a dedicated CameraAngleOfView schema with the same bounds as at creation (0 < angle_of_view <= 360), telemetry event cameras-update-angle-of-view, and the schema added to CameraCRUD's update types.

Note
Existing sequences keep the cone computed with the previous angle; only new detections use the corrected value. Recomputing past cones could be a future improvement.

Tests
Parametrized tests on the new route: 401 / 403 (agent, user) / 404 / 422 (0, > 360, missing field) / 200, also checking that other camera fields are untouched. Full suite, ruff and ty pass locally.

Closes #694

Add PATCH /cameras/{camera_id}/angle_of_view (admin only), following the
existing /name and /trustable routes, so a camera's field of view can be
corrected after calibration without recreating the camera.

Existing sequences keep the cone computed with the previous angle; only new
detections use the corrected value.

Closes pyronear#694

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Majyles

Majyles commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

pytest-client fails on test_client_constructor with DID NOT RAISE ReadTimeout: that case relies on a 10 µs timeout against a local server, so it passes or fails depending on the runner's speed. This PR doesn't touch the client (17 passed locally), and the same job also fails on main (https://github.com/pyronear/pyro-api/actions/runs/37992531454). Happy to look into making that test deterministic in a separate PR if useful!

@MateoLostanlen
MateoLostanlen self-requested a review October 22, 2026 10:15

@MateoLostanlen MateoLostanlen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Majyles thanks a lot for this PR ! Can you just fix the conflict and we are good to merge 😄

…f-view

# Conflicts:
#	src/tests/endpoints/test_cameras.py
@codecov

codecov Bot commented Oct 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.59%. Comparing base (a4b9cb3) to head (d4f5a71).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #716      +/-   ##
==========================================
+ Coverage   94.57%   94.59%   +0.01%     
==========================================
  Files          60       60              
  Lines        3247     3254       +7     
==========================================
+ Hits         3071     3078       +7     
  Misses        176      176              
Flag Coverage Δ
backend 94.73% <100.00%> (+0.01%) ⬆️
client 91.30% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Majyles

Majyles commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Hi @MateoLostanlen ! Conflict fixed (it was just #713 adding a test next to mine, both are kept). All checks pass (except triage, which fails on fork PRs since the labeler only gets a read-only token there). Thanks for the review!

@MateoLostanlen
MateoLostanlen self-requested a review October 22, 2026 12:47

@MateoLostanlen MateoLostanlen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the edit @Majyles

@MateoLostanlen
MateoLostanlen merged commit d18b727 into pyronear:main Oct 22, 2026
21 of 22 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.

Allow updating a camera's angle_of_view

2 participants