docs(memory): 十一键措辞收口(seed* + snapshot*)
tempTtlSec 落地后,`memory-tidy.json` 的播种契约就是**十一键**,而三处文件的注释仍 写「十键」。这些是**过时的陈述**(不是风格问题):下一位读者会从「快照契约:十键非 nil」里读出一个错误的口径,而 `memoryTidySeedComplete` 实际校验的正是十一键。 改的只是措辞,一行逻辑没动: - internal/config/runtimeconfig/memorytidy_seed.go:25,160 - internal/config/runtimeconfig/memorytidy_seed_test.go:19,27,62,82,97,214 - internal/runtime/memory/tidy_snapshot_test.go:14,27,159 (`cmd/cyrene/wire_memory_tidy.go:65` 还有同类的一处「这十键」,该文件属 M3 的 scope,未动 —— 塔已转 M3。) 验收:go build ./... + go vet ./... + go test -count=1 ./... 全绿。
This commit is contained in:
1 parent
979d1cfbb2
commit
5daba92d0f
3 files changed
+10
-10
No files matched your search
@@ -16,7 +16,7 @@ import (
|
||||
// 本文件锁定**启动播种**(memorytidy_seed.go;主人 2026-10-07:「**`.env` 只做兜底
|
||||
// 用** …… 后端**自动创建**独立的面板配置文件」)的四条纪律:
|
||||
//
|
||||
// ① 文件不存在 ⇒ 按调用方给的「当前生效值」播种(**十键齐全**,不是只播老六键);
|
||||
// ① 文件不存在 ⇒ 按调用方给的「当前生效值」播种(**十一键齐全**,不是只播老六键);
|
||||
// ② 文件已存在 ⇒ **一个字节都不动**(也不留 `.tmp`);
|
||||
// ③ 文件损坏 ⇒ **不写盘**(WARN + 按 `.env` 跑),绝不「修好它」;
|
||||
// ④ 幂等:连跑两次只在第一次写盘。
|
||||
@@ -59,7 +59,7 @@ func seedPath(t *testing.T) string {
|
||||
return filepath.Join(t.TempDir(), "config", memoryTidyFileName)
|
||||
}
|
||||
|
||||
// decodeSeed 把盘上的文件解成键集合,供「十键齐全」的断言(比结构体更贴近主人看到
|
||||
// decodeSeed 把盘上的文件解成键集合,供「十一键齐全」的断言(比结构体更贴近主人看到
|
||||
// 的那份文件)。
|
||||
func decodeSeed(t *testing.T, path string) map[string]json.RawMessage {
|
||||
t.Helper()
|
||||
@@ -79,7 +79,7 @@ func assertNoTempLeft(t *testing.T, path string) {
|
||||
}
|
||||
|
||||
// TestSeedMemoryTidy_SeedsMissingFile 是本任务的主用例:文件不存在 ⇒ 播种,且**内容
|
||||
// 就是调用方给的快照**(十键齐全、含四项频率键),目录也一并建出来。
|
||||
// 就是调用方给的快照**(十一键齐全、含四项频率键),目录也一并建出来。
|
||||
func TestSeedMemoryTidy_SeedsMissingFile(t *testing.T) {
|
||||
t.Parallel()
|
||||
path := seedPath(t) // 连 config/ 目录都不存在
|
||||
@@ -94,7 +94,7 @@ func TestSeedMemoryTidy_SeedsMissingFile(t *testing.T) {
|
||||
}
|
||||
assertNoTempLeft(t, path)
|
||||
|
||||
// 十键齐全(含新增的四项频率键)——「别只播老六键」的断言就在这里。
|
||||
// 十一键齐全(含新增的四项频率键)——「别只播老六键」的断言就在这里。
|
||||
keys := decodeSeed(t, path)
|
||||
for _, key := range memoryTidySeedKeys {
|
||||
if _, ok := keys[key]; !ok {
|
||||
@@ -211,7 +211,7 @@ func TestSeedMemoryTidy_SeedsBlankFile(t *testing.T) {
|
||||
t.Fatalf("结果 = %+v, want 按「还没配过」播种", res)
|
||||
}
|
||||
if len(decodeSeed(t, path)) != len(memoryTidySeedKeys) {
|
||||
t.Fatalf("空白文件被播种后应当十键齐全:%s", readRaw(t, path))
|
||||
t.Fatalf("空白文件被播种后应当十一键齐全:%s", readRaw(t, path))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user