Skip to content

extract.py session slug disagrees with the shell one on astral characters (live) #174

Closed

Description

@fdaviddpt

pipeline/extract.py::_session_dir still uses the naive codepoint regex that #156 replaced on the bash side. The two disagree on astral characters:

/tmp/emoji-🎉-dir     python: -tmp-emoji---dir   (3)   real: -tmp-emoji----dir   (4)
/tmp/𠮷野家/x          python: -tmp-----x         (5)   real: -tmp------x         (6)

Claude Code's slug regex has no /u flag, so it counts UTF-16 code units — a surrogate pair costs two dashes. The bash session_dir_slug was fixed for this; the Python copy was not.

Effect: a project path containing an emoji or Extension-B kanji makes the Python side compute a directory Claude Code never created — the silent no-op of #144/#166, in the one copy nobody re-pointed at the fixed oracle. Live in 0.8.7.

Why no test caught it: tests/test_non_ascii_paths.py exercises the bash slug only. Every Python-side test (test_extract.py, test_path_resolution.py, test_claude_config_dir.py) uses ASCII paths. A careful UTF-16 oracle was built and pointed at half the implementations.

Fix: port the well-formedness-table logic (or call the shell helper), and point the existing _js_slug oracle at _session_dir too. Overlaps #158 — both are "the slug exists in more than one place"; worth doing together.

Found by an audit sweep for drifted duplicates.

Activity

  1. fdaviddpt commented on Jul 26, 2026

    @fdaviddpt
    ContributorAuthor

    Fixed in #187 (merged as 8eb93b2) — GitHub only auto-closed #157 from that PR's "Closes #157, #158, #174" line, since it parses the first reference only.

    The naive inline copy in lib-memory-dir.sh and the codepoint regex in extract.py are both gone; the slug now lives in pipeline/slug.py and scripts/lib-slug.sh, and tests/test_slug_parity.py checks bash and Python against an independent transcription of the shipped CLI's function over ASCII, accents, CJK, emoji, astral kanji, newlines and lengths either side of 200.

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