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
+3 -1
View File
@@ -303,8 +303,10 @@ def save_config(project_dir: str, project_name: str, rooms: list):
def detect_rooms_local(project_dir: str, yes: bool = False):
"""Main entry point for local setup."""
from .config import normalize_wing_name
project_path = Path(project_dir).expanduser().resolve()
project_name = project_path.name.lower().replace(" ", "_").replace("-", "_")
project_name = normalize_wing_name(project_path.name)
if not project_path.exists():
print(f"ERROR: Directory not found: {project_dir}")