anchor.diff:              () => store.commit(deletes: allKeys),
   
               // Wait until the entity deletes are reflected in the indices.
  -            () => waitUntilEntitiesGone(store, allKeys, partition),
  +            () => Future.wait([
  +                  waitUntilEntitiesGone<User>(
  +                      store, users.map((u) => u.key).toList(), partition),
  +                  waitUntilEntitiesGone<ExpandoPerson>(store,
  +                      expandoPersons.map((u) => u.key).toList(), partition),
  +                ]),
   
               // Make sure queries don't return results
               () => store.lookup(allKeys).then((List<db.Model> models) {
  
positive.code:       "Tried running a query with exponential backoff, giving up now.");
  }
  
  Future waitUntilEntitiesReady(
      db.DatastoreDB mdb, List<db.Key> keys, db.Partition partition) {
    return waitUntilEntitiesHelper(mdb, keys, true, partition);
  }
  
  Future waitUntilEntitiesGone(
      db.DatastoreDB mdb, List<db.Key> keys, db.Partition partition) {
    return waitUntilEntitiesHelper(mdb, keys, false, partition);
  }
  
  Future waitUntilEntitiesHelper(db.DatastoreDB mdb, List<db.Key> keys,
      bool positive, db.Partition partition) {
    var keysByKind = <Type, List<db.Key>>{};
    for (var key in keys) {
      keysByKind.putIfAbsent(key.type, () => <db.Key>[]).add(key);
    }
  
    Future waitForKeys(List<db.Key> keys) {
      return mdb
          .query<db.Model>(partition: partition)
          .run()
          .toList()
          .then((List<db.Model> models) {
        for (var key in keys) {
          bool found = false;
          for (var model in models) {
            if (key == model.key) found = true;
          }
          if (positive) {
            if (!found) return waitForKeys(keys);
          } else {
            if (found) return waitForKeys(keys);
          }
        }
        return null;
      });
    }
  
    return Future.forEach(keysByKind.keys.toList(), (Type kind) {
      return waitForKeys(keysByKind[kind]);
    });
  }
  
  Future main() async {
  
negative.code:       var allInserts = <db.Model>[]..addAll(users)..addAll(expandoPersons);
        var allKeys = allInserts.map((db.Model model) => model.key).toList();
        return store.commit(inserts: allInserts).then((_) {
          return Future.wait([
            waitUntilEntitiesReady<User>(
                store, users.map((u) => u.key).toList(), partition),
            waitUntilEntitiesReady<ExpandoPerson>(
                store, expandoPersons.map((u) => u.key).toList(), partition),
          ]).then((_) {
            var tests = [
              // Queries for [Person] return no results, we only have [User]
              // objects.
  