fix(wsl-mover): keep the retained mark out of the WSL move manifest (D1b-8)

This commit is contained in:
Neil
2026-10-20 23:31:57 -07:00
parent 3b00ec67a8
commit b9722fe82b
2 changed files with 17 additions and 2 deletions
@@ -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 = {
@@ -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)