Skip to content

fix: dxwrappers and graphic drivers downloader handling on custom content files#1577

Merged
utkarshdalal merged 1 commit into
utkarshdalal:masterfrom
joshuatam:fix/split-build-downloader-handling
Jun 12, 2026
Merged

fix: dxwrappers and graphic drivers downloader handling on custom content files#1577
utkarshdalal merged 1 commit into
utkarshdalal:masterfrom
joshuatam:fix/split-build-downloader-handling

Conversation

@joshuatam

@joshuatam joshuatam commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

fix: dxwrappers and graphic drivers downloader handling on custom content files

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

Fixes downloader handling for DX wrappers and graphics drivers when using custom-named content files. Uses manifest-provided file names and returns null for unknown components to avoid crashes and improve cache reuse.

  • Bug Fixes

    • DXWrapperDownloader: use component.name from the manifest for cache paths and remote fetch (dxwrapper/${component.name}).
    • DXWrapperDownloader and GraphicsDriverDownloader: return null when a component is missing from the manifest (no exception).
  • Migration

    • Update call sites to handle a null return from ensureDXWrapperAvailable and ensureGraphicsDriverAvailable.

Written for commit 5293ced. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling for missing graphics driver and DX wrapper components. The app now responds gracefully instead of throwing errors when components are unavailable.

@joshuatam joshuatam requested a review from utkarshdalal as a code owner June 12, 2026 08:52
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Both downloader utilities now gracefully handle missing manifest components by returning null instead of throwing exceptions. DXWrapperDownloader additionally updates cache destination and server download paths to use the manifest component's name instead of the componentId with a .tzst suffix. Corresponding test cases validate these new behaviors.

Changes

Downloader error handling and filename normalization

Layer / File(s) Summary
DXWrapperDownloader missing component and filename changes
app/src/main/java/app/gamenative/utils/downloader/DXWrapperDownloader.kt
ensureDXWrapperAvailable returns null when componentId is missing from manifest. Cache destination and server download fileName are switched from componentId-based *.tzst naming to component.name-based naming.
GraphicsDriverDownloader missing component handling
app/src/main/java/app/gamenative/utils/downloader/GraphicsDriverDownloader.kt
ensureGraphicsDriverAvailable returns null from withContext when componentId is not found in manifest, replacing prior exception-throwing behavior.
DXWrapperDownloader test updates
app/src/test/java/app/gamenative/utils/downloader/DXWrapperDownloaderTest.kt
testCachedComponentReuse loads manifest to resolve component.name for mock cached file creation. testInvalidComponent test asserts null return instead of thrown exception.
GraphicsDriverDownloader test updates
app/src/test/java/app/gamenative/utils/downloader/GraphicsDriverDownloaderTest.kt
testCachedComponentReuse loads graphics driver manifest to derive component.name for mock cached filename. testInvalidComponentThrowsException replaced with testInvalidComponentReturnsNull.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • utkarshdalal/GameNative#1512: Introduces the modern downloader and manifest-based distribution system for DXWrapper and graphics drivers; this PR aligns the downloader behavior (null returns for missing components and component.name-based filenames) with that infrastructure.

Suggested reviewers

  • utkarshdalal

Poem

A downloader hops through the manifest with grace,
Trading componentId for names from the file space,
When components are missing, no exceptions in sight,
Just null returns soft in the Kotlin daylight,
Tests skip along, verifying all's right! 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing downloader handling for DX wrappers and graphics drivers when using custom-named content files.
Description check ✅ Passed The PR description includes most required sections: a clear summary of changes, bug fix category selected, and checklist items mostly completed. However, the recording/GIF attachment is missing.
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 unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
app/src/test/java/app/gamenative/utils/downloader/DXWrapperDownloaderTest.kt (1)

237-247: 💤 Low value

Consider using assertNull() for clarity.

While assertEquals(null, result) is functionally correct, assertNull(result) would be more idiomatic and slightly clearer.

