Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Rework how players produce warnings and errors. #670

Merged
merged 1 commit into from May 1, 2021

Conversation

defunctzombie
Copy link
Contributor

@defunctzombie defunctzombie commented Apr 26, 2021

Previously, players used sendNotification whenever they encountered a
warning or an error. sendNotification is a one-way out-of-band reporting
mechanism. Once the player produced the error it would persist in the app
(and in the user's app bar) for the remainder of the app lifetime. This
led to a confusing user experience when a player had a transient error
that was resolved (i.e. reconnection after failed connection).

This change removes sendNotification from all players and replaces it
with a problems entry in the player state. The player state is how
players communicate their updates to the outside world. Problems are another
form of player updates. By sending problems via the player state, a
player can add/remove/clear problems as necessary.

This change updates the player presence indicator ui to indicate the presence
of problems in addition to the player presence. The user can see the list
of problems by clicking the presence indicator and and further seeing any
details a problem may expose.

Here is an example of a player loading and indicating errors:
Screen Shot 2021-04-30 at 6 31 52 PM

@defunctzombie defunctzombie force-pushed the roman/player-error-notifications branch from 4dfbdcb to 49e1ba3 Compare April 29, 2021 00:30
@@ -66,62 +68,43 @@ type UserNodeActions = {
setUserNodeRosLib: SetUserNodeRosLib;
};

const rpcFromNewSharedWorker = (worker: SharedWorker, name: string) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dislike the disconnect from call site and error hookup - regardless of that stylistic preference - the error handling needs access to member field now so I found it easier to put inline since some of the workers are userspace node specific

Copy link
Member

Choose a reason for hiding this comment

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

It seems like more error handling code is duplicated now; why did this need to be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error handling is different for the transform worker and the runtime worker. The runtime worker errors bucket by the nodeId so that we can surface errors from multiple userspace nodes and clear errors from individual userspace nodes. These errors happen when the worker itself may be running and we clear them if we get a successful message from the node. The error handling for the transform worker errors are not cleared and not tied to a specific node.

@amacneil
Copy link
Contributor

I am getting this (related?) error on current main branch. To produce, simply run yarn clean && yarn build:prod && yarn start.

image (3)

@defunctzombie defunctzombie force-pushed the roman/player-error-notifications branch 3 times, most recently from 837e413 to 1c8928e Compare May 1, 2021 01:43
@defunctzombie defunctzombie changed the title Send player errors and warnings via playerState Rework how players produce warnings and errors. May 1, 2021
@defunctzombie
Copy link
Contributor Author

@amacneil I am not able to reproduce with your instructions on this branch.

@defunctzombie defunctzombie marked this pull request as ready for review May 1, 2021 01:46
app/players/Ros1Player.ts Outdated Show resolved Hide resolved
app/players/UserNodePlayer/index.ts Show resolved Hide resolved
@@ -66,62 +68,43 @@ type UserNodeActions = {
setUserNodeRosLib: SetUserNodeRosLib;
};

const rpcFromNewSharedWorker = (worker: SharedWorker, name: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

It seems like more error handling code is duplicated now; why did this need to be removed?

app/players/types.ts Outdated Show resolved Hide resolved
Previously, players used sendNotification whenever they encountered a
warning or an error. sendNotification is a one-way out-of-band reporting
mechanism. Once the player produced the error it would persist in the app
(and in the user's app bar) for the remainder of the app lifetime. This
led to a confusing user experience when a player had a transient error
that was resolved (i.e. reconnection after failed connection).

This change removes sendNotification from all players and replaces it
with a _problems_ entry in the player state. The player state is how
players communicate their updates to the outside world. Problems are another
form of player updates. By sending problems via the player state, a
player can add/remove/clear problems as necessary.

This change updates the player presence indicator ui to indicate the presence
of problems in addition to the player presence. The user can see the list
of problems by clicking the presence indicator and and further seeing any
details a problem may expose.
@defunctzombie defunctzombie force-pushed the roman/player-error-notifications branch from 1c8928e to 9716c74 Compare May 1, 2021 23:36
@defunctzombie defunctzombie enabled auto-merge (squash) May 1, 2021 23:44
@defunctzombie defunctzombie merged commit 182ed1a into main May 1, 2021
@defunctzombie defunctzombie deleted the roman/player-error-notifications branch May 1, 2021 23:45
@jtbandes jtbandes mentioned this pull request Jun 23, 2021
9 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants