Skip to content

feat(session): add durable session archival - #39358

Open
kitlangton wants to merge 2 commits into
v2from
archive-session
Open

feat(session): add durable session archival#39358
kitlangton wants to merge 2 commits into
v2from
archive-session

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Adds a first-class, durable Session archive operation to V2.

Archiving now records one session.archived fact and projects its timestamp into Session.Info.time.archived. Repeated archive requests are idempotent.

This is intentionally separate from Session deletion. Delete interrupts execution, waits for idle, recursively deletes children, and removes the Session aggregate. Archive only changes Session visibility and leaves execution/history intact.

How

  • Schema: defines durable session.archived.1 and registers it in the public event manifest.
  • Core: adds Session.archive(sessionID), validates existence, and publishes once.
  • Projector: sets time_archived and time_updated from the durable event timestamp.
  • Protocol/Server: exposes POST /api/session/:sessionID/archive with the existing Session location middleware and typed not-found response.
  • Client: regenerates Promise and Effect clients with session.archive({ sessionID }).
  • Compatibility: V1-connected app clients translate archive into the existing legacy Session update timestamp, while V2 clients use the new endpoint.

Scope

  • No voice-controller changes.
  • No TUI interaction changes.
  • No unarchive endpoint.
  • Existing destructive Session delete semantics are unchanged.

Testing

  • bun run generate in packages/client
  • bun run test test/session-create.test.ts in packages/core (28 passed)
  • bun run test test/event-manifest.test.ts in packages/schema
  • bun run test test/promise.test.ts in packages/client (19 passed)
  • focused app compatibility test (10 passed)
  • package typechecks for Core, Schema, Protocol, Server, Client, and App
  • pre-push workspace typecheck (32 packages passed)
  • git diff --check

Flow

sequenceDiagram
  participant Client
  participant API as V2 Session API
  participant Core as Session service
  participant Bus as Durable event bus
  participant Projection as Session projection

  Client->>API: POST /api/session/:id/archive
  API->>Core: archive(sessionID)
  Core->>Core: require existing Session
  alt not archived
    Core->>Bus: publish session.archived
    Bus->>Projection: project durable event
    Projection->>Projection: set time_archived + time_updated
  else already archived
    Core-->>API: no-op
  end
  API-->>Client: 204 No Content
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant