foundation: fix broken first-run + storage --json + reexec_in_venv#1
Open
halbothpa wants to merge 1 commit into
Open
foundation: fix broken first-run + storage --json + reexec_in_venv#1halbothpa wants to merge 1 commit into
halbothpa wants to merge 1 commit into
Conversation
The plugin's first-run experience was broken end-to-end on a fresh install. Six bugs (BUGS.md #1-6) chained into a confusing failure mode where bootstrap exited 0, then every RpcSession() raised "bindings not generated". This commit fixes all six in one pass so a clean install just works. * bootstrap.py: - Track upstream rename: app.proto -> application.proto. Drop subghz.proto which 404s from the dev branch and isn't imported. - Hold the .downloaded marker until ALL files download successfully; raise on any failure instead of warning-and-continuing. - Markers are now JSON recording the exact file set, so an upstream rename forces a re-download instead of trusting a stale marker. - Make protoc failures fatal (was: silent warning). - Add verify_proto_imports() self-check after generation. - Skip reexec_in_venv() when sys.argv[0] is "" / "-c" / "-" so ad-hoc `python -c "...bootstrap.reexec_in_venv()"` no longer crashes with `Argument expected for the -c option`. * flipper_core.py: - Alias `application_pb2 as app_pb2` so existing references in this file keep working without a sweeping rename. - Surface the real ImportError in RpcSession.__init__ instead of the misleading "bindings not generated" message. * flipper_storage.py: - Move --port / --json to a parent parser so they parse correctly whether placed before or after the subcommand (was: rejected after). * BUGS.md / .gitignore: mark fixed bugs, ignore renamed marker files. Unblocks PR 2 (reader-thread dispatcher) which needs working protos. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7 tasks
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.
Summary
Fixes 6 bugs (BUGS.md #1-6) that together broke the plugin's first-run experience end-to-end on a clean install.
bootstrap.py: track upstream renameapp.proto→application.proto, drop the (no-longer-published)subghz.proto, hold the.downloadedmarker until all files succeed, make protoc failures fatal instead of silently warning, add averify_proto_importsself-check, and skipreexec_in_venvwhensys.argv[0]is-c/""/-sopython -c \"...bootstrap.reexec_in_venv()\"no longer crashes.flipper_core.py: aliasapplication_pb2 as app_pb2(keeps existing references working), surface the realImportErrorinRpcSession.__init__instead of the misleading "bindings not generated" message.flipper_storage.py: move--port/--jsonto a parent parser so they parse correctly whether placed before or after the subcommand (was: argparse rejected them after).BUGS.md/.gitignore: mark fixed bugs, ignore renamed marker files.Why now
Without this, every fresh install of the plugin failed:
app.proto/subghz.proto.RpcSession(...)raised "bindings not generated" (misleading).flipper_storage.py list /ext --jsonprobe errored out.PR 2 (reader-thread dispatcher) depends on a working proto import chain, so this lands first.
Test plan
rm -rf scripts/protobuf .venvthenpython scripts/bootstrap.pyexits 0 with no warnings.flipper_storage.py list /ext --json(after subcommand) works.flipper_storage.py --json list /ext(before subcommand) works.python -c "import bootstrap; bootstrap.reexec_in_venv()"returns cleanly instead of crashing.*_pb2moduleflipper_core.pyimports actually loads./connect-flipperskill probes the device and reports firmware variant.🤖 Generated with Claude Code