Skip to content

Node lookup fails for accented labels on macOS (NFD vs NFC) and for full labels with punctuation #1338

Description

@vapuleado

Two related node-resolution problems hit non-English corpora (Spanish, accents/ñ), especially on
macOS where the filesystem stores filenames in Unicode NFD while graph.json labels are NFC.

Bug 1 — affected.resolve_seed() doesn't normalize Unicode.
It compares with .lower() only. A query in NFD never equals an NFC label:

# repro
import unicodedata, networkx as nx
from graphify.affected import resolve_seed
G = nx.Graph(); G.add_node("n1", label="Auditoría")          # NFC, as stored in graph.json
resolve_seed(G, unicodedata.normalize("NFC", "Auditoría"))   # -> "n1"  OK
resolve_seed(G, unicodedata.normalize("NFD", "Auditoría"))   # -> None  ✗  (same text, NFD)

On macOS, a label argument copied from a filename arrives as NFD → affected reports "not found".

Bug 2 — serve._find_node() doesn't resolve a full label that contains punctuation.
It is diacritic-insensitive per word (good), but the search term is tokenized (_search_tokens,
strips , /, ()…) while it's compared against norm_label, which keeps punctuation. So a user
who passes the exact node label can't resolve it:

from graphify.serve import _find_node
# label = "Skill /auditar — Auditoría inquisitiva de enlaces"
_find_node(G, "Auditoría")                                   # -> matches (substring)  OK
_find_node(G, "Skill /auditar — Auditoría inquisitiva de enlaces")  # -> []  ✗

This affects explain/query/path and the MCP serve layer.

Impact: any non-ASCII knowledge base; explain/query/path/affected and the MCP server.

Environment: graphifyy 0.8.37, macOS, Python 3.14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions