fix(console): bound retained history reconciliation
This commit is contained in:
@@ -64,6 +64,7 @@ function historyPage(indices: number[], cursor: string | null) {
|
||||
page: {
|
||||
session_id: "session-a",
|
||||
lineage_id: "lineage-a",
|
||||
compact_ancestor_lineage_ids: [],
|
||||
turns: indices.map((index) => ({
|
||||
turn_id: `user-${index}`,
|
||||
entries: [historyEntry(index, "user"), historyEntry(index, "assistant")],
|
||||
@@ -162,7 +163,7 @@ Deno.serve({ hostname: "127.0.0.1", port }, async (request) => {
|
||||
) {
|
||||
return json({
|
||||
availability: "retained_snapshot",
|
||||
identity: { session_id: "session-a", segment_id: "segment-a", entry_count: 0 },
|
||||
identity: { session_id: "session-a", segment_id: "segment-a", entry_count: 12 },
|
||||
snapshot: {
|
||||
pending_submissions: {
|
||||
revision: 0,
|
||||
@@ -170,7 +171,10 @@ Deno.serve({ hostname: "127.0.0.1", port }, async (request) => {
|
||||
head_id: null,
|
||||
submissions: [],
|
||||
},
|
||||
entries: [],
|
||||
entries: [7, 8, 9, 10, 11, 12].flatMap((index) => [
|
||||
historyEntry(index, "user"),
|
||||
historyEntry(index, "assistant"),
|
||||
]),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,10 +98,20 @@ Deno.test("production Console pages backward by real turns while preserving both
|
||||
);
|
||||
}
|
||||
const navigation = page.getByRole("complementary", { name: "Conversation turns" });
|
||||
await navigation.getByText("question 8", { exact: true }).waitFor();
|
||||
await navigation.getByText("question 7", { exact: true }).waitFor();
|
||||
assertEquals(await historyRequestCount(baseUrl), 1);
|
||||
assertEquals(await transcript.getByText(/^question (8|9|10|11|12)$/).count(), 5);
|
||||
assertEquals(await navigation.getByText(/^question (8|9|10|11|12)$/).count(), 5);
|
||||
assertEquals(await transcript.getByText(/^question (7|8|9|10|11|12)$/).count(), 6);
|
||||
assertEquals(await navigation.getByText(/^question (7|8|9|10|11|12)$/).count(), 6);
|
||||
const currentQuestionTop = await transcript
|
||||
.getByText("question 7", { exact: true })
|
||||
.evaluate((element) => element.getBoundingClientRect().top);
|
||||
const retainedQuestionTop = await transcript
|
||||
.getByText("question 8", { exact: true })
|
||||
.evaluate((element) => element.getBoundingClientRect().top);
|
||||
assert(
|
||||
currentQuestionTop < retainedQuestionTop,
|
||||
"the unmatched current-snapshot turn must precede overlapping retained history",
|
||||
);
|
||||
|
||||
const question12 = navigation.getByRole("button", {
|
||||
name: "Jump to conversation: question 12",
|
||||
|
||||
Reference in New Issue
Block a user