закрыты известные остатки

- документ самоуправления объявляется ключом governance, а не угадывается
  по «он один и без ключей оси»: конвенция, потерявшая topic, была от него
  неотличима и тихо теряла все проверки об отъезде к потребителю
- проверка путей канона больше не ловит README.md и READING.md — эти два
  имени значат что-то и на стороне потребителя
- lang.Recognize требует совпадения и слов, и номера версии; директории
  компонентов сверяются на вложенность, а не только на равенство
- у обеих проверок появился --json, а convy sync называет ссылки на темы,
  которых компонент не взял
This commit is contained in:
av
2026-07-28 10:16:27 +03:00
parent 29d29740f5
commit 600aba5ee3
16 changed files with 413 additions and 70 deletions
+51 -3
View File
@@ -374,15 +374,28 @@ func TestChecks(t *testing.T) {
},
want: "is not lower kebab-case",
}, {
name: "a second document without a topic",
name: "a convention that lost its topic next to the governing document",
setup: func(f files) {
f[".conventions-suite.toml"] = strings.Replace(baseManifest,
`TIME = "conventions/time.md"`,
`TIME = "conventions/time.md"`+"\nMETA = \"GUIDE.md\"\nRULE = \"conventions/rules.md\"", 1)
f[".conventions-suite.toml"] = "governance = \"GUIDE.md\"\n" + f[".conventions-suite.toml"]
f["GUIDE.md"] = "---\nprefix: META\n---\n\n# Как мы ведём конвенции\n\n" + versionLine + "\n"
f["conventions/rules.md"] = "---\nprefix: RULE\n---\n\n# Правила\n\n" + versionLine + "\n"
},
want: "more than one document without a topic",
want: "has lost the key",
}, {
name: "a convention that lost its topic in a suite with no governing document",
setup: func(f files) {
f["conventions/time.md"] = strings.Replace(baseTime, "topic: time\n", "", 1)
},
want: "the manifest names no document the suite governs itself by",
}, {
name: "the governing document declared with a topic",
setup: func(f files) {
f[".conventions-suite.toml"] = "governance = \"conventions/time.md\"\n" + baseManifest
},
want: "belongs to no topic",
}, {
name: "the short account of the language lost a word of the vocabulary",
setup: func(f files) {
@@ -390,14 +403,21 @@ func TestChecks(t *testing.T) {
},
want: "does not name ДОПУСКАЕТСЯ",
}, {
name: "document without a topic carries layer keys",
name: "the governing document carries layer keys",
setup: func(f files) {
f[".conventions-suite.toml"] = strings.Replace(baseManifest,
`TIME = "conventions/time.md"`,
`TIME = "conventions/time.md"`+"\nGTIM = \"conventions/go.md\"", 1)
f[".conventions-suite.toml"] = "governance = \"conventions/go.md\"\n" + f[".conventions-suite.toml"]
f["conventions/go.md"] = "---\nprefix: GTIM\nlang: go\n---\n\n# Go\n\n" + versionLine + "\n"
},
want: "carries the keys of a layer",
}, {
name: "governance names a file that is not there",
setup: func(f files) {
f[".conventions-suite.toml"] = "governance = \"GUIDE.md\"\n" + baseManifest
},
want: "governance names",
}}
for _, tc := range cases {
@@ -411,3 +431,31 @@ func TestChecks(t *testing.T) {
})
}
}
// The two names that mean something on the consumer's side as well: a
// convention naming either is talking about the copy, not about the suite.
func TestCanonPathLeavesTheConsumersOwnNames(t *testing.T) {
f := base()
f["README.md"] = "# Канон\n"
f["conventions/time.md"] = strings.Replace(baseTime, "## Правила",
"Таблица тем собирается в README.md директории конвенций, а как читать\nправило — сказано в READING.md рядом с копиями.\n\n## Правила", 1)
for _, finding := range run(t, f) {
if strings.Contains(finding.Msg, "canon file path") {
t.Errorf("a name of the consumer's own was taken for a path of the suite: %s", finding.Msg)
}
}
// A path of a convention is still a path of a convention.
f["conventions/time.md"] = strings.Replace(baseTime, "## Правила",
"Подробности — в conventions/time.md.\n\n## Правила", 1)
found := false
for _, finding := range run(t, f) {
if strings.Contains(finding.Msg, "canon file path") {
found = true
}
}
if !found {
t.Errorf("a path of a convention went unnoticed:\n%s", messages(run(t, f)))
}
}