|
8 | 8 | withOpenClawTestState, |
9 | 9 | type OpenClawTestState, |
10 | 10 | } from "../../test-utils/openclaw-test-state.js"; |
| 11 | +import { listSessionBranches } from "./session-accessor.js"; |
11 | 12 | import { loadExactSessionEntry } from "./session-accessor.sqlite-entry.js"; |
12 | 13 | import { |
13 | 14 | importSqliteSessionRows, |
@@ -197,10 +198,16 @@ it("hands off exact SQLite bytes, duplicate IDs, timestamps and owner without ap |
197 | 198 | await withOpenClawTestState({ label: "import-exact" }, async (state) => { |
198 | 199 | const params = target(state, "exact"); |
199 | 200 | const owner = { actor: { type: "human" as const, id: "owner" }, assignedAt: 40 }; |
| 201 | + const firstMessage = { ...message, timestamp: "2026-08-30T00:00:01.000Z" }; |
| 202 | + const canonicalMessage = { |
| 203 | + ...message, |
| 204 | + timestamp: "2026-08-30T00:00:02.000Z", |
| 205 | + message: { role: "user", content: "canonical duplicate" }, |
| 206 | + }; |
200 | 207 | const rows = [ |
201 | 208 | { createdAt: 41, eventJson: '{ "type": "session", "id": "exact", "version": 3 }' }, |
202 | | - { createdAt: 43, eventJson: JSON.stringify(message, null, 2) }, |
203 | | - { createdAt: 45, eventJson: JSON.stringify(message) }, |
| 209 | + { createdAt: 43, eventJson: JSON.stringify(firstMessage, null, 2) }, |
| 210 | + { createdAt: 45, eventJson: JSON.stringify(canonicalMessage) }, |
204 | 211 | ]; |
205 | 212 | await importSqliteSessionRows({ |
206 | 213 | ...params, |
@@ -231,6 +238,16 @@ it("hands off exact SQLite bytes, duplicate IDs, timestamps and owner without ap |
231 | 238 | }), |
232 | 239 | ).toMatchObject({ skippedExisting: true, transcriptEvents: 0 }); |
233 | 240 | expect(loadTranscriptEventsSync({ ...params, sessionId: "exact" })).toHaveLength(3); |
| 241 | + await expect(listSessionBranches(params)).resolves.toEqual({ |
| 242 | + status: "ok", |
| 243 | + branches: Array.from({ length: 2 }, () => ({ |
| 244 | + leafEntryId: "one", |
| 245 | + headline: "canonical duplicate", |
| 246 | + messageCount: 1, |
| 247 | + updatedAt: canonicalMessage.timestamp, |
| 248 | + active: true, |
| 249 | + })), |
| 250 | + }); |
234 | 251 | }); |
235 | 252 | }); |
236 | 253 |
|
|
0 commit comments