Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete persistent notifications migration #92828

Merged
merged 20 commits into from May 26, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented May 8, 2023

frontend: home-assistant/frontend#16476

Breaking change

Persistent notifications are no longer stored in the state machine.

The notification_id is no longer mutated with slugify. When calling the dismiss service, always pass the original notification_id that was passed in.

Proposed change

The migration (started in #57157) to using a websocket subscription for persistent notifications is complete.

This solves the following problems:

  • Events being fired (and stored in the database)
  • Notifications being stored in the state machine (and stored in the database)
  • Having to poll for notifications when the event was fired (now pushed via subscribe)
  • Thundering herd problem at startup if lots of devices are discovered
  • All notifications being sent every time (larger payload than needed)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

TODO:

Screenshot 2023-05-09 at 6 13 28 PM

bdraco added 2 commits May 8, 2023 17:26
Persistent notifications are no longer stored in
the state machine and no longer fire events
Persistent notifications are no longer stored in
the state machine and no longer fire events
@home-assistant
Copy link

home-assistant bot commented May 8, 2023

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (persistent_notification) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of persistent_notification can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign persistent_notification Removes the current integration label and assignees on the pull request, add the integration domain after the command.

@bdraco bdraco marked this pull request as ready for review May 9, 2023 09:18
@bdraco bdraco requested review from a team, cgtobi, balloob and marcelveldt as code owners May 9, 2023 09:18
@balloob
Copy link
Member

balloob commented May 14, 2023

We should mark the removal from the state machine as a breaking change. Some people have used it in the past to automatically dismiss certain notifications.

@bdraco
Copy link
Member Author

bdraco commented May 14, 2023

Adjusted the text.
Do we need to give them an alternative way to enumerate them? (poc in #94113)

@balloob balloob merged commit 48485fc into dev May 26, 2023
52 checks passed
@balloob balloob deleted the persistent_notifications_no_more_state_machine branch May 26, 2023 03:09
hookedonunix pushed a commit to hookedonunix/home-assistant that referenced this pull request May 26, 2023
* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* fixes

* fixes

* fixes

* ws test

* update tests

* update tests

* fix more tests

* fix more tests

* more fixes

* fix

* fix person

* fix person

* keep whitelist

* use singleton
cyr-ius pushed a commit to cyr-ius/home-assistant that referenced this pull request May 26, 2023
* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* Complete migration of persistent notifications

Persistent notifications are no longer stored in
the state machine and no longer fire events

* fixes

* fixes

* fixes

* ws test

* update tests

* update tests

* fix more tests

* fix more tests

* more fixes

* fix

* fix person

* fix person

* keep whitelist

* use singleton
@github-actions github-actions bot locked and limited conversation to collaborators May 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants