···447447 })
448448449449 case OpTypeDelete:
450450+ existing, _ := r.MST.Get([]byte(path))
451451+ if existing == nil {
452452+ results = append(results, ApplyWriteResult{
453453+ Type: new(OpTypeDelete.String()),
454454+ })
455455+ continue
456456+ }
457457+450458 var old models.Record
451459 if err := rm.db.Raw(ctx, "SELECT value FROM records WHERE did = ? AND nsid = ? AND rkey = ?", nil, urepo.Did, op.Collection, op.Rkey).Scan(&old).Error; err != nil {
452460 return cid.Undef, err
···528536 return cid.Undef, nil
529537 }); err != nil {
530538 return nil, err
539539+ }
540540+541541+ if len(atpOps) == 0 {
542542+ for i := range results {
543543+ rt := *results[i].Type + "Result"
544544+ results[i].Type = &rt
545545+ results[i].Commit = &RepoCommit{
546546+ Cid: rootcid.String(),
547547+ Rev: urepo.Rev,
548548+ }
549549+ }
550550+ return results, nil
531551 }
532552533553 // ── Phase 2: serialise the write log so we can replay it ─────────────
···939959// to be honest, we could just store both the cbor and non-cbor in []entries above to avoid an additional
940960// unmarshal here. this will work for now though
941961func getBlobCidsFromCbor(cbor []byte) ([]cid.Cid, error) {
962962+ if len(cbor) == 0 {
963963+ return nil, nil
964964+ }
965965+942966 var cids []cid.Cid
943967944968 decoded, err := atdata.UnmarshalCBOR(cbor)