Skip to content

[Feature] Time-travel debugger over journal #201

Description

@pathosDev

Size / Priority

  • Size: L

Rationale

PersistentActors store events in the journal. Sometimes you need to inspect the state at any past moment: "what was the cart state on Tuesday at 3pm?" Today: replay events manually up to that point.

A Time-Travel Debugger:

  • CLI tool: actor-ts journal-debug --pid order-42 --backend sqlite://....
  • Interactive REPL: step forward/back through events; inspect state.
  • Optional VS Code extension.

Design sketch

$ actor-ts journal-debug --pid order-42 --backend sqlite:///path/to/journal.db
[journal-debug] loaded 156 events for pid 'order-42'
[journal-debug] state at seq 0: { items: [], total: 0 }
[journal-debug] > next 5
seq 5: { items: ['hat'], total: 19.99 }
[journal-debug] > goto 100
seq 100: { items: ['hat', 'scarf', 'gloves'], status: 'paid', total: 87.50 }
[journal-debug] > diff 50 100
+ status: pending → paid
+ total: 45.00 → 87.50
+ items: ['hat'] → ['hat', 'scarf', 'gloves']

Bind to existing PersistentActor types via the user-supplied actor class. Replay through applyEvent.

Out of scope / non-goals

  • Edit + commit — read-only.
  • Cross-actor causality — single pid at a time.
  • Production tracing — that's Tracing extension.

Open design questions

  1. VS Code extension vs CLI: CLI first; VS Code later.
  2. User-class loading: REPL must import the user's actor class to call applyEvent. ESM dynamic import + path config.
  3. Snapshot integration: start from snapshot, replay events forward.

Test plan

  1. CLI loads journal, lists events, steps through.
  2. goto N reconstructs state at seq N.
  3. diff X Y shows state difference.
  4. Snapshot acceleration.
  5. Handles 100K-event journal in reasonable time.

Acceptance criteria

  • actor-ts journal-debug CLI command.
  • Step/goto/diff REPL operations.
  • Snapshot integration.
  • Documentation: "Debugging event-sourced state with time travel".
  • Test suite (5 cases).
  • CHANGELOG entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: lowNice-to-have / niche / demand-driven

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions