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

kobotoolbox / kpi / 12783895750
81%
master: 76%

Build:
Build:
LAST BUILD BRANCH: dev-1257-remove-v1-forms-endpoint
DEFAULT BRANCH: master
Ran 15 Jan 2025 08:36AM UTC
Jobs 1
Files 623
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

15 Jan 2025 07:59AM UTC coverage: 80.474% (-0.03%) from 80.503%
12783895750

push

github

web-flow
fix!: reject duplicate submissions (#5047)

## Summary
Implemented logic to detect and reject duplicate submissions.

## Description

We have identified a race condition in the submission processing that
causes duplicate submissions with identical UUIDs and XML hashes. This
issue is particularly problematic under conditions with multiple remote
devices submitting forms simultaneously over unreliable networks.

To address this issue, a PR has been raised with the following proposed
changes:

- Race Condition Resolution: A locking mechanism has been added to
prevent the race condition when checking for existing instances and
creating new ones. This aims to eliminate duplicate submissions.

- UUID Enforcement: Submissions without a UUID are now explicitly
disallowed. This ensures that every submission is uniquely identifiable
and further mitigates the risk of duplicate entries.

- Introduction of `root_uuid`:

- To ensure a consistent submission UUID throughout its lifecycle and
prevent duplicate submissions with the same UUID, a new `root_uuid`
column has been added to the `Instance` model with a unique constraint
(`root_uuid` per `xform`).

- If the `<meta><rootUuid>` is present in the submission XML, it is
stored in the `root_uuid` column.

- If `<meta><rootUuid>` is not present, the value from
`<meta><instanceID>` is used instead.

- This approach guarantees that the `root_uuid` remains constant across
the lifecycle of a submission, providing a reliable identifier for all
instances.

- UUID Handling Improvement: Updated the logic to strip only the `uuid:`
prefix while preserving custom, non-UUID ID schemes (e.g.,
domain.com:1234). This ensures compliance with the OpenRosa spec and
prevents potential ID collisions with custom prefixes.

- Error Handling:
- 202 Accepted: Returns when content is identical to an existing
submission and successfully processed.
- 409 Conflict: Returns when a duplicate UUID is d... (continued)

5823 of 9325 branches covered (62.45%)

112 of 130 new or added lines in 6 files covered. (86.15%)

7 existing lines in 3 files now uncovered.

22260 of 27661 relevant lines covered (80.47%)

0.8 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
3
92.11
-7.89% kobo/apps/openrosa/apps/logger/exceptions.py
6
88.57
-0.74% kobo/apps/openrosa/libs/utils/logger_tools.py
9
83.2
-3.6% kobo/apps/openrosa/apps/logger/xform_instance_parser.py

Uncovered Existing Lines

Lines Coverage ∆ File
2
88.57
-0.74% kobo/apps/openrosa/libs/utils/logger_tools.py
2
94.41
-1.24% kobo/apps/stripe/views.py
3
83.2
-3.6% kobo/apps/openrosa/apps/logger/xform_instance_parser.py
Jobs
ID Job ID Ran Files Coverage
1 12783895750.1 15 Jan 2025 08:36AM UTC 623
80.47
Source Files on build 12783895750
  • Tree
  • List 623
  • Changed 6
  • Source Changed 0
  • Coverage Changed 6
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 9598180d on github
  • Prev Build on main (#12775758943)
  • Next Build on main (#12784691324)
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

© 2025 Coveralls, Inc