Skip to content

Commit d18a4fd

Browse files
Mjboothausgithub-actions[bot]warp-agentcarolinefrasca
authored
Fix JSONDecodeError in remove-incompatible-packages workflow (#195)
* Add mojo-toml v0.3.0 - Native TOML parser for Mojo Package: mojo-toml v0.3.0 A native TOML 1.0 parser for Mojo with zero Python dependencies. Features: - Complete TOML 1.0 syntax support - 96 comprehensive tests ensuring reliability - Nested tables, dotted keys, duplicate detection - Clear error messages with line/column context - Performance: 26μs for simple parses, 2ms for real files Repository: - GitHub: https://github.com/DataBooth/mojo-toml - Release: https://github.com/DataBooth/mojo-toml/releases/tag/v0.3.0 - License: MIT Testing: Package includes test_package.mojo which validates: - Simple key-value parsing - Integer and array parsing - Nested table structures - Dotted key functionality All 96 tests pass in the source repository. Sponsored by DataBooth (https://www.databooth.com.au/posts/mojo) * Update failed-compatibility-macos-latest.json * Fix JSONDecodeError when loading empty failed-compatibility files Add defensive error handling to load_failed_compatibility() to gracefully handle empty or corrupted JSON files instead of crashing with JSONDecodeError. This prevents the remove-incompatible-packages workflow from failing when encountering edge cases with the failed-compatibility JSON files. Changes: - Check for empty file content before parsing JSON - Wrap json.loads() in try-except to catch JSONDecodeError - Log warnings/errors when encountering problematic files - Return empty dict as fallback in all error cases Co-Authored-By: Warp <agent@warp.dev> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Warp <agent@warp.dev> Co-authored-by: Caroline Frasca <42614552+carolinefrasca@users.noreply.github.com>
1 parent a414389 commit d18a4fd

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"mojo-toml": {
3+
"failed_at": "2026-01-14T07:20:14.606055"
4+
}
5+
}

scripts/common.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ class RecipeFailure(TypedDict):
1414
def load_failed_compatibility(file_path: Path) -> dict[str, RecipeFailure]:
1515
if file_path.exists():
1616
with file_path.open("r") as file:
17-
return dict(json.load(file))
17+
content = file.read().strip()
18+
if not content:
19+
eprint(f"Warning: {file_path} is empty, returning empty dict")
20+
return {}
21+
try:
22+
return dict(json.loads(content))
23+
except json.JSONDecodeError as e:
24+
eprint(f"Error parsing {file_path}: {e}")
25+
return {}
1826
return {}
1927

2028

0 commit comments

Comments
 (0)