Skip to content

[Feature] Per-event tags — a mixed persistAll stamps every event with the first event's tags #631

Description

@pathosDev

Problem

Journal.append(pid, events, expectedSeq, tags?) takes one tag list for the whole batch (src/persistence/Journal.ts:17-22), and PersistentActor.persistAll reads this.tagsFor(events[0]!) — the comment says "Collect tags from the first event" (src/persistence/PersistentActor.ts:271).

Persisting [OrderPlaced, PaymentCaptured] atomically stamps both events with OrderPlaced's tags, so eventsByTag('payment') never sees the second event. Every backend faithfully replicates this (RelationalJournal.ts:117 joins one tagString; CassandraJournal.ts:143 one tagList; MongoJournal.ts:122; DynamoDbJournal.ts:132). Tagged queries silently miss events for anyone who tags per event type and persists atomically — the natural event-sourcing shape.

Proposed behaviour

BREAKING (pre-1.0 hard cut): widen the contract to per-event tags — an { event, tags }[] shape or ReadonlyArray<ReadonlyArray<string>> — and have persistAll call tagsFor per event. Migrate all ten journal backends in the same change.

Acceptance criteria

  • New persistence-contract scenario: "per-event tags round-trip in a multi-event append", passing on all ten journal harnesses.
  • CHANGELOG entry flagged BREAKING with a one-line migration note.

Related: #532 (query-side backend parity), #493 (contract polish)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: highTop priority — high impact, plan nextproduction-goalBlocks or defines the path to production readiness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions