Skip to content

made unpack files more aggressive#1300

Merged
utkarshdalal merged 1 commit intomasterfrom
unpack-more
Apr 26, 2026
Merged

made unpack files more aggressive#1300
utkarshdalal merged 1 commit intomasterfrom
unpack-more

Conversation

@utkarshdalal
Copy link
Copy Markdown
Owner

@utkarshdalal utkarshdalal commented Apr 26, 2026

Description

Unpack more files to reduce application load errors

Recording

Type of Change

  • Bug fix
  • Performance / stability improvement
  • Compatibility improvements
  • Other (requires prior approval)

Checklist

  • If I have access to #code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.
  • This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
  • I have attached a recording of the change.
  • I have read and agree to the contribution guidelines in CONTRIBUTING.md.

Summary by cubic

Tightened isSystemExecutable detection so we unpack more files and avoid app load errors. Replaced broad substring checks with targeted prefix and token matching for known installer/redistributable/crash-report binaries.

  • Bug Fixes
    • Added strong prefix checks on base names: unins, uninstall, setup, install, redist, vcredist, vc_redist, dxsetup, directx, crashhandler, crashreporter.
    • Switched to tokenized matching against a small denylist to reduce false positives (removed broad terms like viewer, tool, compiler, and store clients).

Written for commit a780a5a. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced system and utility executable identification for more accurate classification.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 26, 2026

📝 Walkthrough

Walkthrough

A private utility function isSystemExecutable in ContainerUtils.kt was refactored to improve system executable detection. It now removes trailing .exe, uses prefix-based matching via a list, and employs token-based detection against a normalized denylist, replacing prior substring-matching logic.

Changes

Cohort / File(s) Summary
System Executable Detection Logic
app/src/main/java/app/gamenative/utils/ContainerUtils.kt
Enhanced isSystemExecutable classifier with .exe trimming, prefix-based detection via strongPrefixes list, and token-based denylist matching on normalized tokens, replacing prior substring-matching approach.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A classifier hops with newfound grace,
Trimming .exe files from their trace,
With prefixes strong and tokens to scan,
System executables? Yes we can! 🎯
Logic flows better, detection is keen!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete and lacks sufficient detail about the changes. While it identifies the change as a bug fix and mentions unpacking more files, it provides minimal context about why this reduces load errors or how the implementation works. Expand the description to explain the root cause of the load errors, detail the specific changes made to the isSystemExecutable classifier, and justify why the new prefix-based and token-based detection approach is more appropriate. Attach a recording demonstrating the improvement.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'made unpack files more aggressive' directly describes the main change—tightening executable detection to unpack more files and reduce load errors.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch unpack-more

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
app/src/main/java/app/gamenative/utils/ContainerUtils.kt (1)

1266-1300: Optional: lowercase defensively and consider a comment on the dual-check intent.

The function silently assumes its input is already lowercased (both current callers — filterExesForUnpacking at line 1231 and getExecutablePriority at line 1239 — do so). A future caller that forgets would yield silent false negatives (e.g., Setup.exe would not match "setup"). A one-line .lowercase() makes the contract self-enforcing. Also, the prefix-list and token-set deliberately overlap (the prefix path catches concatenated-without-separator names like vcredistsetup that the tokenizer treats as a single token, while the token path catches infix matches like game_setup); a brief comment would prevent well-meaning future deduplication.

♻️ Proposed refactor
 private fun isSystemExecutable(fileName: String): Boolean {
-    val baseName = fileName.removeSuffix(".exe")
+    val baseName = fileName.lowercase().removeSuffix(".exe")
+    // Two-pass detection:
+    //  1) prefix check catches concatenated names the tokenizer can't split (e.g. "vcredistsetup")
+    //  2) token check catches denylist words appearing as a separated token (e.g. "game_setup")
     val strongPrefixes = listOf(
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt` around lines 1266 -
1300, isSystemExecutable currently assumes fileName is already lowercase which
can cause false negatives; update the function (isSystemExecutable) to
defensively lowercase the input (e.g., operate on val baseName =
fileName.lowercase().removeSuffix(".exe")) and add a short comment above the
strongPrefixes/denylist logic explaining the dual-check intent (prefixes catch
concatenated names like "vcredistsetup" while tokenization catches
infix/underscore-separated names like "game_setup") so future maintainers don’t
remove one of the checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@app/src/main/java/app/gamenative/utils/ContainerUtils.kt`:
- Around line 1266-1300: isSystemExecutable currently assumes fileName is
already lowercase which can cause false negatives; update the function
(isSystemExecutable) to defensively lowercase the input (e.g., operate on val
baseName = fileName.lowercase().removeSuffix(".exe")) and add a short comment
above the strongPrefixes/denylist logic explaining the dual-check intent
(prefixes catch concatenated names like "vcredistsetup" while tokenization
catches infix/underscore-separated names like "game_setup") so future
maintainers don’t remove one of the checks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f54006d8-988f-4a0e-ba57-8abc5c7d13a1

📥 Commits

Reviewing files that changed from the base of the PR and between aada2bf and a780a5a.

📒 Files selected for processing (1)
  • app/src/main/java/app/gamenative/utils/ContainerUtils.kt

@utkarshdalal utkarshdalal merged commit 833da30 into master Apr 26, 2026
3 checks passed
@utkarshdalal utkarshdalal deleted the unpack-more branch April 26, 2026 17:56
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="app/src/main/java/app/gamenative/utils/ContainerUtils.kt">

<violation number="1" location="app/src/main/java/app/gamenative/utils/ContainerUtils.kt:1290">
P2: `install` is missing from the token denylist, so installer executables like `game-install.exe` can slip through as runnable targets.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

"unins",
"uninstall",
"setup",
"installer",
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: install is missing from the token denylist, so installer executables like game-install.exe can slip through as runnable targets.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At app/src/main/java/app/gamenative/utils/ContainerUtils.kt, line 1290:

<comment>`install` is missing from the token denylist, so installer executables like `game-install.exe` can slip through as runnable targets.</comment>

<file context>
@@ -1264,12 +1264,38 @@ object ContainerUtils {
+            "unins",
+            "uninstall",
+            "setup",
+            "installer",
+            "redist",
+            "vcredist",
</file context>
Suggested change
"installer",
"install",
"installer",
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant