GraphiteEditor / GraphiteEditor/Graphite
NaN point causes document not to deserialize
- Dominant language
- Rust
- Stars
- 27.2k
- Forks
- 1.3k
- Avg merge
- 20h 5m
- Merged PRs (30d)
- 57
Description
When a document is saved with a value as `NaN`, the `serde_json` encodes it as `null` however it is then unable to decode it per https://github.com/serde-rs/json/issues/202. This is not ideal as users have to manually edit the JSON to recover their document.
Apparently we can get `NaN` values in the `handle_end` field of `SegmentModification`. It is not clear how this occurs. Some asserts when updating these values should allow for better debugging if this occurs again.
It may also be prudent to consider checking the document for NaN values before saving. Furthermore, a better data format (not JSON) might allow roundtripping all data values. This could be considered as part of #1742.
As reported by [ananas_tya on discord](https://discord.com/channels/731730685944922173/1134981447539761273/1537123590460145674).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing document serialization through serde_json and investigating how SegmentModification.handle_end can contain NaN values. Reproduce the save-and-deserialize failure, then determine whether the fix should validate before saving, improve diagnostics, or address the broader format concern in #1742. Done means the chosen behavior is defined and covered by regression checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100