fix: resolve UUID JSON serialization error in checkpoint creation

Issue:
- Object of type <class 'uuid.UUID'> is not JSON serializable error when creating checkpoints
- UUID objects in database records couldn't be serialized to JSON

Solution:
- Updated json_serializer function in create_checkpoint() to properly handle UUID types
- Added explicit isinstance check for uuid.UUID before checking for isoformat
- Ensures all UUID values are converted to strings before JSON serialization

This ensures checkpoints can be created successfully with all database data types.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Codex Agent 2025-10-30 11:52:06 +08:00
parent 7ddec0fb4f
commit 1fa9385d02
2 changed files with 16 additions and 1 deletions

View File

@ -0,0 +1,8 @@
{
"checkpoint_id": "checkpoint_20251030_115009",
"timestamp": "20251030_115009",
"description": "1",
"tables": {
"business_scopes": [
{
"id":

View File

@ -438,7 +438,14 @@ def create_checkpoint(description: str = "") -> Dict[str, Any]:
def json_serializer(obj):
"""Convert non-JSON serializable objects to strings."""
if hasattr(obj, 'isoformat'): # UUID, datetime, etc.
try:
import uuid
if isinstance(obj, uuid.UUID):
return str(obj)
except ImportError:
pass
if hasattr(obj, 'isoformat'):
return str(obj)
raise TypeError(f"Object of type {type(obj)} is not JSON serializable")