fix(app): poll session.diff instead of summary.files, revert sanitizeProject

summary.files is computed asynchronously and never resolves in CI.
Poll session.diff() directly — matches the pattern used by the
snapshot-tool-race integration test.

Also revert the unrelated sanitizeProject changes to event-reducer
and utils that were accidentally included in this PR.
pull/20593/head
Kit Langton 2026-04-02 13:27:10 -04:00
parent 1401208cb5
commit 2666def933
3 changed files with 10 additions and 15 deletions

View File

@ -67,9 +67,13 @@ async function patchWithMock(
await expect.poll(() => llm.calls().then((c) => c > callsBefore), { timeout: 30_000 }).toBe(true)
await expect
.poll(async () => (await sdk.session.get({ sessionID }).then((res) => res.data?.summary?.files)) ?? 0, {
timeout: 120_000,
})
.poll(
async () => {
const diff = await sdk.session.diff({ sessionID }).then((res) => res.data ?? [])
return diff.length
},
{ timeout: 120_000 },
)
.toBeGreaterThan(0)
}

View File

@ -14,7 +14,6 @@ import type {
import type { State, VcsCache } from "./types"
import { trimSessions } from "./session-trim"
import { dropSessionCaches } from "./session-cache"
import { sanitizeProject } from "./utils"
const SKIP_PARTS = new Set(["patch", "step-start", "step-finish"])
@ -34,12 +33,12 @@ export function applyGlobalEvent(input: {
const result = Binary.search(input.project, properties.id, (s) => s.id)
if (result.found) {
input.setGlobalProject((draft) => {
draft[result.index] = sanitizeProject({ ...draft[result.index], ...properties })
draft[result.index] = { ...draft[result.index], ...properties }
})
return
}
input.setGlobalProject((draft) => {
draft.splice(result.index, 0, sanitizeProject(properties))
draft.splice(result.index, 0, properties)
})
}

View File

@ -27,21 +27,13 @@ export function normalizeProviderList(input: ProviderListResponse): ProviderList
}
export function sanitizeProject(project: Project) {
if (!project.icon?.url && !project.icon?.override) return project
return {
...project,
commands: project.commands
? {
...project.commands,
}
: undefined,
icon: {
...project.icon,
url: undefined,
override: undefined,
},
sandboxes: [...(project.sandboxes ?? [])],
time: {
...project.time,
},
}
}