Skip to content

Error Surfacing - #1091

Merged
SteveMicroNova merged 3 commits into
VersionWarningfrom
ResetOnFailure
Jun 24, 2026
Merged

Error Surfacing#1091
SteveMicroNova merged 3 commits into
VersionWarningfrom
ResetOnFailure

Conversation

@SteveMicroNova

@SteveMicroNova SteveMicroNova commented May 26, 2026

Copy link
Copy Markdown
Contributor

What does this change intend to accomplish?

Surface backend errors to users better

Also mitigate some minor issues that required surfacing

Checklist

  • Have you tested your changes and ensured they work?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • If applicable, have you updated the documentation/manual?
  • If applicable, have you updated the CHANGELOG?
  • Does your submission pass linting & tests? You can test on localhost using ./scripts/test
  • Have you written new tests for your core features/changes, as applicable?
  • If this is a UI change, have you tested it across multiple browser platforms on both desktop and mobile?

@SteveMicroNova
SteveMicroNova changed the base branch from main to VersionWarning May 26, 2026 20:47
Comment thread amplipi/app.py Outdated
return code_response(ctrl, ctrl.play_media(media))


@api.patch("/api/alert/hide")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This pathing might need some work. It made more sense when I had multiple alert endpoints being added here but I found 2/3 of the endpoints didn't make sense as I kept devving on this

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.

Having only a single endpoint for this is useful since it reduces the scope on this. I wish we had a place for odds and ends like this that don't focus on the actual functionality of the unit.

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.

Since it is only exposed via api/info does it make sense to be there?

Maybe /api/info/hide-alerts or /api/info/alerts/hide ?

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.

I'm not sold on any of those options tho.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wish we had a place for odds and ends like this that don't focus on the actual functionality of the unit.

It would be trivial to add a api-utils.py or something similar that uses the same FastAPI instance without having it in the same file as the primary functionality if that's what you mean

Also for the routing opinions, I like /api/info/alerts/hide because I do see a world where we might want a /api/info/alerts/add endpoint, the main case being if the frontend finds an error that should become global to all users, or a world where we might want /api/info/alerts as a GET request to return just that portion of the info block (this could be fairly useful to raise these issues to home assistant's notification scheme, for example)

Comment thread amplipi/models.py
Comment thread amplipi/utils.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The MUI alert component that we use has a "severity" property that has 4 possible values - error, success, warning, and info. I have had no particular use for warning and info thus far, so I flattened it into just success or error. Within that, I generally only needed error so I had it be a store_true arg for whether it shows success or fail, I've upgraded that with full granularity to future proof these changes.

Luckily the other two AlertBar style components we use don't have the same controls so I didn't need to upkeep those for full feature parity in this PR

Comment thread tests/test_rest.py
@codecov-commenter

codecov-commenter commented May 29, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 84.44444% with 14 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (VersionWarning@16ea23c). Learn more about missing BASE report.

Files with missing lines Patch % Lines
amplipi/utils.py 81.39% 8 Missing ⚠️
amplipi/rt.py 25.00% 6 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@                Coverage Diff                @@
##             VersionWarning    #1091   +/-   ##
=================================================
  Coverage                  ?   50.73%           
=================================================
  Files                     ?       41           
  Lines                     ?     7478           
  Branches                  ?        0           
=================================================
  Hits                      ?     3794           
  Misses                    ?     3684           
  Partials                  ?        0           
Flag Coverage Δ
unittests 50.73% <84.44%> (?)

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.

Comment thread amplipi/rt.py Outdated
Comment thread amplipi/utils.py
@SteveMicroNova

Copy link
Copy Markdown
Contributor Author

To record a conversation we've had in the office:
We'd like to run this for a few days and see if we trigger this message on anything. It seems fine so far, but directing people to email us when they don't really need to could be needlessly annoying for everyone

@SteveMicroNova

Copy link
Copy Markdown
Contributor Author

After 24 hours of testing, this is looking good. I'm going to keep my automated testing script going while I'm on vacation next week and I suspect that once I'm back on the 15th this will be good to merge.

@SteveMicroNova

Copy link
Copy Markdown
Contributor Author

It is now the 15th, and my minute-by-minute script has yet to trip the sensor on this one. We ought to be fine for standard user day-to-day operation without having a big threatening error screen.

Comment thread amplipi/rt.py Outdated
@linknum23
linknum23 self-requested a review June 15, 2026 18:05
Comment thread web/src/App.jsx Outdated
SteveMicroNova and others added 3 commits June 24, 2026 15:43
… that notifies the user when the fix is unsuccessful
When the preamp microcontroller hangs it stops ACKing and every I2C
write fails with OSError 121 (EREMOTEIO). The existing fallback only
reopens the SMBus handle, which recovers a transient bus glitch but not
a hung preamp - zone control stays dead until someone power-cycles the
unit. Escalate: when the reopened-bus retry also fails, reset the
preamps in place, re-assign I2C addresses, reopen the bus and re-flush
all cached register values so zone state (mute/source/volume) survives,
then retry the write. Rate-limited to once per 20s so a benign one-off
glitch never resets audio.

Observed live on our unit 2026-06-04 (zone control dead until manual
reboot); with this patch the same wedge self-heals in under a second.

Signed-off-by: Stamate Viorel <stamate.viorel@gmail.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@SteveMicroNova
SteveMicroNova merged commit f20b745 into VersionWarning Jun 24, 2026
3 checks passed
@SteveMicroNova
SteveMicroNova deleted the ResetOnFailure branch June 24, 2026 19:43
@SteveMicroNova SteveMicroNova mentioned this pull request Jul 21, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants