cleanup

Runs structured Python cleanup and modernization — static analysis via prek/ruff, smell investigation to root cause, typed-boundary hardening by inventorying Any usage, and modernization within the pr