omi icon indicating copy to clipboard operation
omi copied to clipboard

Fix export - doesn't work

Open hugoaap-code opened this issue 9 months ago • 2 comments

Tried to export my data but it won't work. Loads for a while then gives me an empty Json file.

Screenshot_20260208_075715_Omi.jpg

Screenshot_20260208_080024_Drive.jpg

Screenshot_20260208_080011_Drive.jpg

hugoaap-code avatar Feb 08 '26 11:02 hugoaap-code

@josancamon19 I'd like to propose a US$30 bounty for a bounded export-format fix under the contribution guide.

While reviewing this issue, I reproduced an additional failure case in the current backend export: a retained numeric value of NaN, Infinity, or -Infinity is written literally into the completed JSON download. Strict consumers such as JavaScript's JSON.parse reject that file. Firestore supports these numeric values, so the export boundary needs an explicit policy for them.

The source is data_export.py at 4cae024d2598: _yield_json_array and the direct section writers use json.dumps with its default allow_nan=True. The final spool finishes successfully because writing these tokens raises no exception.

Evidence: I exercised the original iter_user_data_export function with synthetic database/MemoryService boundaries in an offline environment. Across profile, conversations, people, chat messages, and task candidates, all 15 non-finite cases produced invalid JSON; all 5 finite controls parsed successfully. Python's strict decoder and Node 24's JSON.parse agreed. This is source-level fixture coverage; the original account-specific empty-download report remains unverified.

Proposed delivery: one shared strict serializer for export sections, an explicit export failure before the first response byte when a value cannot be represented in JSON, and hermetic regression tests for nested non-finite values, finite numbers, Unicode, timestamps, and spool cleanup. Existing record contents would remain unchanged. I would follow the repository's preflight and backend test requirements for the implementation PR.

Small standalone reproduction of the current section writer (run from a checkout)
import ast
import json
from datetime import datetime
from pathlib import Path

source = Path('backend/services/users/data_export.py').read_text()
tree = ast.parse(source)
names = {'_json_default', '_yield_json_array'}
body = [ast.ImportFrom(module='__future__',
        names=[ast.alias(name='annotations')], level=0)]
body += [n for n in tree.body
         if isinstance(n, ast.FunctionDef) and n.name in names]
ns = {'json': json, 'datetime': datetime}
exec(compile(ast.fix_missing_locations(ast.Module(body=body, type_ignores=[])),
             'export-repro', 'exec'), ns)

payload = ''.join(ns['_yield_json_array']([
    {'id': 'synthetic-only', 'nested': {'score': float('nan')}}
]))
print(payload)  # contains an unquoted NaN token
def reject_constant(token):
    raise ValueError(f'Invalid JSON number: {token}')
json.loads(payload, parse_constant=reject_constant)  # raises ValueError

The US$30 is a proposal pending maintainer approval; no existing reward or assignment is claimed.

bulatovicluka1989-rgb avatar Sep 10 '26 14:09 bulatovicluka1989-rgb

@josancamon19 I can take a focused current-main pass on the empty JSON export failure for US$15, payable through the documented private PayPal process after acceptance and merge. I would first reproduce the export path with synthetic retained records, distinguish a legitimately empty account from serialization or fetch failure, make failures return an explicit error instead of a successful empty file, and add regressions for ordinary records plus unsupported or non-finite values. No live user data would be used. Please confirm funding and eligibility; I am not assuming assignment or payment.

haotvko avatar Sep 11 '26 13:09 haotvko