fix(session): add typed message lookup wrappers (#27269)

This commit is contained in:
Shoubhit Dash 2026-05-13 13:04:07 +05:30 committed by GitHub
commit fed043a1ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 49 additions and 10 deletions

View file

@ -205,6 +205,15 @@ describe("MessageV2.page", () => {
}),
)
it.instance("fails pageEffect with NotFoundError for non-existent session", () =>
Effect.gen(function* () {
const fake = "non-existent-session" as SessionID
const error = yield* Effect.flip(MessageV2.pageEffect({ sessionID: fake, limit: 10 }))
expect(error).toBeInstanceOf(NotFoundError)
expect(error.message).toBe(`Session not found: ${fake}`)
}),
)
it.instance("handles exact limit boundary", () =>
withSession(({ sessionID }) =>
Effect.gen(function* () {
@ -492,6 +501,17 @@ describe("MessageV2.get", () => {
),
)
it.instance("fails getEffect with NotFoundError for non-existent message", () =>
withSession(({ sessionID }) =>
Effect.gen(function* () {
const messageID = MessageID.ascending()
const error = yield* Effect.flip(MessageV2.getEffect({ sessionID, messageID }))
expect(error).toBeInstanceOf(NotFoundError)
expect(error.message).toBe(`Message not found: ${messageID}`)
}),
),
)
it.instance("scopes by session id", () =>
Effect.gen(function* () {
const session = yield* SessionNs.Service