fix(chv-muse-r12fix-3): pull_memory_home 打包不再含顶层目录名(P7)
R12 真机:pull_memory_home 用 tar -czf - -C <父目录> <家目录名> 打包,解到镜像后文件落在 mirror/memory/MEMORY.md,而 MemoryFiles(mirror) 读的是 mirror/MEMORY.md——拉取与读取差 一层,host_pull_files=1 却报 memory file missing: MEMORY.md, state-DB 备份与 host forget 同因失败。改为 -C <家目录> . 只打 包内容,MEMORY.md 直接落在镜像根;两处钉住的测试同步改形状 (旧测试本身钉的就是多一层的错误形状)。
This commit is contained in:
1 parent
33ca6c75ed
commit
1da0d86159
2 files changed
+17
-7
No files matched your search
@@ -401,7 +401,7 @@ class PullMemoryHomeTest(unittest.TestCase):
|
||||
cmd = build_pull_command(
|
||||
["ssh", "-p", "2222", "chv@127.0.0.1"], "/home/chv/memory")
|
||||
self.assertEqual(cmd, ["ssh", "-p", "2222", "chv@127.0.0.1",
|
||||
"tar -czf - -C /home/chv memory"])
|
||||
"tar -czf - -C /home/chv/memory ."])
|
||||
|
||||
def test_pull_with_fake_ssh(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
@@ -415,14 +415,18 @@ class PullMemoryHomeTest(unittest.TestCase):
|
||||
fake_ssh = os.path.join(tmp, "fake-ssh")
|
||||
Path(fake_ssh).write_text(
|
||||
"#!/bin/sh\n"
|
||||
"tar -czf - -C %s memory\n" % remote_parent)
|
||||
"tar -czf - -C %s .\n" % remote_home)
|
||||
os.chmod(fake_ssh, 0o755)
|
||||
local = os.path.join(tmp, "local")
|
||||
result = pull_memory_home([fake_ssh], GUEST_MEMORY_HOME,
|
||||
local)
|
||||
self.assertEqual(result["files"], 2)
|
||||
# round-12 修复轮(项 3,P7):拉取不再多一层目录——
|
||||
# MEMORY.md 直接落在镜像根,MemoryFiles 读得到。
|
||||
self.assertEqual(Path(os.path.join(
|
||||
local, "MEMORY.md")).read_text(), "# 记忆\n")
|
||||
self.assertIn("冰美式", Path(os.path.join(
|
||||
local, "memory", "memory", "2026-11-07.md")).read_text())
|
||||
local, "memory", "2026-11-07.md")).read_text())
|
||||
|
||||
def test_pull_ssh_failure_raises(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
|
||||
Reference in new issue
Block a user