Correct declaration for scope_key.

@nedbat @cpennington Previously, this code was: 

1) Missing the field name. 
2) Gave relatively unclean keys. 

This PR fixes both issue. 

Rapid review would be appreciated, since we're about to start prototyping things on prod which rely on this. If we can get this out, it will save us a migration later. 
I don't see this logic...