fix(session): accept legacy summary diffs (#26579)

Co-authored-by: Developer <temp@example.com>
This commit is contained in:
Kit Langton
2026-05-09 16:44:24 -04:00
committed by GitHub
co-authored by Developer
parent 5fa5d876fc
commit d373c562f2
12 changed files with 88 additions and 15 deletions
@@ -297,6 +297,36 @@ describe("session HttpApi", () => {
),
)
it.live(
"serves sessions with migrated summary diffs missing file details",
withTmp({ git: true, config: { formatter: false, lsp: false } }, (tmp) =>
Effect.gen(function* () {
const session = yield* createSession(tmp.path, { title: "legacy diff" })
yield* Effect.sync(() =>
Database.use((db) =>
db
.update(SessionTable)
.set({
summary_additions: 1,
summary_deletions: 0,
summary_files: 1,
summary_diffs: [{ additions: 1, deletions: 0 }],
})
.where(eq(SessionTable.id, session.id))
.run(),
),
)
const response = yield* request(pathFor(SessionPaths.get, { sessionID: session.id }), {
headers: { "x-opencode-directory": tmp.path },
})
expect(response.status).toBe(200)
expect((yield* json<Session.Info>(response)).summary?.diffs).toEqual([{ additions: 1, deletions: 0 }])
}),
),
)
it.live(
"serves lifecycle mutation routes",
withTmp({ git: true, config: { formatter: false, lsp: false, share: "disabled" } }, (tmp) =>