Constraint auto ID

see commit messages.

Amelia hasn't QA'd this yet but I'm pretty confident it doesn't have any issues.