feat(session): add durable session archival - #39358
Open
kitlangton wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a first-class, durable Session archive operation to V2.
Archiving now records one
session.archivedfact and projects its timestamp intoSession.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
session.archived.1and registers it in the public event manifest.Session.archive(sessionID), validates existence, and publishes once.time_archivedandtime_updatedfrom the durable event timestamp.POST /api/session/:sessionID/archivewith the existing Session location middleware and typed not-found response.session.archive({ sessionID }).Scope
Testing
bun run generateinpackages/clientbun run test test/session-create.test.tsinpackages/core(28 passed)bun run test test/event-manifest.test.tsinpackages/schemabun run test test/promise.test.tsinpackages/client(19 passed)git diff --checkFlow
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