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

feat(suite-native): disable FW rev check by message system #16898

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

Lemonexe
Copy link
Contributor

@Lemonexe Lemonexe commented Feb 10, 2025

Description

Create a message system feature flag that disables the FW revision check on mobile only.

Related Issue

Resolve #16456

QA instructions:

Possible locally in dev build by adding the following to config.v1.json, signing and forcing local JWS to true

{
    "conditions": [
        {
            "environment": {
                "desktop": "!",
                "mobile": "*",
                "web": "!"
            }
        }
    ],
    "message": {
        "id": "a0563f6e-aad9-4e62-bb18-72cda92ac4a8",
        "priority": 1,
        "dismissible": false,
        "variant": "info",
        "category": "feature",
        "content": {"en-GB": "Placeholder", "en": "Placeholder", "es": "Placeholder", "cs": "Placeholder", "de": "Placeholder", "fr": "Placeholder", "it": "Placeholder", "pt": "Placeholder", "tr": "Placeholder", "ru": "Placeholder", "ja": "Placeholder", "uk": "Placeholder", "hu": "Placeholder" },
        "feature": [
            {
                "domain": "security.firmware.revisionCheck.mobile",
                "flag": false
            }
        ]
    }
}

Copy link

coderabbitai bot commented Feb 10, 2025

Walkthrough

This pull request introduces a new mobile firmware revision check capability using the message system. A new feature flag entry, firmwareRevisionCheckMobile, has been added to the feature constants in the message system types file. The native device package has been updated to include a dependency on the suite-common/message-system package, integrating shared logic for feature flags. In addition, the selectors file in the native device module has been modified to import message system types and functions, update state type definitions, and adjust the firmware revision check error logic to account for the new message system feature flag. Lastly, the TypeScript configuration in the native device package now references the suite-common/message-system project, ensuring seamless integration of types and declarations.

Assessment against linked issues

Objective Addressed Explanation
Disable mobile FW revision check by message-system (#16456)

Possibly related PRs

Suggested labels

no-project, release

Suggested reviewers

  • mroz22
  • komret
  • szymonlesisz
  • peter-sanderson

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc47eef and 6de6ae4.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (4)
  • suite-common/message-system/src/messageSystemTypes.ts (1 hunks)
  • suite-native/device/package.json (1 hunks)
  • suite-native/device/src/selectors.ts (3 hunks)
  • suite-native/device/tsconfig.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: methods / web
  • GitHub Check: methods / core_in_popup
  • GitHub Check: run_android_e2e_tests
  • GitHub Check: e2e-test-suite-web (@group_wallet, trezor-user-env-unix bitcoin-regtest, 1)
🔇 Additional comments (5)
suite-common/message-system/src/messageSystemTypes.ts (1)

27-27: LGTM! Well-structured feature flag addition.

The new feature flag follows the established naming convention and is logically placed near other firmware-related features.

suite-native/device/src/selectors.ts (2)

164-166: LGTM! Proper type extension.

The state type is correctly extended to include MessageSystemRootState, maintaining type safety.


177-183: Verify the default value for the message system feature.

The feature flag is enabled by default (true). Confirm if this aligns with the intended behavior for backward compatibility.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other feature flag usages to verify default values
ast-grep --pattern 'selectIsFeatureEnabled($_, $_, true)'

Length of output: 553


Default Value Verification: Message System Feature Flag is Enabled by Default

The search confirmed that the default value for the message system feature flag is indeed set to true in the code (as seen in suite-native/device/src/selectors.ts). This matches its usage elsewhere (e.g., in suite-native/firmware/src/hooks/useIsFirmwareUpdateFeatureEnabled.tsx), thereby supporting backward compatibility as intended.

  • Usage in suite-native/device/src/selectors.ts confirms the default value is true
  • Consistent usage noted in suite-native/firmware/src/hooks/useIsFirmwareUpdateFeatureEnabled.tsx
suite-native/device/tsconfig.json (1)

5-7: LGTM! Proper TypeScript project reference.

The message-system reference is correctly added, ensuring proper type resolution.

suite-native/device/package.json (1)

17-17: LGTM! Proper dependency addition.

The message-system dependency is correctly added with the workspace version specifier.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

github-actions bot commented Feb 10, 2025

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 26
  • More info

Learn more about 𝝠 Expo Github Action

@Lemonexe Lemonexe force-pushed the feat/disable-mobile-FW-rev-check-message-system branch from 2ef20a6 to 6de6ae4 Compare February 10, 2025 09:32
@Lemonexe Lemonexe marked this pull request as ready for review February 10, 2025 09:46
@Lemonexe Lemonexe requested review from a team, tomasklim and matejkriz as code owners February 10, 2025 09:47
@Lemonexe Lemonexe added the mobile Suite Lite issues and PRs label Feb 10, 2025
@Lemonexe Lemonexe merged commit 0ead5c5 into develop Feb 11, 2025
79 of 80 checks passed
@Lemonexe Lemonexe deleted the feat/disable-mobile-FW-rev-check-message-system branch February 11, 2025 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Suite Lite issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable mobile FW revision check by message-system
2 participants