fix(upgrade): correct upgrader RPC method names (prepare/appendData/execute) - #2
Merged
Merged
Conversation
…/execute upgrade_firmware() drove `upgrader.start` -> `upgrader.send` -> `upgrader.execute`, but the hunter daemon's actual RPC handlers (reversed on a Zenointel GK7205 camera) are `upgrader.prepare` -> `upgrader.appendData` -> `upgrader.execute`. As written it would fail at the first call with RPC 405 (method not allowed) rather than flashing. Method strings are now named constants in const.py; firmware_state uses UPGRADER_STATE. Tests updated to the corrected names. Still mock-only / never run on hardware and confirm-guarded: the method names are from firmware but the JSON param names (Type / Offset+Length) are not byte-proven (docstring flags this).
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR |
PR Summary by QodoCorrect firmware upgrader RPC method names
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
upgrade_firmware()droveupgrader.start→upgrader.send→upgrader.execute,but the
hunterdaemon's actual RPC upgrade handlers — reversed on a ZenointelGK7205V510 camera — are
upgrader.prepare→upgrader.appendData→upgrader.execute(the same handlers the web/cgi-bin/upgrader.cgibridgesto). As written, a real flash would fail at the first call with RPC
405(method not allowed) instead of upgrading.
Changes:
const.py(UPGRADER_STATE/PREPARE/APPEND/EXECUTE);firmware_state()usesUPGRADER_STATE.tests/test_dahua.py::TestFirmwareupdated to the new names (30 passing).Type/Offset+Length) are not byte-proven, and this is still mock-only / never run on hardware /confirm-guarded.Context: read-only
upgrader.getStateon a live SD-2N-4G returnsresult:false(not a
405), i.e. the namespace exists; the exact param names remain a benchtask. Part of the Zenointel OpenIPC-transition work.