fix: use utf-8 for local tracking text files#790
Conversation
andreahlert
left a comment
There was a problem hiding this comment.
Thanks for the fix. One spot in the same file looks missed: backend.py:524 reads graph.json text-mode without encoding="utf-8". Same class of bug, and client writes it as UTF-8 (client.py:420).
async with aiofiles.open(graph_file, encoding="utf-8") as f:Could you include that line in this PR as well?
|
Thank you for catching that missed spot. I added the same explicit |
|
This looks like the right fix, but since this is correcting platform-dependent file encoding behavior, I think it would be worth adding a regression test that writes and reads non-ASCII content through LocalBackend (annotations / graph / children) to prove UTF-8 handling end-to-end and prevent missed call sites. Could you add that please? |
Summary
Thanks for maintaining Burr. This PR makes the local tracking backend text-file reads and writes use explicit UTF-8 encoding.
What changed
encoding="utf-8"to annotation JSONL reads and writes inLocalBackendencoding="utf-8"when readingchildren.jsonlBefore / after
Before, these JSONL text files used the platform default encoding, which can vary on Windows and other non-UTF-8 locale environments.
After, the local backend reads and writes these text files consistently as UTF-8.
Verification
python -m py_compile burr/tracking/server/backend.pygit diff --check