···303303 path := fmt.Sprintf("%s/%s", collection, rkey)
304304305305 // Get the record (this will log all accessed blocks in the MST path)
306306- recordCID, _, err := tempRepo.GetRecordBytes(r.Context(), path)
306306+ _, _, err = tempRepo.GetRecordBytes(r.Context(), path)
307307 if err != nil {
308308 http.Error(w, fmt.Sprintf("failed to get record: %v", err), http.StatusNotFound)
309309 return
···312312 // Get all blocks that were accessed during record retrieval
313313 blocks := loggingBS.GetLoggedBlocks()
314314315315- // Log block count for debugging
316316- fmt.Printf("sync.getRecord: Retrieved %d blocks for record at %s/%s\n", len(blocks), collection, rkey)
317317- for i, blk := range blocks {
318318- fmt.Printf(" Block %d: CID=%s, size=%d bytes\n", i+1, blk.Cid().String(), len(blk.RawData()))
319319- }
320320-321315 // Write CAR file with all accessed blocks
322316 w.Header().Set("Content-Type", "application/vnd.ipld.car")
323317324318 // Create a buffer to write the CAR data
325319 var buf bytes.Buffer
326320327327- // Create CAR header with the record CID as root
321321+ // Create CAR header with the repo head as root (not the record CID)
322322+ // The CAR file represents a slice of the repo from head to record
328323 header := &car.CarHeader{
329329- Roots: []cid.Cid{recordCID},
324324+ Roots: []cid.Cid{repoHead},
330325 Version: 1,
331326 }
332327