fix(io/sefaria): use 'hebrew' language token in API URLs (0.3.1)#15
Merged
Conversation
Sefaria's v3 API expects the version-query language as a full name (e.g. 'hebrew', 'english', 'french'), not the ISO code. Passing 'he|<title>' silently returns an empty 'versions' array with warning code 102, which then trips _select_version's 'response has no versions' ValueError when the importer is exercised against live Sefaria. The unit tests caught nothing because every existing test mocks _fetch_json and never exercises the URL construction path against the real API. Add two URL-builder tests that pin the language token to 'hebrew' and reject the ISO-code form. Discovered while building the Mishna Avot demo in tracealign-demos.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
`tracealign.io.sefaria._build_url` constructed query strings with
`?version=he|<title>`. Sefaria's v3 API expects the full language name
(`?version=hebrew|<title>`) and silently returns an empty `versions`
array otherwise, which trips `_select_version`'s 'response has no
versions' error when the importer is exercised against the live API.
This bug shipped in 0.3.0 because every existing test mocks `_fetch_json`
and never exercises the URL construction path. Added two URL-builder
tests that pin the language token to `hebrew` and reject the ISO-code
form.
Discovered while building the Mishna Avot demo in `tracealign-demos`;
the demo loaded the importer against live Sefaria for the first time and
hit the bug immediately.
Test plan
Release plan
Patch release 0.3.1 immediately after this PR merges.