fix(encoding): read pyproject.toml and quant_map.json as UTF-8 - #2190
Conversation
Path.read_text() / Path.open() with no encoding decode in the locale code page. Both files are UTF-8 (TOML and JSON always are) and carry em dashes that cp932/cp936/cp949/cp950 cannot decode, so on a Chinese, Japanese or Korean Windows: - core.version._fallback_version raised UnicodeDecodeError while core.version was still being imported. That is the version path a raw source checkout and a frozen build without package metadata both take, and it runs at import, so the backend died before any VoiceStudio code could name the cause. - engines.omnivoice_gguf.backend._load_quant_map raised it when the engine picked a quant, so every generation failed with an error the app could not classify. tests/test_app_version.py, the version-lockstep guard, read the same files the same way and could not run on those hosts either. Same Python 3.11 locale-decoding class as the .pth startup crash (debpalash#1783) and alembic.ini (debpalash#2075). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughRepository metadata and quantization data now use explicit UTF-8 decoding. Tests cover CJK Windows code pages and verify the affected files contain valid UTF-8 data. The changelog records the source-install fix. ChangesLocale-safe decoding
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The repository data reads now use UTF-8 across the affected runtime paths, with targeted locale regression coverage. No merge-blocking risk remains identified. 🚥 Pre-merge checks | ✅ 7 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (7 passed)
Full details: Title checkExplanation The title uses the required Conventional Commit format with a scope and describes the encoding fix, but it does not include an issue reference. The provided description also does not include the relevant issue reference. Full details: Docstring CoverageExplanation Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 5 files. (1 skipped: 1 unsupported.)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The PR appears safe to merge; no concrete correctness, security, data-risk, or repository-rule violation remains. SummaryExplicitly decodes bundled TOML and JSON data as UTF-8, preventing locale-dependent startup and OmniVoice GGUF generation failures on CJK Windows code pages.
Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." |
|
Heads-up on the CHANGELOG: |
The quant-map module's own tests read the same files the backend reads, with no encoding, so the module errored out on a Chinese, Japanese or Korean Windows instead of guarding anything. JSON and Python source are both UTF-8; the source read even re-encodes as UTF-8 on the next line. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md
Read bundled pyproject.toml and quant_map.json explicitly as UTF-8 so source startup and generation work on CJK Windows code pages. The corresponding guards and regression fixtures use the same portable decoding.
Current main is merged and the changelog conflict is resolved with contributor credit. Both CodeRabbit and Greptile reviews were checked; neither has an outstanding code finding.
Validation: 50 offline locale-decoding, version, GGUF and changelog tests passed. The contributor’s regressions exercise cp932/cp936/cp949/cp950 without requiring a Windows host.
Bundled
pyproject.tomlandquant_map.jsonreads now use explicit UTF-8 decoding, with portable regression coverage for CJK Windows code pages. This prevents source startup and generation failures caused by locale decoding. No outstanding review findings remain.