-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Chore(suite): refactor FW check selectors #15626
base: develop
Are you sure you want to change the base?
Conversation
0a62a53
to
6e172eb
Compare
f096e71
to
266e7f5
Compare
export const skippedHashCheckErrors = [ | ||
'check-skipped', | ||
'check-unsupported', | ||
// this could be serious, but it's also caught by revision check, which handles edge-cases better, so it's skipped here | ||
'unknown-release', | ||
] satisfies FirmwareHashCheckError[]; | ||
|
||
// These errors will be treated softly, with only a warning displayed instead of modal | ||
export const softHashCheckErrors = [...skippedHashCheckErrors]; |
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.
softHashCheckErrors
will be removed in next commits (no need to support that)
) { | ||
return; | ||
} | ||
|
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.
useReportRevisionCheck
is now much nicer thanks to the new selector that gets error regardless of enabled
.
But useReportHashCheck
does not use it, as it also needs payload, so I have to do the whole decision process again.
💭 I could create selectHashCheckErrorPayload
but sounds like overkill, what do you think?
reportCheckFail('hash', { ...commonData, hashCheckError, hashCheckErrorPayload }); | ||
}, [commonData, hashCheckError, isHashCheckError, hashCheckErrorPayload]); | ||
}, [commonData, hashCheckError, hashCheckErrorPayload]); |
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.
📝 note: I tried passing just hashCheck
to the useEffect, and declaring hashCheckError, hashCheckErrorPayload
within the useEffect body.
At first glance it's nicer, as I can early return & avoid the ternaries.
🚫 But hashCheck
obj from redux is referentially unstable, so it Sentry fires repeatedly
266e7f5
to
2eea204
Compare
Description
Refactor selectors for FW authenticity checks, as they became complex, duplicated and with misleading names.
Most notably, soft errors were called skipped errors, even though they display banner, so they're not rly skipped 🙈
Incidentally, fix small issue from #15555 where sentry reports even skipped errors like
check-unsupported
. The main purpose of 15555 was to report it even when turned off in settings. But thinking about it again, IMO we should report soft reivision check errors too (also didn't before 15555), but exclude the skipped hash check errors.error
selectors toerrorIfEnabled
, and spliterror
from them so they can be used for Sentryother-error
to that categoryYou can test other-error by checking out testing branch
Notes
I attempted to standardize variable names as follows:
Still, it's not consistent between revision & hash check because they got different requirements: