mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
Convert_units() was validating categories on raw input like "kg" or "ft" instead of the normalized unit name, so aliases got checked against a category list that only has canonical names in it. Any alias-based conversion that should've worked just raised ValidationError instead. Fixed by normalizing both units before the category check runs. Also added foot/yard/mile/gallon to the alias map - they already had conversion factors but weren't mapped to their canonical names, so they'd still have failed even after the above fix. Turned out there was a second bug hiding behind the first one: the category check defaults both sides to None, and None == None is True, so two aliases from different categories that neither resolved to a real category would silently pass instead of raising. kg -> ft would just return a number instead of erroring. Normalizing first fixes this too, since aliases now resolve to their actual categories and the mismatch gets caught. Added a regression test locking that second one down - kg->ft and gal->lb now raise ValidationError instead of silently converting. Fixes #931.