Integer instead of boolean

For a few days, we’re observing a very strange bug where for a few of our events (about 2.5%), a boolean in one of our contexts is sent as an integer (1), instead of boolean (true). This is strange since on the tracking side we’re explicitly casting to boolean.

While trying to find some patterns, e.g. devices types that were affected by this, I noticed that in the bad stream the enriched.xxx booleans are also sent as integers, not booleans. E.g., in the good stream events would have br_cookies: true, in the bad stream it shows up as data.payload.enriched.br_cookies: 1.

Previously I was convinced that the error is somewhere on the tracking/instrumentation side - but this observation makes me wonder if there’s a chance that something goes wrong during our enrichment and validation.

The property that sometimes is received as an integer is actually the first boolean in the (alphabetically) first context, other booleans after that are sent normally.

Any thoughts or leads on this? Our frontend engineers have extensively tried to find the bug on their side, but they couldn’t find the issue yet.

The validation error is:

{
  "schemaKey": "iglu:com.xxx/app_user/jsonschema/1-0-0",
  "error": {
    "error": "ValidationError",
    "dataReports": [
      {
        "message": "$.is_subscribed: integer found, boolean expected",
        "path": "$.is_subscribed",
        "keyword": "type",
        "targets": [
          "integer",
          "boolean"
        ]
      }
    ]
  }
}