Skip to content

fix(sentry): drop expected operator-input/transient noise (round 2)#3141

Merged
vpetersson merged 6 commits into
masterfrom
fix/sentry-noise-round2
Jul 8, 2026
Merged

fix(sentry): drop expected operator-input/transient noise (round 2)#3141
vpetersson merged 6 commits into
masterfrom
fix/sentry-noise-round2

Conversation

@vpetersson

@vpetersson vpetersson commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Issues Fixed

Description

A second Sentry sweep surfaced four new noise-class issues on 2026.7.0 — all expected operator-input or transient conditions that were logged/captured as errors despite already having a proper user-facing outcome. Same theme as the AuthSettingsError (#3068) and gaierror (#3132) cleanups.

  • ANTHIAS-3W — uploading a non-backup file to recover logged logger.exception('Backup recovery failed') while already returning an "Invalid backup archive" error to the operator. Fixed in both recover entry points that share this handling: the API view (RecoverViewMixin, /api/v1|v2/recover) and the HTML view (settings_recover). → warning.
  • ANTHIAS-3V — the viewer's Scheduler.get_next_asset logged error('Asset not found or processed') on a benign race (operator jumps to a since-deleted / still-processing asset). → warning + names the asset + falls back to the playlist.
  • ANTHIAS-3T — a yt-dlp DownloadError (network timeout, geo-block, private/deleted video, bad URL) was captured by the Celery Sentry integration. The download task's on_failure already records metadata.error_message, so the operator sees a "Failed" pill. → dropped in before_send, matched by name + yt_dlp/yt_dlp. module so a look-alike package can't smuggle its own DownloadError through (and yt_dlp isn't imported there).
  • ANTHIAS-3Xcelery.backends.asynchronous logs "Retry limit exceeded while trying to reconnect to the Celery result store backend" at a fatal level during a sustained redis outage — the same transient-redis noise as the loggers already ignored. → ignore_logger.

Each change has a regression test (including both recover entry points). Separately resolved ANTHIAS-3S (No module named 'channels' from a non-device session-* context) as environmental.

Note: the specific 3W event that started this was a 1.4 KB curl upload of a non-gzip file — unrelated operator input. The separate large-backup restore OOM it prompted a look at is fixed in #3143 (stream the upload instead of read()-ing it into RAM), with deeper restore follow-ups tracked in #3142.

Validation on real hardware

The before_send drops and ignore_logger registration were confirmed in the real server container on the x86 testbed during the first sweep's validation pass; these are the same mechanism extended to two more exception/logger names. Server-side and arch-independent.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

🤖 Generated with Claude Code

Second Sentry sweep found four noise-class issues on 2026.7.0 — all
expected conditions logged/captured as errors, each already handled
gracefully for the operator:

- recover endpoint: log a bad-archive upload at warning, not
  exception (already returns 400) — ANTHIAS-3W
- viewer scheduler: log a since-deleted/processing jump target at
  warning and fall back to the playlist — ANTHIAS-3V
- before_send: drop yt-dlp DownloadError (on_failure already records
  metadata.error_message for the operator) — ANTHIAS-3T
- ignore the celery.backends.asynchronous reconnect-retry logger,
  same transient-redis noise as the others — ANTHIAS-3X

Fixes #3140

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vpetersson vpetersson requested a review from a team as a code owner July 8, 2026 05:26
@vpetersson vpetersson self-assigned this Jul 8, 2026
@vpetersson vpetersson requested a review from Copilot July 8, 2026 05:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces Sentry noise by downgrading expected operator-input/transient conditions from errors to warnings and by extending the Sentry before_send / ignore_logger filters so non-actionable events aren’t captured, while keeping user-facing outcomes intact.

Changes:

  • Downgrade logging for invalid backup recovery uploads and for benign “jump to missing/still-processing asset” races.
  • Drop yt-dlp DownloadError in _sentry_before_send (matched by exception name+module) and ignore celery.backends.asynchronous logger noise.
  • Add regression tests covering each new suppression/downgrade.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_sentry.py Adds tests for dropping yt-dlp DownloadError events and for ignoring celery.backends.asynchronous.
tests/test_scheduler.py Adds regression test ensuring missing extra_asset logs warning (not error) and falls back.
src/anthias_viewer/scheduling.py Changes missing/still-processing extra_asset logging from error to warning with asset context and fallback.
src/anthias_server/django_project/settings.py Extends Sentry before_send drop list for yt-dlp DownloadError and ignores celery.backends.asynchronous.
src/anthias_server/api/views/mixins.py Downgrades invalid backup recovery exception logging to warning while still returning 400 validation error.
src/anthias_server/api/tests/test_v1_endpoints.py Adds regression test asserting invalid recover upload logs warning (not exception) and returns 400.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/anthias_server/django_project/settings.py
Copilot review: startswith('yt_dlp') would also match yt_dlp2 /
yt_dlp_fake. Require the module to be exactly 'yt_dlp' or a
'yt_dlp.' submodule; added a look-alike-module negative test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

The API recover view was downgraded to warning for ANTHIAS-3W, but
the HTML settings_recover view still logged the same operator-input
failure via logger.exception. Bring it in line.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/anthias_server/app/views.py
Copilot review: the settings_recover exception→warning downgrade had
no regression test (unlike the API path). Assert a bad archive logs
at warning, not exception.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread src/anthias_server/api/tests/test_v1_endpoints.py Outdated
Comment thread tests/test_template_views.py
Copilot review round 4:
- add create=True to the API recover test's builtin-open patch
  (mixins.py has no module-level open), matching the sibling tests
- the HTML recover test now actually asserts the error message is
  shown, matching its docstring

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

…und2

# Conflicts:
#	src/anthias_server/api/tests/test_v1_endpoints.py
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@vpetersson vpetersson merged commit 5b492e1 into master Jul 8, 2026
9 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.

Sentry noise round 2: expected conditions logged as errors (ANTHIAS-3W/3V/3T/3X)

2 participants