(change *v1.Change[v1.BaselineState], newlyCount, widelyCount *int)
| 383 | } |
| 384 | |
| 385 | // SummaryVisitor defines the contract for consuming immutable Event Summaries. |
| 386 | // Unlike state blobs which are migrated to the latest schema, summaries are |
| 387 | // historical records that should be rendered as-is. The Visitor pattern forces |
| 388 | // consumers to explicitly handle each schema version (e.g. V1, V2) independently. |
| 389 | type SummaryVisitor interface { |
| 390 | VisitV1(s EventSummary) error |
| 391 | } |
| 392 | |
| 393 | // ParseEventSummary handles the version detection and dispatching logic. |
| 394 | // Consumers (like the Delivery Worker) should use this instead of raw json.Unmarshal. |
| 395 | func ParseEventSummary(data []byte, v SummaryVisitor) error { |
| 396 | // 1. Peek at version |
| 397 | var header struct { |
| 398 | SchemaVersion string `json:"schemaVersion"` |
| 399 | } |
no outgoing calls
no test coverage detected