Why is my raw transaction non-canonical, getting error -25, and being rejected?

I'm trying to port TX generation logic to a different (and unpopular) language. I've been beating my head against this way too long and should have walked away but, well, you know, closure, and