omi icon indicating copy to clipboard operation
omi copied to clipboard

Open Library: preserve Unicode subjects instead of rejecting or rewriting them

Open kaijakagi-sys opened this issue 2 months ago • 1 comments

Problem and source evidence

The Open Library integration rewrites valid non-ASCII subject names before looking them up. At the current Omi source, _subject_slug replaces every character outside [a-z0-9] with _. search_subject then rejects an empty slug or requests the rewritten one (handler).

This differs from Open Library's canonical normalize_subject_name: it preserves Unicode characters, converts spaces to underscores, and removes an explicit punctuation set.

Source-derived examples (not executed tests):

Input Omi slug Open Library canonical slug
español espa_ol español
中文 empty / rejected as missing subject 中文
science fiction science_fiction science_fiction

This is a source-level request-construction mismatch; I have not verified a live Omi deployment or the availability of books for these exact subjects.

Proposed scope

Align subject normalization with the upstream contract and correctly encode the resulting subject path segment. Preserve existing blank-input handling, limits, and response formatting. Keep this limited to the Open Library subject tool and focused regression tests; no integration expansion or speculative catalogue content changes.

Validation plan

  • Hermetic tests executing the production normalizer and search_subject handler with a mocked HTTP boundary: accented letters, non-Latin input, multiword ASCII control, blank input, and punctuation/path delimiters.
  • Verify the requested subject segment decodes to the canonical subject, and that non-Latin input is not rejected as blank.
  • Verify positive, empty, and upstream-error responses still follow the existing tool contract.
  • Follow the contribution guide's applicable preflight, invariant/failure-class metadata, and hermetic-gate requirements before any PR.

I inspected merged PR #7415, which introduces this normalizer; PR #13129 changes only the separate poetry integration. Searches for Open Library, its plugin path, and Unicode/subject discussions did not identify an exact existing fix. No implementation or runtime verification is claimed.

Scope and reward question

@josancamon19 @kodjima33 — Is this integration supported, and would this bounded compatibility fix qualify for a $25 bounty, subject to your agreed acceptance criteria and merge? This is a suggestion under the contribution guide, not an approved or funded reward.

kaijakagi-sys avatar Sep 08 '26 19:09 kaijakagi-sys

/claim #13187

Submitted fix and regression test suite in PR #13320.

CreamPle avatar Sep 09 '26 13:09 CreamPle