fix(graph): normalize wing slug at init so topic tunnels fire for hyphenated dirs (#1194)

`init` was recording `topics_by_wing[<raw-dirname>]` while `mempalace.yaml`
got the lower-cased separator-collapsed slug. At mine time the miner
read the slug from the yaml and missed the registry key, so
`_compute_topic_tunnels_for_wing` returned 0 silently for every project
whose folder contained a `-` or a space — the most common shape in the
wild.

Extracted the rule into `config.normalize_wing_name()` and routed both
`cli.cmd_init` (registry write) and `room_detector_local.detect_rooms_local`
(yaml write) through it. Added a regression test in `test_cli.py`
asserting the registry call uses the normalized slug, plus four direct
unit tests for the helper.

Refs #1180.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
bensig
2026-04-25 02:47:15 -07:00
committed by igorls
parent bc5d3fa911
commit b7f0a8af01
6 changed files with 72 additions and 7 deletions
+20 -1
View File
@@ -3,7 +3,7 @@ import json
import tempfile
import pytest
from mempalace.config import MempalaceConfig, sanitize_kg_value, sanitize_name
from mempalace.config import MempalaceConfig, normalize_wing_name, sanitize_kg_value, sanitize_name
def test_default_config():
@@ -110,6 +110,25 @@ def test_init():
assert os.path.exists(os.path.join(tmpdir, "config.json"))
# --- normalize_wing_name ---
def test_normalize_wing_name_hyphen():
assert normalize_wing_name("mempal-private") == "mempal_private"
def test_normalize_wing_name_space():
assert normalize_wing_name("My Project") == "my_project"
def test_normalize_wing_name_already_clean():
assert normalize_wing_name("memorymark") == "memorymark"
def test_normalize_wing_name_mixed():
assert normalize_wing_name("My-Cool App") == "my_cool_app"
# --- sanitize_name ---