Repository navigation
Move saved sessions between cmux installs: restore-session --from / --export #14861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
379cd8f
test: newer-schema session snapshot is destroyed by the next save
teamleaderleo 497ed7d
fix: keep newer-schema session snapshots; add snapshot import/export …
teamleaderleo 900e6f4
feat: move saved sessions between cmux installs with restore-session …
teamleaderleo 611ea21
fix: address review of session import/export
teamleaderleo 32c70b2
fix: don't auto-run resume commands from imported session files
teamleaderleo bed6dda
fix: harden untrusted session file imports
teamleaderleo 8f0dc80
fix: make SessionSnapshotFileLocation an instantiable value
teamleaderleo f71ec94
Fix session snapshot transfer edge cases
teamleaderleo 4eb25e6
test(session): preserve newer backup before cache replacement
teamleaderleo 3479700
fix(session): preserve newer backup before cache sync
teamleaderleo 2057d16
test(cli): clean transfer harness on setup failure
teamleaderleo 0f07b85
Merge main into feat/restore-session-from-channel
teamleaderleo d9d478a
Merge remote-tracking branch 'upstream/main' into feat/restore-sessio…
teamleaderleo e762e8f
Keep main's string catalog order when merging the session transfer st…
teamleaderleo efc7f1e
restore-session transfer: harden import reads, backup sync, and CLI p…
teamleaderleo 029d12c
Use a computed static for the import size cap in the generic repository
teamleaderleo de65cfd
Check snapshot file type and size on the descriptor that is read
teamleaderleo 0484ead
README: show --force for replacing an existing session export
teamleaderleo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
47 changes: 47 additions & 0 deletions
47
...ocket/Sources/CmuxControlSocket/Coordinator/System/ControlSessionTransferResolution.swift
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /// Where `session.import` reads a snapshot from. | ||
| public enum ControlSessionImportSource: Sendable, Equatable { | ||
| /// Another install's saved session, named by channel (`stable`, | ||
| /// `nightly`, `rc`, `staging`, `debug[:tag]`) or bundle identifier. | ||
| case channel(String) | ||
| /// A snapshot file at an absolute path. | ||
| case file(path: String) | ||
|
|
||
| /// Whether the snapshot restores with full trust (automatic resume). Only | ||
| /// another install's own session file does; an arbitrary file does not. | ||
| public var isTrusted: Bool { | ||
| if case .channel = self { return true } | ||
| return false | ||
| } | ||
| } | ||
|
|
||
| /// The outcome of `session.import`. | ||
| /// | ||
| /// Failure messages are resolved in the APP conformance so they stay | ||
| /// localized; the package only carries the resolved strings. | ||
| public enum ControlSessionImportResolution: Sendable, Equatable { | ||
| /// The snapshot was validated and reopened as additional windows. | ||
| /// `heldBackResumeCount` counts terminals whose resume command was kept | ||
| /// for manual restore instead of running automatically (file imports | ||
| /// only); `droppedRemoteWorkspaceCount` counts workspaces whose SSH/cloud | ||
| /// connection or environment from the file was dropped. | ||
| case restored( | ||
| sourcePath: String, | ||
| windowCount: Int, | ||
| heldBackResumeCount: Int, | ||
| droppedRemoteWorkspaceCount: Int | ||
| ) | ||
| /// The import failed. `code` is the socket error code (`not_found`, | ||
| /// `invalid_params`, `unsupported`, `invalid_state`, `unavailable`), | ||
| /// `path` the file involved when known. | ||
| case failed(code: String, message: String, path: String?) | ||
| } | ||
|
|
||
| /// The outcome of `session.export`. | ||
| public enum ControlSessionExportResolution: Sendable, Equatable { | ||
| /// The saved snapshot at `sourcePath` was written to `path`. | ||
| case exported(path: String, sourcePath: String) | ||
| /// The export failed. `code` is the socket error code (`not_found`, | ||
| /// `already_exists`, `invalid_params`, `invalid_state`, `unavailable`), | ||
| /// `path` the file involved when known. | ||
| case failed(code: String, message: String, path: String?) | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.