fix: recognize RSI Launcher index bundles - #355
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Reviewer's GuideExtends RSI Launcher bundle detection to support the new index..js layout while preserving deterministic selection among legacy main bundles, and aligns the Dart UI hash extraction logic and tests with the updated Rust ASAR scanning behavior. Sequence diagram for updated RSI Launcher bundle detection and hash extractionsequenceDiagram
actor User
participant RsiLauncherEnhanceDialogUI
participant asar_api
participant select_rsi_launcher_main_js_path
participant extractRsiLauncherBundleHash
User->>RsiLauncherEnhanceDialogUI: open dialog
RsiLauncherEnhanceDialogUI->>asar_api: getRsiLauncherAsarData(asarPath)
asar_api->>asar_api: AsarReader::new
asar_api->>asar_api: collect file paths
asar_api->>select_rsi_launcher_main_js_path: select_rsi_launcher_main_js_path(paths)
select_rsi_launcher_main_js_path-->>asar_api: main_js_path
asar_api->>asar_api: read main_js_content
asar_api-->>RsiLauncherEnhanceDialogUI: RsiLauncherAsarData
RsiLauncherEnhanceDialogUI->>extractRsiLauncherBundleHash: extractRsiLauncherBundleHash(mainJsPath)
extractRsiLauncherBundleHash-->>RsiLauncherEnhanceDialogUI: bundleHash
RsiLauncherEnhanceDialogUI->>RsiLauncherEnhanceDialogUI: _readScriptState(mainJsString)
RsiLauncherEnhanceDialogUI-->>User: show enhanced launcher state
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
get_rsi_launcher_asar_data/select_rsi_launcher_main_js_path, you currently collect all file paths into aVec<String>and then iterate a second time to find the content; consider selecting the target path and its data in a single pass overasar.files()to avoid extra allocation and traversal. - In
extractRsiLauncherBundleHash, the regular expression is created on every call; it may be worth lifting this into astatic finalRegExpso the compiled pattern can be reused instead of reallocated each time.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `get_rsi_launcher_asar_data`/`select_rsi_launcher_main_js_path`, you currently collect all file paths into a `Vec<String>` and then iterate a second time to find the content; consider selecting the target path and its data in a single pass over `asar.files()` to avoid extra allocation and traversal.
- In `extractRsiLauncherBundleHash`, the regular expression is created on every call; it may be worth lifting this into a `static final` `RegExp` so the compiled pattern can be reused instead of reallocated each time.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9627025227
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| normalized_path.starts_with(prefix) | ||
| && normalized_path.ends_with(RSI_LAUNCHER_MAIN_JS_SUFFIX) |
There was a problem hiding this comment.
Reject non-hash bundle names during Rust selection
When an ASAR contains a same-directory file such as app/launcher/static/js/index.not-a-hash.js alongside a valid historical main.<hash>.js, this prefix/suffix-only check accepts the invalid index file and gives it higher priority. The Dart extractRsiLauncherBundleHash helper then rejects that selected path, causing _readState to abort even though a usable bundle exists. Validate the segment between the prefix and .js with the same lowercase-hex rule used by Dart before assigning priority.
Useful? React with 👍 / 👎.
Summary
app/launcher/static/js/index.<hash>.jslayout in the Rust ASAR patch pathmainbundle layoutsValidation
cargo test api::asar_api --lib(3 passed, 0 ignored)cargo fmt --checkcargo clippy --lib -- -D warningsflutter test test/rsi_launcher_bundle_test.dart(2 passed)Closes #354
Summary by Sourcery
Recognize current RSI Launcher index bundle layout while preserving compatibility with historical main bundle structures and aligning hash extraction across Rust and Dart.
Bug Fixes:
Enhancements:
Tests: