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

[LIVE-12648] Crash because of invalid DeviceModelId #6912

Merged
merged 6 commits into from
May 28, 2024

Conversation

ofreyssinet-ledger
Copy link
Contributor

@ofreyssinet-ledger ofreyssinet-ledger commented May 23, 2024

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • USB connection on Android

πŸ“ Description

The store has some bad data in it because we are doing bad type assertions of some objects into the Device type.
It's currently causing crashes at different levels of LLM, on Android.

The solution proposed here is:

  • Remove the as Device type assertions. If an object is incorrect (here, because it does not contain device model id), it is actually unusable so it should be ignored. We could not reproduce the issue but it appears that in some rare cases, the "device discovery" of the Android USB transport sends event with such invalid objects.
  • Fix the selectors so that they filter out this invalid data. In cases where it previously would have crashed, it will just behave as if the last connected device was not saved, so the app stays fonctional. The invalid data will be replaced at some point in the store, the next time the user connects a device.

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@ofreyssinet-ledger ofreyssinet-ledger requested review from a team as code owners May 23, 2024 10:10
Copy link

vercel bot commented May 23, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

5 Ignored Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:30pm
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:30pm
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:30pm
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:30pm
web-tools ⬜️ Ignored (Inspect) Visit Preview May 24, 2024 5:30pm

@live-github-bot live-github-bot bot added desktop Has changes in LLD mobile Has changes in LLM common Has changes in live-common cli labels May 23, 2024
@ofreyssinet-ledger ofreyssinet-ledger force-pushed the bugfix/LIVE-12648-crash-devicemodelid branch 3 times, most recently from b2c1f57 to de9d42e Compare May 23, 2024 11:09
Copy link
Member

Choose a reason for hiding this comment

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

😍

valpinkman
valpinkman previously approved these changes May 24, 2024
Copy link
Member

@valpinkman valpinkman left a comment

Choose a reason for hiding this comment

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

Very good. From what we saw together it definitely make things more robust.
And shipped with tests πŸ‘Œ

@ofreyssinet-ledger ofreyssinet-ledger force-pushed the bugfix/LIVE-12648-crash-devicemodelid branch from 3f637a2 to cf58a90 Compare May 24, 2024 17:29
@ofreyssinet-ledger ofreyssinet-ledger merged commit c10c05a into develop May 28, 2024
58 checks passed
@ofreyssinet-ledger ofreyssinet-ledger deleted the bugfix/LIVE-12648-crash-devicemodelid branch May 28, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli common Has changes in live-common desktop Has changes in LLD mobile Has changes in LLM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants