gh-1579

**not ready for merge**

Follow-up to #1579. Predictably enough, this is a tricky thing to implement gradually, so there's a lot of temporary cruft here