[Bug]: Web Studio JSON preview rounds large integers and replaces large exponents with null

Aperta Adatta ai principianti
#8,432 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
62/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, json, typescript
Ambito
frontend

Direzione di ricerca

Il bug si trova in formatJsonContent in web-studio/src/features/workbench/resources/lib/json-format.ts, che analizza e riserializza il JSON attraverso i numeri di JavaScript. Inizia leggendo quella funzione e riproduci l'esempio minimo {"id":9007199254740993,"scale":1e400} con Node. È completato quando l'Anteprima predefinita mantiene il testo numerico originale per i numeri interi grandi e per gli esponenti grandi, aggiungendo comunque l'indentazione, e un valore normale come 42 continua a essere formattato come prima.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Issue Origin

Observed in Web Studio’s production JSON preview formatter on the current main branch.

Bug Description

The default preview parses and reserializes JSON through JavaScript numbers. A valid large integer can display as a different ID, and a valid large exponent can appear as null. Source view keeps the original text.

Steps to Reproduce
  1. Open a JSON resource with the content below in Web Studio.
  2. Compare the default Preview view with Source.
  3. For an isolated reproduction, pass the same text to formatJsonContent in web-studio/src/features/workbench/resources/lib/json-format.ts.
Expected Behavior

Preview adds indentation while preserving 9007199254740993 and 1e400.

Actual Behavior

The formatter produces 9007199254740992 for the ID and null for the exponent. A normal ID such as 42 formats as expected.

Minimal Reproducible Example
{"id":9007199254740993,"scale":1e400}
OpenViking Version

Main branch formatter blob 60606becc14d13d05e709eccf6c227552f609fae.

Python Version

Not used in this frontend reproduction.

Operating System

Windows.

Model Backend

Other (not involved).

Additional Context

Reproduced by executing the exact TypeScript formatter with Node.js 24 on Windows. The current worker calls this formatter directly. The browser was not run for this reproduction.

Lingua principale
Python
Stelle
42.6k
Fork
3.6k
Merge medio
15h 24m
PR unite (30g)
547

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di volcengine/OpenViking

Tutte le issue di volcengine/OpenViking

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.