writer: normalise nested dict values before comparison
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2 changed files +3 −1
modified
src/aiatlas/sdk/connector.py
+1 −1
@@ -259,7 +259,7 @@ class BaseConnector: | |||||
| 259 | try: | 259 | try: | ||
| 260 | async with sem: | 260 | async with sem: | ||
| 261 | followups = await self._process_target(ctx, target) | 261 | followups = await self._process_target(ctx, target) | ||
| 262 | − except Exception as exc: # noqa: BLE001 — never lose a document silently | 262 | + except Exception as exc: | ||
| 263 | ctx.stats.docs_failed += 1 | 263 | ctx.stats.docs_failed += 1 | ||
| 264 | ctx.log.exception("target failed", extra={"url": target.url}) | 264 | ctx.log.exception("target failed", extra={"url": target.url}) | ||
| 265 | try: | 265 | try: | ||
modified
src/aiatlas/sdk/writer.py
+2 −0
@@ -41,6 +41,8 @@ NEW_IMPORTANCE = {"model": 3, "company": 2, "provider": 2, "paper": 1, "dataset" | |||||
| 41 | def _norm_value(v: Any) -> Any: | 41 | def _norm_value(v: Any) -> Any: | ||
| 42 | if isinstance(v, datetime): | 42 | if isinstance(v, datetime): | ||
| 43 | return v.astimezone(UTC).isoformat(timespec="seconds") | 43 | return v.astimezone(UTC).isoformat(timespec="seconds") | ||
| 44 | + if isinstance(v, dict): | ||||
| 45 | + return {k: _norm_value(x) for k, x in v.items()} | ||||
| 44 | if isinstance(v, (set, tuple, list)): | 46 | if isinstance(v, (set, tuple, list)): | ||
| 45 | items = [_norm_value(x) for x in v] | 47 | items = [_norm_value(x) for x in v] | ||
| 46 | return sorted(items) if all(isinstance(x, (str, int, float)) and not isinstance(x, bool) for x in items) else items | 48 | return sorted(items) if all(isinstance(x, (str, int, float)) and not isinstance(x, bool) for x in items) else items | ||
| 47 | 49 | ||||