Skip to content

refactor: Moved migration to ensureImageFsSymlinks which is now called in main#1427

Open
unbelievableflavour wants to merge 1 commit into
utkarshdalal:masterfrom
unbelievableflavour:symlink-extraction
Open

refactor: Moved migration to ensureImageFsSymlinks which is now called in main#1427
unbelievableflavour wants to merge 1 commit into
utkarshdalal:masterfrom
unbelievableflavour:symlink-extraction

Conversation

@unbelievableflavour
Copy link
Copy Markdown
Contributor

@unbelievableflavour unbelievableflavour commented May 12, 2026

Description

Title says it all. This PR is simply to make the imagefs PR smaller again. Some final pre-work that can be merged before-hand.

Recording

Not necessary.

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

Centralized ImageFS legacy migration and symlink setup into ImageFsInstaller.ensureImageFsSymlinks, now called during app pre-launch for more reliable shared home and Proton links.

  • Refactors
    • Added ImageFsInstaller.ensureImageFsSymlinks(context, legacyRoot, container) to run migration, then ensure shared home and Proton (only for Container.BIONIC).
    • Made ImageFSLegacyMigrator.migrateLegacyDirsIfNeeded(context, legacyRoot) migration-only (removed wineVersion param and symlink responsibilities).
    • Switched PluviaMain.preLaunchApp to call ensureImageFsSymlinks; updated failure log message.
    • Updated installer flow to new migrator signature and expanded tests; added test for ensureImageFsSymlinks failure path.

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved ImageFS initialization to fail early if symlink setup encounters issues, ensuring consistent error handling during app startup.
  • Refactor

    • Restructured legacy directory migration logic and simplified symlink management for file system organization.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

📝 Walkthrough

Walkthrough

The PR refactors ImageFS legacy migration responsibility by simplifying the migrator API (removing wineVersion dependency and symlink setup), introducing a new symlink-setup method in ImageFsInstaller, and updating app initialization to use the new method. Tests are updated to match the new behavior.

Changes

ImageFS Migration Refactoring

Layer / File(s) Summary
Migrator API Simplification
app/src/main/java/com/winlator/xenvironment/ImageFSLegacyMigrator.java, app/src/test/java/com/winlator/xenvironment/ImageFSLegacyMigratorTest.kt
The migrator signature is updated to remove the wineVersion parameter and the method no longer performs symlink setup for shared home/proton. Tests are updated to remove the extra parameter and assert only filesystem outcomes (legacy dirs moved/removed, shared dirs created).
Installer Symlink Setup Method
app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java, app/src/test/java/com/winlator/xenvironment/ImageFsInstallerTest.kt
A new public method ensureImageFsSymlinks(Context, File, Container) is added to handle legacy migration and symlink setup. It ensures /home is symlinked to shared home and (for BIONIC) ensures Proton version symlinks under opt/. The installIfNeededFuture call to the migrator is updated to use the new signature. Test setup/teardown adds cleanup for symlink artifacts, and a new test verifies failure propagation when legacy migration fails.
App Initialization
app/src/main/java/app/gamenative/ui/PluviaMain.kt
The app initialization step switches from calling ImageFSLegacyMigrator.migrateLegacyDirsIfNeeded to calling ImageFsInstaller.ensureImageFsSymlinks, and treats symlink setup failure as an early launch error.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • utkarshdalal
  • phobos665

Poem

🐰 Hoppy refactoring day!
The migrator sheds its wineVersion load,
Symlinks move to Installer's trusty road,
App now calls the path both clean and clear—
Legacy migrations hop right here! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% 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 clearly describes the main refactoring change: moving legacy migration logic into a new ensureImageFsSymlinks method that is now called during app pre-launch.
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.
Description check ✅ Passed The PR description provides context and is mostly complete, though the personal note 'Title says it all' is vague and the recording checkbox is marked as complete despite stating 'Not necessary'.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@unbelievableflavour unbelievableflavour changed the title Moved migration to ensureImageFsSymlinks which is now called in main refactor: Moved migration to ensureImageFsSymlinks which is now called in main May 12, 2026
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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java`:
- Around line 519-531: ensureImageFsSymlinks currently ignores failures from
symlink setup; change ensureSharedHomeRoot(...) and
ensureProtonVersionSymlink(...) to return boolean indicating success and update
ensureImageFsSymlinks to check those return values (call
ensureSharedHomeRoot(context, legacyImageFsRoot) and if it returns false then
return false; if Container.BIONIC.equals(variant) then call
ensureProtonVersionSymlink(context, legacyImageFsRoot, wineVersion) and if it
returns false then return false) so any symlink creation failure propagates and
causes ensureImageFsSymlinks to return false.

In `@app/src/test/java/com/winlator/xenvironment/ImageFsInstallerTest.kt`:
- Around line 34-36: The teardown currently calls imageFsLink.delete() which
will fail if imageFsLink is a non-symlink directory with contents; update the
cleanup in ImageFsInstallerTest so that when
Files.isSymbolicLink(imageFsLink.toPath()) is false and imageFsLink.exists() is
true you perform a recursive delete of the directory contents (e.g., via
java.nio.file.Files.walkFileTree or a library helper like
org.apache.commons.io.FileUtils.deleteDirectory) instead of a single-file
delete, while leaving the symlink branch to just delete the link.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c254efa6-8b25-4993-9529-6a2609b45356

📥 Commits

Reviewing files that changed from the base of the PR and between a634c4a and dfdf8dc.

📒 Files selected for processing (5)
  • app/src/main/java/app/gamenative/ui/PluviaMain.kt
  • app/src/main/java/com/winlator/xenvironment/ImageFSLegacyMigrator.java
  • app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java
  • app/src/test/java/com/winlator/xenvironment/ImageFSLegacyMigratorTest.kt
  • app/src/test/java/com/winlator/xenvironment/ImageFsInstallerTest.kt

Comment thread app/src/main/java/com/winlator/xenvironment/ImageFsInstaller.java
Comment thread app/src/test/java/com/winlator/xenvironment/ImageFsInstallerTest.kt
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.

No issues found across 5 files

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