• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kobotoolbox / kpi / 22689698406
81%
master: 76%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 04 Mar 2026 09:52PM UTC
Jobs 2
Files 886
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Mar 2026 09:16PM UTC coverage: 81.268% (+0.004%) from 81.264%
22689698406

push

github

web-flow
fix(reports): sanitize non-finite floats to prevent invalid JSON responses DEV-1797 (#6779)

### 📣 Summary

Fixed an issue where the reports page would fail to load when a decimal
field contained a non-finite value (e.g. `Infinity` or `NaN`) in a
submission.

Also fixes the statistics computation so that submissions containing
non-finite decimal values are treated as **not provided**, rather than
corrupting counts and aggregates.

### 📖 Description

When a submission contains `Infinity` or `NaN` for a decimal field, two
problems occur:

1. **Invalid JSON response (this PR):** The backend statistics
computation (mean, median, stdev, mode) can produce non-finite float
values. These are not valid JSON, causing `JSON.parse` in the browser to
fail and the reports page to display an error. Fixed by introducing a
`SanitizedJSONRenderer` that recursively replaces any non-finite float
(`NaN`, `Infinity`, `-Infinity`) with `null` before serializing the HTTP
response.

2. **Incorrect statistics
([formpack#340](https://github.com/kobotoolbox/formpack/pull/340)):**
`NumField.parse_values()` was silently passing non-finite floats
through, causing them to be counted as valid provided responses and
corrupting `provided`, `total_count`, and aggregate statistics (mean,
median, etc.). Fixed upstream by raising a `ValueError` for non-finite
floats — the existing `_calculate_stats` error handler already treats
these as `not_provided`. This PR bumps the formpack dependency to
include that fix.

7284 of 11424 branches covered (63.76%)

13 of 14 new or added lines in 2 files covered. (92.86%)

27987 of 34438 relevant lines covered (81.27%)

1.6 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
73.02
1.24% kpi/renderers.py
Jobs
ID Job ID Ran Files Coverage
1 22689698406.1 04 Mar 2026 09:52PM UTC 884
78.93
2 22689698406.2 04 Mar 2026 09:55PM UTC 886
81.23
Source Files on build 22689698406
  • Tree
  • List 886
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • a820435b on github
  • Prev Build on release/2.026.03 (#22679869904)
  • Next Build on release/2.026.03 (#22698922805)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc