apache / apache/couchdb

[Bug]: Fauxton silently corrupts integers larger than `Number.MAX_SAFE_INTEGER`

Open
#6,008 2 comments 0 reactions 0 assignees View on GitHub
bug fauxton javascript patches-welcome
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

### Version

3.3.3

### Describe the problem you're encountering

Documents containing integers larger than JavaScript `Number.MAX_SAFE_INTEGER` are stored correctly by CouchDB itself.

However, when such a document is opened and saved through the Fauxton Web UI, the integer is silently rounded/truncated due to JavaScript number precision limits, corrupting the document.

### Expected Behaviour

The integer value should remain unchanged after editing/saving via Fauxton.

### Steps to Reproduce

1. Insert a document containing a large integer:

```json
{
"_id": "large-int-test",
"hugeNumber": 9223372036854775807
}
```

2. Open the document in Fauxton.
3. Save the document.
4. Fetch the document again.

#### Actual Result

```json
{
"_id": "large-int-test",
"_rev": "1-242234d64bf45499ef1d622e1a0f8237",
"hugeNumber": 9223372036854776000
}
```

### Your Environment

_No response_

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the provided document and save it through the Fauxton Web UI, then inspect the document editor and its JSON parsing or serialization path. Done means reopening and fetching the document preserves 9223372036854775807 exactly; add or run coverage for the reported large-integer case if the relevant Fauxton tests are located.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
databases, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.