The bizarre database issue I was having was because this code lived above the commit originally, and the commit is committing a version of the object memoized before this code ran, so the live mode in the database was being set back in time. Doing section reassignment after everything else ensures that we actually know what we're reassigning on.