catalog: log ProjectionStore delta applies + greppable snapshot line
Restore the per-batch visibility lost in the cart migration: applyDelta now logs 'delta applied epoch=N (+U/-D, overlay=X)', and the snapshot swap line includes 'snapshot' so it's findable. Deltas were applying silently, which read as 'nothing happened' on a bulk catalog update (only the debounced snapshot swap was logged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8b454bccac
commit
8a71e32149
1 file changed
+8
-1
+8
-1
@@ -196,7 +196,7 @@ func (s *ProjectionStore[T]) endSnapshot(epoch int64, meta map[string]string) er
|
||||
}
|
||||
s.epoch = epoch
|
||||
s.overlay = make(map[string]overlayEntry[T]) // base now includes everything ≤ epoch
|
||||
log.Printf("catalog: ProjectionStore base swapped epoch=%d (%d entries)", epoch, s.buildingSeen)
|
||||
log.Printf("catalog: ProjectionStore snapshot applied — base swapped epoch=%d (%d entries)", epoch, s.buildingSeen)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -222,16 +222,23 @@ func (s *ProjectionStore[T]) applyDelta(epoch int64, payload []byte) error {
|
||||
// this epoch; the consumer's fallback covers reads until then.
|
||||
return nil
|
||||
}
|
||||
var upserts, deletes int
|
||||
for _, u := range ups {
|
||||
if u.SKU == "" {
|
||||
continue
|
||||
}
|
||||
if u.Deleted {
|
||||
s.overlay[u.SKU] = overlayEntry[T]{deleted: true}
|
||||
deletes++
|
||||
continue
|
||||
}
|
||||
// Transform applied here too — overlay holds the consumer's shape.
|
||||
s.overlay[u.SKU] = overlayEntry[T]{val: s.transform(u.Projection)}
|
||||
upserts++
|
||||
}
|
||||
if upserts+deletes > 0 {
|
||||
log.Printf("catalog: ProjectionStore delta applied epoch=%d (+%d/-%d, overlay=%d)",
|
||||
epoch, upserts, deletes, len(s.overlay))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user