There is a distinct difference between the way payslips compute categories and how they sum categories over periods of time.
On payslips, children of categories are included, however not if using `sum_category` over a period of time.
Additionally, it is possible (from testing on other databases) to have contracts without an employee, resulting in a failed migration. Avoid this by filtering for employees on the contract and log if something (maybe a record rule) prevents you from seeing it instead of failing the migration itself.