-
Notifications
You must be signed in to change notification settings - Fork 439
fix: boot model update error OK-45857 #8995
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
base: x
Are you sure you want to change the base?
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
WalkthroughAdds an Changes
Sequence Diagram(s)sequenceDiagram
participant UI as PageFirmwareUpdateChangeLog
participant HW as ServiceHardware
participant FW as ServiceFirmwareUpdate
rect rgb(230,240,255)
note right of UI: Start firmware compatibility check
UI->>HW: getCompatibleConnectId(hardwareCallContext=UPDATE_FIRMWARE)
alt no connectId/device/features & UPDATE_FIRMWARE
HW-->>UI: return "" (allow empty)
else has connectId or other contexts
HW-->>UI: return connectId or throw
end
end
rect rgb(240,255,230)
note right of FW: Check bootloader with optional empty id
UI->>FW: checkDeviceIsBootloaderMode({connectId?, allowEmptyConnectId: true})
FW->>FW: getFeaturesWithoutCache({connectId?, allowEmptyConnectId: true})
FW-->>UI: bootloader status
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
8dcc14a to
7c652a1
Compare
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
packages/kit-bg/src/services/ServiceFirmwareUpdate/ServiceFirmwareUpdate.ts(3 hunks)packages/kit-bg/src/services/ServiceHardware/ServiceHardware.ts(1 hunks)packages/kit/src/views/FirmwareUpdate/pages/PageFirmwareUpdateChangeLog.tsx(1 hunks)packages/shared/types/device.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: unittest (20.x)
- GitHub Check: lint (20.x)
🔇 Additional comments (4)
packages/shared/types/device.ts (1)
404-404: LGTM! Enum addition aligns with PR objective.The new
UPDATE_FIRMWAREcontext is clear and follows the existing naming pattern.packages/kit-bg/src/services/ServiceFirmwareUpdate/ServiceFirmwareUpdate.ts (2)
160-165: LGTM! Parameter addition supports boot mode firmware checks.The optional
allowEmptyConnectIdparameter enables firmware checks whenconnectIdis unavailable during boot mode.
387-390: Code is correct—boot mode scenario properly usesallowEmptyConnectId: true.The pattern is intentional. The method
checkDeviceIsBootloaderModeacceptsallowEmptyConnectIdas an optional parameter that relaxes validation rules. Line 388 correctly applies this flag in a bootloader/recovery scenario where connectId may be empty, while line 307 omits it in normal firmware checks where connectId is guaranteed valid. The parameter flows through to downstream hardware service calls as designed.Note: The original review references "checkAllFirmwareRelease," but the actual method called is
checkDeviceIsBootloaderMode.packages/kit/src/views/FirmwareUpdate/pages/PageFirmwareUpdateChangeLog.tsx (1)
66-66: Verified: Context change correctly enables boot mode firmware updates.The change from
USER_INTERACTIONtoUPDATE_FIRMWAREis correct. ThegetCompatibleConnectIdmethod inServiceHardware.ts(lines 1622–1632) explicitly allows nullconnectIdonly forUPDATE_FIRMWAREcontext, which is exactly what the firmware update flow needs for boot mode.
| [EHardwareCallContext.UPDATE_FIRMWARE].includes( | ||
| hardwareCallContext || EHardwareCallContext.USER_INTERACTION, | ||
| ) && |
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.
这段代码写的很啰嗦?应该是 === 就行 ?
Summary by CodeRabbit
Refactor
New Features