fix(remote): disable the new-session button on remote project groups - #223
Merged
Merged
Conversation
The "+" button in a project-group header was created unconditionally, including for a remote-mirrored project (project.remoteAlias set). Its click handler reached showNewSessionPopover -> launchNewSession -> the open-terminal IPC with isNew and the remote host's projectPath, which this machine does not have on disk. The generic fs.existsSync guard in main.js caught it with a misleading "project directory no longer exists" message for a path that was never local. Disable the button rather than hide it: sessions under a missing project already use this project's convention of an explanatory title instead of removing the control, so the "+" button follows the same idiom, with a title naming the mirrored host. The click handler is also guarded directly so a disabled button never reaches showNewSessionPopover even if invoked programmatically. Refs #214
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #214.
Clicking an existing remote session was already guarded — it routes to the
read-only transcript viewer, and the main process refuses a resume whose cached
folder is remote. The
+button in the project-group header was not: it wascreated for every group with no test on
project.remoteAlias, and its handlerreached
open-terminalwithisNewset and the host's path as cwd. The remoteguard in
main.jsonly runs whenisNewis false, so it never fired there.What stopped it was the generic
fs.existsSync(spawnCwd)check, which failedwith "project directory no longer exists: /srv/…" — a misleading message for a
path that was never on this machine.
The button is now disabled for a mirrored project, with a title naming the host,
and the click handler is guarded independently so a programmatic invocation
cannot reach the popover either. Disabled rather than hidden: sessions under a
missing project already use an explanatory title instead of removing the
control, and keeping the button avoids a shifting header layout.
Verification
Three tests added, in the style of the existing remote-session sidebar test.
Mutation, with the change proven applied before running: the source was copied
and md5-verified, both call sites were reverted to unconditional, the mutated
lines were printed, and the suite was run — two of the three new tests went red
(
disabledfalse, and the popover called with the remote path). The third, on alocal project, stayed green as it should. The file was then restored from the
byte-exact copy, md5 confirmed identical, and everything went green again.
task check: 1097 tests, 1089 passed, 0 failed, 8 pre-existing skips. Lint 0errors; the 272 warnings are pre-existing and unchanged by this diff.