✨ Proposed refactor
-    assertEquals(
-        "Invalid component should return null",
-        null,
-        result
-    )
+    assertNull("Invalid component should return null", result)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/src/test/java/app/gamenative/utils/downloader/DXWrapperDownloaderTest.kt`
around lines 237 - 247, Replace the assertion in testInvalidComponentReturnsNull
to use assertNull for clarity: locate the test method
testInvalidComponentReturnsNull that calls
DXWrapperDownloader.ensureDXWrapperAvailable and change the assertEquals null
check to use assertNull(result) (or assertNull("Invalid component should return
null", result) if you want to keep the message) so the intent is more idiomatic
and readable.
app/src/test/java/app/gamenative/utils/downloader/GraphicsDriverDownloaderTest.kt (1)

254-262: 💤 Low value

Consider using assertNotNull instead of !! for better test clarity.

Line 258 uses the non-null assertion operator !! on the manifest lookup. If "vortek-2.1" is ever removed from the manifest, this will throw an NPE instead of a clear assertion failure.

♻️ Proposed improvement for test robustness
 // Load manifest to get component name
 val manifestJson = context.assets.open(GraphicsDriverDownloader.GRAPHICS_DRIVER_MANIFEST_FILE).bufferedReader().use { it.readText() }
 val manifest = Json { ignoreUnknownKeys = true }
     .decodeFromString<GraphicsDriverDownloader.GraphicsDriverManifest>(manifestJson)
-val component = manifest.components.find { it.id == componentId }!!
+val component = manifest.components.find { it.id == componentId }
+assertNotNull("Component $componentId should exist in manifest", component)

 // Create a mock cached file
 cacheDir.mkdirs()
-val cachedFile = File(cacheDir, component.name)
+val cachedFile = File(cacheDir, component!!.name)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@app/src/test/java/app/gamenative/utils/downloader/GraphicsDriverDownloaderTest.kt`
around lines 254 - 262, The test uses a non-null assertion (!!) when finding the
component from the manifest which will throw an NPE instead of a clear test
failure; change the lookup to use an assertion like
assertNotNull(manifest.components.find { it.id == componentId }) (or assign to a
nullable val and call fail with a descriptive message if null) and then use that
asserted value for the cached file creation so the test reports a clear
assertion failure instead of an NPE; update the code around
GraphicsDriverDownloader.GRAPHICS_DRIVER_MANIFEST_FILE /
GraphicsDriverDownloader.GraphicsDriverManifest and the componentId lookup
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@app/src/test/java/app/gamenative/utils/downloader/DXWrapperDownloaderTest.kt`:
- Around line 237-247: Replace the assertion in testInvalidComponentReturnsNull
to use assertNull for clarity: locate the test method
testInvalidComponentReturnsNull that calls
DXWrapperDownloader.ensureDXWrapperAvailable and change the assertEquals null
check to use assertNull(result) (or assertNull("Invalid component should return
null", result) if you want to keep the message) so the intent is more idiomatic
and readable.

In
`@app/src/test/java/app/gamenative/utils/downloader/GraphicsDriverDownloaderTest.kt`:
- Around line 254-262: The test uses a non-null assertion (!!) when finding the
component from the manifest which will throw an NPE instead of a clear test
failure; change the lookup to use an assertion like
assertNotNull(manifest.components.find { it.id == componentId }) (or assign to a
nullable val and call fail with a descriptive message if null) and then use that
asserted value for the cached file creation so the test reports a clear
assertion failure instead of an NPE; update the code around
GraphicsDriverDownloader.GRAPHICS_DRIVER_MANIFEST_FILE /
GraphicsDriverDownloader.GraphicsDriverManifest and the componentId lookup
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62c9e8bd-db08-42d9-912a-f233c1e56129

📥 Commits

Reviewing files that changed from the base of the PR and between bd2c180 and 5293ced.

📒 Files selected for processing (4)
  • app/src/main/java/app/gamenative/utils/downloader/DXWrapperDownloader.kt
  • app/src/main/java/app/gamenative/utils/downloader/GraphicsDriverDownloader.kt
  • app/src/test/java/app/gamenative/utils/downloader/DXWrapperDownloaderTest.kt
  • app/src/test/java/app/gamenative/utils/downloader/GraphicsDriverDownloaderTest.kt

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 4 files

Re-trigger cubic

@phobos665 phobos665 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@utkarshdalal utkarshdalal merged commit 543d581 into utkarshdalal:master Jun 12, 2026
3 checks passed
@joshuatam joshuatam deleted the fix/split-build-downloader-handling branch June 12, 2026 16:08
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.

3 participants