fix(workspace): harden omo migration review issues

This commit is contained in:
YeonGyu-Kim
2026-05-16 18:02:54 +09:00
parent 82ec099c3a
commit 240a4a17ad
7 changed files with 91 additions and 10 deletions
+18 -1
View File
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test"
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs"
import { existsSync, mkdirSync, readFileSync, rmSync, symlinkSync, writeFileSync } from "node:fs"
import { tmpdir } from "node:os"
import { join } from "node:path"
import { migrateLegacyWorkspaceDirectory } from "./legacy-workspace-migration"
@@ -72,6 +72,23 @@ describe("migrateLegacyWorkspaceDirectory", () => {
expect(readFileSync(targetNotepadPath, "utf-8")).toBe("existing note")
})
test("#given legacy workspace contains symlinks #when migrating #then skips symlinks without copying target contents", () => {
// given
const externalFilePath = join(testDirectory, "external-secret.md")
const legacyLinkPath = join(testDirectory, ".sisyphus", "plans", "linked.md")
mkdirSync(join(testDirectory, ".sisyphus", "plans"), { recursive: true })
writeFileSync(externalFilePath, "secret", "utf-8")
symlinkSync(externalFilePath, legacyLinkPath)
// when
const result = migrateLegacyWorkspaceDirectory(testDirectory)
// then
expect(result.migrated).toBe(false)
expect(result.skipped).toContain(join(".omo", "plans", "linked.md"))
expect(existsSync(join(testDirectory, ".omo", "plans", "linked.md"))).toBe(false)
})
test("#given no legacy workspace #when migrating #then reports no migration", () => {
// when
const result = migrateLegacyWorkspaceDirectory(testDirectory)