Skip to content

Topic tunnels silently skipped for wings with hyphenated dir names #1194

@bensig

Description

@bensig

Summary

After #1184 (cross-wing topic tunnels), tunnels are silently never created for projects whose directory name contains a hyphen or space. The miner's tunnel-computation step looks the wing up in topics_by_wing under the raw dirname (mempalace-public), but init records it under that raw name while writing mempalace.yaml with the normalized name (mempalace_public). At mine time the yaml wins, the lookup misses, and _compute_topic_tunnels_for_wing returns 0 with no warning.

Real-world common case: any project dir like my-app, mempalace-public, react-thing is affected. Single-token dirs (memorymark, desktop) work by coincidence.

Repro

Five sibling project dirs init+mine'd in order with --llm --llm-provider anthropic:

Wing dir yaml wing topics_by_wing key Stack overlap
mempalace-ts mempalace_ts mempalace-ts shares Angular, Bun with memorymark
desktop desktop desktop
memorymark memorymark memorymark shares Angular, Bun with mempalace-ts
mempalace-public mempalace_public mempalace-public shares 5 topics with mempal-private
mempal-private mempal_private mempal-private shares 5 topics with mempalace-public

Expected tunnels: 7 (2 ts↔memorymark + 5 public↔private).
Actual tunnels: 2 (only the no-hyphen pair memorymark ↔ mempalace-ts).

Direct repro of the lookup miss:

```python

from mempalace.miner import get_topics_by_wing
from mempalace.palace_graph import topic_tunnels_for_wing
m = get_topics_by_wing()
list(m.keys())
['mempalace-ts', 'desktop', 'memorymark', 'mempalace-public', 'mempal-private']
len(topic_tunnels_for_wing('mempal_private', m, min_count=1)) # what mine actually calls
0
len(topic_tunnels_for_wing('mempal-private', m, min_count=1)) # what's in topics_by_wing
5
```

Root cause

  • mempalace/cli.py:146 (cmd_init): `wing = project_path.name` — raw dirname.
  • mempalace/room_detector_local.py:307 (writes mempalace.yaml): `project_name = project_path.name.lower().replace(" ", "").replace("-", "")`.
  • mempalace/miner.py:944 reads `config["wing"]` from the yaml, so the underscored form reaches _compute_topic_tunnels_for_wing but the registry holds the hyphenated form.

The same normalization rule lives in two files; one path applies it, the other doesn't.

Why tests missed it

tests/test_miner.py topic-tunnel fixtures use wing_alpha, wing_beta, foo, bar — separator-free names that look identical before and after normalization.

Suggested fix

Extract a shared sanitize_wing_name() (anywhere reasonable — config.py already has sanitize_name) and call it from both cli.py:146 and room_detector_local.py:307. Add a regression test using a hyphenated dirname.

Repro environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions