v0.15.4: ARCH-1 step 4 — extract MountManager (final ARCH-1 step)#47
Conversation
Fourth and final ARCH-1 collaborator extraction. No user-visible
changes.
- New src/MountManager.cs owns:
* BuildMountArgs(profile, fullCache, rcCommonFlags, bandwidth)
pure helper that assembles the full rclone mount argv with
all the v0.5.x cache-mode/VFS/network-mode/RC/log/bandwidth
flags. Unit-testable without disk.
* StartMountProcess(rclonePath, args, logJobWarn) Process.Start
+ v0.11.4 Job Object binding.
- TrayContext.Mount.cs delegates argv assembly and the spawn. The
dialog flow (rclone-missing, WinFsp-missing, remote-not-
configured, drive-in-use, post-launch result) stays in
TrayContext because it's UI-coupled.
53/53 tests green, FileVersion 0.15.4.0.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the rclone mount process lifecycle by extracting the argument assembly and process spawning logic from Pixelpipe.Mount.cs into a new MountManager class. Feedback is provided to handle potential issues in MountManager.cs, specifically by conditionally appending the --log-file argument to prevent startup failures when the log file path is empty, and adding a null check on the spawned process to avoid a potential NullReferenceException.
| + " --volname " + TrayContext.QuoteArg(p.Label) | ||
| + " --rc " + (rcCommonFlags ?? "") | ||
| + " --log-level INFO" | ||
| + " --log-file " + TrayContext.QuoteArg(p.LogFile); |
There was a problem hiding this comment.
If p.LogFile is null or empty, passing --log-file "" to rclone can cause it to fail to start on Windows due to an invalid path. It is safer to conditionally append the --log-file argument only when a valid log file path is provided.
+ (!String.IsNullOrEmpty(p.LogFile) ? " --log-file " + TrayContext.QuoteArg(p.LogFile) : "");| Process child = Process.Start(psi); | ||
| RcloneJob.TryAssign(child, logJobWarn); |
There was a problem hiding this comment.
Defensive programming: Process.Start can theoretically return null (e.g., if an existing process is reused, though less likely with UseShellExecute = false). To prevent a potential NullReferenceException in RcloneJob.TryAssign, we should add a null check for child before assigning it.
Process child = Process.Start(psi);
if (child != null)
{
RcloneJob.TryAssign(child, logJobWarn);
}
Summary
Fourth and final ARCH-1 collaborator. No user-visible changes. Rebased onto main after v0.15.3 (#46) merged (supersedes #45, which was stacked on the pre-squash branch). Closes the audit's incremental ARCH-1 work.
ARCH-1 close-out
Test plan
🤖 Generated with Claude Code