GraphiteEditor / GraphiteEditor/Graphite

NaN point causes document not to deserialize

Offen
#4,432 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
27.2k
Forks
1.3k
Ø Merge
20 Std. 5 Min.
Gemergte PRs (30 T.)
57

Beschreibung

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).

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust
Bereich
backend, data
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.