Fix cache loading with Report.from_dict() method

The Report.to_dict() serializes range as {from, to} but constructor
expects range_from/range_to. Added from_dict() classmethod to properly
deserialize cached data, reconstructing all nested objects (Engagement,
Comment, SubScores, RedditItem, XItem).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Matt Van Horn
2026-01-23 15:46:09 -08:00
parent 101c3ad07a
commit e141ff07ea
2 changed files with 71 additions and 1 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ def main():
cached = cache.load_cache(cache_key)
if cached:
# Use cached data
report = schema.Report(**cached)
report = schema.Report.from_dict(cached)
output_result(report, args.emit)
return