Skip to content

docs(roadmap): refresh Unicode spec; test: close orphaned search pool - #117

Merged
19-84 merged 2 commits into
mainfrom
docs/roadmap-unicode-refresh
Sep 30, 2026
Merged

19-84 merged 2 commits into
mainfrom
docs/roadmap-unicode-refresh

Conversation

@19-84

@19-84 19-84 commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Two independent commits.

1. Roadmap: Unicode spec refreshed against the code and a live database probe

roadmap/05-unicode-foreign-language-support.md had fallen behind the code:

  • Marks done: Phase 1 'simple' FTS (migration 008), CJK-aware truncation, ICU collation, Alpine ILIKE/LOWER folding (verified).
  • Correction: the spec said \w+ only matches ASCII. That is false in Python 3. The real operator bug was hyphenated usernames, fixed in fix(search): hyphenated authors and uppercase operators #115.
  • Correction: "title index not built yet". It shipped, and letter_bucket() sends every title not starting with ASCII a–z to 0-9. That includes accented Latin (Éclair, über), not only CJK/Cyrillic. A cheap first fix is diacritic folding via NFKD.

New finding: Phase 2 (pg_trgm) is blocked by the deployed ctype

Tested on postgres:18-alpine (PG 18.6) with the exact POSTGRES_INITDB_ARGS from docker-compose.yml:

initdb args show_trgm('Привет') show_trgm('日本語') ORDER BY
current (icu … --locale=C) {} {} a,A,b,B,e,é,Z
current + --lc-ctype=C.UTF-8 7 trigrams 4 trigrams a,A,b,B,e,é,Z
builtin C.UTF-8 trigrams trigrams A,B,Z,a,b,e,é ✗

--locale=C leaves ctype at C, so pg_trgm ignores all non-ASCII characters. The planned CJK fallback would silently do nothing. The spec now records --lc-ctype=C.UTF-8 as a Phase 2 prerequisite. The compose file is not changed in this PR; it only affects newly initialized clusters.

2. Test: close the search-engine pool before reloading search_server

tests/test_dynamic_pages.py reloads search_server per test, which orphaned the previous PostgresSearch pool. GC then finalized it on one of its own worker threads (RuntimeError: cannot join current thread in ConnectionPool.__del__). The fixtures now close it before each reload and on teardown.

Result: full suite 989 passed, 0 warnings (3 consecutive runs). It was 639 warnings two PRs ago. ruff clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MjiSEYcZ2q8F7bke96VGHT

19-84 and others added 2 commits September 29, 2026 21:54
…robe

Mark Phase 1, truncation, and ICU collation done. Correct the \w-is-ASCII
claim (the real bug was hyphens, fixed in #115). Record that the shipped
title index sends accented Latin and non-Latin titles to 0-9.

New finding, tested on postgres:18-alpine: with the deployed --locale=C,
ctype is C and pg_trgm extracts no trigrams from Cyrillic/CJK, so the
planned Phase 2 fallback would be a no-op. Adding --lc-ctype=C.UTF-8
fixes it and keeps ICU ordering; the builtin provider fixes it but loses
linguistic order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MjiSEYcZ2q8F7bke96VGHT
Each reload orphaned the previous PostgresSearch pool; GC then finalized
it on one of its own worker threads, raising 'cannot join current thread'
in ConnectionPool.__del__. Test suite now runs with zero warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MjiSEYcZ2q8F7bke96VGHT
@19-84
19-84 merged commit d1cdc20 into main Sep 30, 2026
11 checks passed
@19-84
19-84 deleted the docs/roadmap-unicode-refresh branch September 30, 2026 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant