Skip to content

Date conversion fails silently on records with 0 values #1031

@luchszebbra

Description

@luchszebbra

Problem

Records with 0 in date fields (day, month, year, endOfPeriod*) crash silently during encoding. Sentry logs show "failed unexpectedly" with no useful error message.

The encoding keeps hanging and continues forever until manually stopped without failing gracefully.

Observed on DAGI-staging and zebbra staging; Can be reproduced with following datasets:

Initially it was found with this dataset containing 45k records; In the dataset above the ones causing sentry errors have been extracted. AZxHgNnGdMGBMAU28tJIfQ.csv

Cause

Two issues in ConvertDateHelpers / ConvertDatesStrategy:

  1. 0 is not treated as falsy — so day_month_year_present? returns true when fields are 0, leading to attempts to build invalid dates like 1830-00-00

  2. Unhandled error tuplepopulate_event_date returns {:error, ...} but the case statement in convert_dates only matches {:ok, ...} and {:invalid_event_date, ...}, causing a CaseClauseError

Expected Behavior

Records with 0 date values should be treated the same as nil — skip date conversion gracefully.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions