Repository navigation
Restore JSON regression coverage for late non-ASCII text - #2601
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The fixture and vector assertions correctly exercise the intended regression across existing test entry points.
Review effort: Balanced
Findings: None
What changed in this PR
Restores regression coverage for charset detection when Unicode appears late in JSON input.
Changes:
- Adds a UTF-8 JSON fixture with a long ASCII prefix.
- Adds shared CLI/library conversion checks.
- Verifies the first non-ASCII byte falls between 8 KiB and 64 KiB.
| File | Description |
|---|---|
packages/markitdown/tests/test_module_misc.py |
Validates the fixture’s charset-sampling boundary. |
packages/markitdown/tests/test_files/json_late_non_ascii.json |
Provides late-Unicode JSON input. |
packages/markitdown/tests/_test_vectors.py |
Adds shared conversion expectations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 5, 2026
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.
The test consolidation removed coverage for JSON whose first non-ASCII character appears well into the file. Existing charset tests introduce Unicode near the beginning, allowing an incorrectly shortened detection sample to go unnoticed.
Add
json_late_non_ascii.json, derived from the existingtest.json, to the shared CLI and library vectors. Its first non-ASCII byte is at offset 10,779; a fixture check preserves that property. The vector verifies UTF-8 detection and preservation of the original fields and late Unicode text.Validation:
git diff --checkpassed.