CANP-WP-0003: name the default registry default

Section 20.1 takes a registry's name from its directory basename, so the
reference tool's default store at ~/.canned-prompts/registry was named
`registry` — giving `registry:practice/thing` as a qualified reference.

The workplan had recorded this as reading poorly in one output line. It was
understated: the name reaches qualified references, the on-disk catalog layout
(catalog/registry/...), and index.yaml rows (registry: registry). Once packages
are installed and inclusions recorded, changing it becomes a migration rather
than an edit.

Renaming the directory to ~/.canned-prompts/default fixes it with no special
case in code, nothing written into the user's store, and no second naming
mechanism competing with section 20.1's manifest.

check_legacy_registry refuses to silently create a fresh empty store beside a
populated ~/.canned-prompts/registry — that failure would have been worse than
the wart being fixed. It names the exact mv, and the --registry flag for
keeping the old store. The check fires only for the default path; an explicit
--registry is never second-guessed.

Tests 95 -> 99.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bjefh8NUiEiahN4JLwoSKM

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 388925@bnt-lap001
Assistant-Session: 3507023f-e0fd-4a1e-9d90-a0d4217d1502
This commit is contained in:
tegwick 2026-09-06 19:32:30 +02:00
parent 03826eac4f
commit e1889b41a1
5 changed files with 87 additions and 7 deletions

View file

@ -914,3 +914,31 @@ def test_empty_inclusion_is_not_flagged() -> None:
origins={"a": "included from x/empty", "b": "included from x/b"},
)
assert cp.duplicate_inclusions(resolution) == []
# --- default registry naming (CANP-WP-0003) ---
def test_default_registry_is_named_default(tmp_path: Path, monkeypatch) -> None:
monkeypatch.setenv("CANNED_PROMPTS_HOME", str(tmp_path))
assert cp.default_registry().name == "default"
def test_legacy_registry_is_reported_not_ignored(tmp_path: Path, monkeypatch) -> None:
"""A fresh empty store beside a populated one would be worse than the wart."""
monkeypatch.setenv("CANNED_PROMPTS_HOME", str(tmp_path))
(tmp_path / "registry").mkdir()
with pytest.raises(cp.CannedPromptError, match="default registry moved"):
cp.check_legacy_registry(cp.default_registry())
def test_no_complaint_once_migrated(tmp_path: Path, monkeypatch) -> None:
monkeypatch.setenv("CANNED_PROMPTS_HOME", str(tmp_path))
(tmp_path / "default").mkdir()
(tmp_path / "registry").mkdir()
cp.check_legacy_registry(cp.default_registry())
def test_explicit_registry_path_is_never_second_guessed(tmp_path: Path, monkeypatch) -> None:
monkeypatch.setenv("CANNED_PROMPTS_HOME", str(tmp_path))
(tmp_path / "registry").mkdir()
cp.check_legacy_registry(tmp_path / "somewhere-else")