refactor(core): move database schema ownership (#29068)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Dax
2026-05-30 21:08:38 -04:00
committed by GitHub
parent 6bcb9cb9bb
commit 7f571d36ea
390 changed files with 11127 additions and 9164 deletions

View File

@@ -27,7 +27,7 @@ describe("session.listGlobal", () => {
const firstSession = yield* withSession({ title: "first-session" })
const secondSession = yield* withSession({ title: "second-session" }).pipe(provideInstance(second))
const sessions = yield* Effect.sync(() => [...SessionNs.listGlobal({ limit: 200 })])
const sessions = yield* SessionNs.Service.use((session) => session.listGlobal({ limit: 200 }))
const ids = sessions.map((session) => session.id)
expect(ids).toContain(firstSession.id)
@@ -56,12 +56,14 @@ describe("session.listGlobal", () => {
yield* SessionNs.Service.use((session) => session.setArchived({ sessionID: archived.id, time: Date.now() }))
const sessions = yield* Effect.sync(() => [...SessionNs.listGlobal({ limit: 200 })])
const sessions = yield* SessionNs.Service.use((session) => session.listGlobal({ limit: 200 }))
const ids = sessions.map((session) => session.id)
expect(ids).not.toContain(archived.id)
const allSessions = yield* Effect.sync(() => [...SessionNs.listGlobal({ limit: 200, archived: true })])
const allSessions = yield* SessionNs.Service.use((session) =>
session.listGlobal({ limit: 200, archived: true }),
)
const allIds = allSessions.map((session) => session.id)
expect(allIds).toContain(archived.id)
@@ -86,13 +88,15 @@ describe("session.listGlobal", () => {
)
const second = yield* withSession({ title: "page-two" })
const page = yield* Effect.sync(() => [...SessionNs.listGlobal({ directory: test.directory, limit: 1 })])
const page = yield* SessionNs.Service.use((session) =>
session.listGlobal({ directory: test.directory, limit: 1 }),
)
expect(page.length).toBe(1)
expect(page[0].id).toBe(second.id)
const next = yield* Effect.sync(() => [
...SessionNs.listGlobal({ directory: test.directory, limit: 10, cursor: page[0].time.updated }),
])
const next = yield* SessionNs.Service.use((session) =>
session.listGlobal({ directory: test.directory, limit: 10, cursor: page[0].time.updated }),
)
const ids = next.map((session) => session.id)
expect(ids).toContain(first.id)