-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reset session if pollworker card is pulled during paper load prompt/intake #4647
Reset session if pollworker card is pulled during paper load prompt/intake #4647
Conversation
e538abf
to
1437ff2
Compare
@@ -43,8 +43,7 @@ import { | |||
DEVICE_STATUS_POLLING_INTERVAL_MS, | |||
DEVICE_STATUS_POLLING_TIMEOUT_MS, | |||
MAX_BALLOT_BOX_CAPACITY, | |||
RESET_AFTER_JAM_DELAY_MS, | |||
SUCCESS_NOTIFICATION_DURATION_MS, | |||
NOTIFICATION_DURATION_MS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file's diff is mostly whitespace; recommend turning whitespace diff off to view
@@ -439,6 +440,18 @@ export function AppRoot({ | |||
return <JamClearedPage stateMachineState={stateMachineState} />; | |||
} | |||
|
|||
const isInPaperLoadingStage = | |||
stateMachineState === 'accepting_paper' || | |||
stateMachineState === 'loading_paper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the second video, it seemed a little weird to me that the "start voting" screen is shown while the paper is still being loaded and then if the poll worker removes their card, this error can occur which makes them have to start over. I feel like the "start voting" screen indicates that it's safe to remove the poll worker card. Maybe a "loading paper... please wait" screen would be helpful?
Going to hold off on technical review for now til we resolve the product discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I forgot to replace the video - this check should fix it. I'll confirm and upload a new video
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, just let me know when you want me to take another look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uploaded the new video and re-requested review 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more UX question: Is there a reason to have a delay and show a message when the poll worker card is removed before loading paper? Kind of seems like it could just cancel and go back to the Insert Card screen immediately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong reason - I kept them the same for consistency but we can also just end the session. The more I think about it, it's probably less confusing if we skip the message.
To be clear, are you ok with keeping the message for when the poll worker card is pulled during the physical paper load stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with keeping it, though I'd be curious to see how it feels to you without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in that case, it'll be more surprising to the poll worker if we end the session. IMO we should leave the message in for the actual paper loading stage, or remove both the message and auth check (so a poll worker can pull their card once the paper has been grasped by the printer).
Of those 2 options, the former is safer, so inclined to leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me!
1437ff2
to
ea91d36
Compare
ea91d36
to
7143038
Compare
Must have accidentally requested a review early - not sure how. @jonahkagan this is now ready for review |
scannedImagePaths: undefined, | ||
isPatDeviceConnected: false, | ||
}); | ||
poll_worker_auth_ended_unexpectedly: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the poll worker reinserts their card during this state or during the not_accepting_paper
state that comes after?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In poll_worker_auth_ended_unexpectedly
, nothing happens because we don't poll auth.
not_accepting_paper
is the initial state so it starts a new voting session as normal.
entry: ['resetContext', 'endCardlessVoterAuth'], | ||
after: { | ||
// The frontend needs time to idle in this state so the user can read the status message | ||
[NOTIFICATION_DURATION_MS]: 'not_accepting_paper', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watching the video, it feels like the paper should be ejected while this message is showing, rather than after. Though I think it's totally fine to leave as is since this is likely an uncommon case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. It's a quick change so not a problem to add even if it's uncommon
@@ -545,6 +561,9 @@ export function AppRoot({ reload }: Props): JSX.Element | null { | |||
} | |||
} | |||
|
|||
// Implicitly map resetting_state_machine_no_delay to return InsertCardScreen | |||
// because that state implies we are returning to the starting (default) state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be made explicit (e.g. with an assert
) or by masking resetting_state_machine_no_delay
on the backend by returning a state that would go to the insert card screen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// it means the state hasn't caught up to auth changes. We check that edge case here to avoid flicker ie. | ||
// rendering the ballot briefly before rendering the correct "Insert Card" screen | ||
stateMachineState !== 'accepting_paper' | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we've run into these cases before where the backend and frontend have out of sync state. It's pretty confusing. Do you think we could make it more straightforward if the backend was solely responsible for deciding what state we should show and the frontend only rendered screens based on the state machine state (rather than also trying to incorporate auth state)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I didn't foresee this issue when adding auth polling to the backend. I agree it's pretty awful. In my mind the fix is related to #3985, which would move the frontend to an exhaustive switch
to handle all state machine states (and only states, no auth).
cc @arsalansufi who had a question about #3985 - for all states that involve auth, we'll need to patch like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, forgot about #3985. I agree that would resolve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping / example! Does make the motivation for #3985 clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working through the changes!
Overview
#3974
During either paper loading state, resets the voter session if poll worker auth is ended before paper is done loading.
Previously, the code allowed a poll worker to pull their card either
Demo Video or Screenshot
IMG_4793.mov
Testing Plan
Checklist