Commit b2cc562
committed
fix(webapp): compare bigint sanitizer boundaries via BigInt for exactness
Address review (CodeRabbit + Devin convergent finding): the literal
`18446744073709551615` in JS source rounds to 2^64 in float64 (the
spacing around 2^64 is 2048), so `value > 18446744073709551615` was
effectively `value > 2**64` and missed the case where a JS Number's
float64 value is *exactly* 2^64. `JSON.stringify(2**64)` emits
"18446744073709552000" — a bare integer above UInt64.MAX that
ClickHouse rejects — so the sanitizer would have let that row through
unchanged and the batch would still drop.
Switch to BigInt comparison against named `UINT64_MAX` / `INT64_MIN`
constants. `BigInt(value)` is safe because we already gate on
`Number.isInteger(value)`. The negative side is unaffected (Int64.MIN
= -2^63 is exactly representable in float64) but the BigInt form keeps
both sides symmetric and self-documenting.
Regression test added: `sanitizeUnknownInPlace(2 ** 64)` must produce
"18446744073709552000" with fixed=1. A naïve `>` literal comparison
would not catch this.
23/23 sanitizer tests green; webapp typecheck clean.1 parent 88c9f06 commit b2cc562
2 files changed
Lines changed: 22 additions & 1 deletion
File tree
- apps/webapp
- app/v3/eventRepository
- test
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
125 | 136 | | |
126 | 137 | | |
127 | 138 | | |
| |||
0 commit comments