fix: address review feedback

- Removed duplicate blank line in event.go
- Use original event timestamp instead of time.Now() for EventStored
- Fixed MockEventBroadcaster.Subscribe to return nil instead of closed channel
- Added integration tests for EventStored with JetStreamEventStore

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Claude Code
2026-01-13 22:25:10 +01:00
parent 0f89b07c0b
commit 5223cf136a
5 changed files with 213 additions and 9 deletions

View File

@@ -2,7 +2,6 @@ package store
import (
"sync"
"time"
"git.flowmade.one/flowmade-one/aether"
)
@@ -12,7 +11,7 @@ type InMemoryEventStore struct {
mu sync.RWMutex
events map[string][]*aether.Event // actorID -> events
snapshots map[string][]*aether.ActorSnapshot // actorID -> snapshots (sorted by version)
eventBus aether.EventBroadcaster // Optional EventBus for publishing EventStored
eventBus aether.EventBroadcaster // Optional EventBus for publishing EventStored
metrics aether.MetricsCollector // Optional metrics collector
}
@@ -69,10 +68,10 @@ func (es *InMemoryEventStore) SaveEvent(event *aether.Event) error {
es.events[event.ActorID] = make([]*aether.Event, 0)
}
es.events[event.ActorID] = append(es.events[event.ActorID], event)
// Publish EventStored event on success
es.publishEventStored(event)
return nil
}
@@ -86,7 +85,7 @@ func (es *InMemoryEventStore) publishEventStored(event *aether.Event) {
EventID: event.ID,
ActorID: event.ActorID,
Version: event.Version,
Timestamp: time.Now(),
Timestamp: event.Timestamp,
}
// Convert EventStored to Event for publishing (internal system event)