fix(infra): restore canonical_json_bytes non-ASCII behavior and dataset_ingest list safety

- canonical_json_bytes now delegates to canonical_json (ensure_ascii=False)
  matching the original per-file implementations in emitter and loopback
- dataset_ingest_rds.py restores isinstance(data, list) safety check from
  original load_jsonl, wrapping lib.jsonl.load_json

Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
This commit is contained in:
Devin AI 2026-06-16 01:11:35 +00:00
parent c233d648e6
commit f9dcec7369
2 changed files with 8 additions and 2 deletions

View file

@ -42,4 +42,4 @@ def canonical_json(obj: Any) -> str:
def canonical_json_bytes(obj: Any) -> bytes:
"""Deterministic JSON as bytes — suitable for hashing."""
return stable_json(obj).encode("utf-8")
return canonical_json(obj).encode("utf-8")

View file

@ -30,7 +30,13 @@ import psycopg2.extras
from rds_connect import connect_rds
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "4-Infrastructure"))
from lib.jsonl import load_json as load_jsonl
from lib.jsonl import load_json
def load_jsonl(path: Path) -> list:
"""Load a JSON file; return its contents if a list, else []."""
data = load_json(path)
return data if isinstance(data, list) else []
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")