Skip to content

Wiki export deletes current articles whose Unicode slugs share a case fold #5087

Closed

Description

@sdivyanshu90

What happened?

Severity: medium. Wiki export reports success but deletes a newly generated article when two labels have the same Unicode case fold and different lowercase spellings. index.md retains a link to the deleted page. This affects ordinary non-ASCII names such as Straße and STRASSE, on a case-sensitive Linux filesystem as well as any platform running the cleanup.

Steps to reproduce

Graphify 0.9.104, Linux, Python 3.14; reproduced from a clean source checkout:

from pathlib import Path
from tempfile import TemporaryDirectory
import networkx as nx
from graphify.wiki import to_wiki

G = nx.Graph()
G.add_node("a", label="A", source_file="a.py")
G.add_node("b", label="B", source_file="b.py")
with TemporaryDirectory() as directory:
    out = Path(directory)
    count = to_wiki(G, {0: ["a"], 1: ["b"]}, out,
                    community_labels={0: "Straße", 1: "STRASSE"})
    print("reported articles:", count)
    print("files:", sorted(p.name for p in out.iterdir()))
    print((out / "index.md").read_text())

Actual and expected behavior

The export reports two articles but leaves only Straße.md and index.md; the index still links to both Straße.md and the missing STRASSE.md. The same failure occurs for community/hub article collisions and Greek sigma variants.

Expected: both articles survive under distinct slugs, and every index/article link targets its intended page on the first export and repeated exports.

Root cause and related research

to_wiki allocates unique slugs with lower() but its orphan sweep indexes produced filenames with casefold(). Straße.lower() differs from STRASSE.lower(), so both slugs are allocated; their case folds are identical, so the cleanup map retains only one. Cleanup then mistakes the other current article for a stale spelling and removes it.

I searched open and closed issues and PRs for wiki Unicode, casefold, collisions, and case-only relabels. #1457 handles ASCII case collisions and #4508/#4798 handle relabel cleanup. Those fixes do not cover two simultaneously produced Unicode labels with equal case folds.

Proposed resolution and validation

Use the cleanup's case-folding rule during slug allocation, preserving the existing ASCII filename behavior. Add regressions for community/community, community/hub, and hub/hub collisions, check every generated link and article body, and repeat exports to verify stability. Confirm failures before the fix, then run the wiki/export tests and repository checks. No graph identity or extraction cache change is needed.

Activity

  1. github-actions commented on Nov 8, 2026

    @github-actions

    Thanks for opening this issue, @sdivyanshu90. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

  2. added a commit that references this issue on Nov 9, 2026
    1de3f09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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