diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.test.ts b/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.test.ts index 819a91abd2d..3308a5f5c67 100644 --- a/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.test.ts +++ b/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.test.ts @@ -195,6 +195,19 @@ describe('exportWslMoveManifest', () => { expect(result.manifest.payload.repositories.map((row) => row.path)).toEqual(['/home/me/app']) }) + it("never signs this desktop's retained mark into the manifest", () => { + const state = sourceState() + const mark = { migrationId: 'move-0', environmentId: 'wsl:Ubuntu' } + state.repos = state.repos.map((row) => + row.id === 'app' ? { ...row, orcadRetained: mark } : row + ) + const store = storeFor(state) + const { manifest } = exportWslMoveManifest(store, REQUEST) + expect(manifest.payload.repositories.map((row) => row.orcadRetained)).toEqual([undefined]) + // The stored row keeps its mark. + expect(store.getRepos().find((row) => row.id === 'app')?.orcadRetained).toEqual(mark) + }) + it('refuses with a reason instead of dropping state the move cannot carry', () => { const state = sourceState() const record: SleepingAgentSessionRecord = { diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.ts b/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.ts index 2b0beec45e5..580b319fd15 100644 --- a/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.ts +++ b/src/main/persistence/moving-wsl-projects/wsl-move-manifest-export.ts @@ -18,6 +18,7 @@ import { ORCAD_MIGRATION_MANIFEST_VERSION, parseOrcadMigrationManifest } from '../../../shared/orcad-migration/orcad-migration-manifest-validation' +import { withoutOrcadRetainedMarker } from '../../../shared/orcad-retained-marker' import type { ProjectGroup } from '../../../shared/project-group-types' import type { Repo } from '../../../shared/repo-types' import { parseWorkspaceKey } from '../../../shared/workspace-scope' @@ -99,9 +100,10 @@ export function exportWslMoveManifest( ): WslMoveManifestExport { const blockers: string[] = [] const missing: string[] = [] + // The retained mark is this desktop's record; the host must never receive it. const repos = pickLocalRows(store.getRepos(), request.repoIds, isLocalRepo, (id) => missing.push(id) - ) + ).map(withoutOrcadRetainedMarker) const allGroups = store.getProjectGroups() const allFolders = store.getFolderWorkspaces() const folderWorkspaces = pickLocalRows( @@ -113,7 +115,7 @@ export function exportWslMoveManifest( workspace.id ).kind === 'local', (id) => missing.push(id) - ) + ).map(withoutOrcadRetainedMarker) // The signed scope must name exactly the rows it carries: a stale plan is replanned, not signed. if (missing.length > 0) { throw new WslMoveScopeChangedError(missing)