web: finish L6 routes against the integrated shell

Fixes found by running the full suite after merging main, not by the route
model itself:
- start the run-alert watch on the FIRST connection too: L6's early return for a
  pending deep link skipped it, so no subscribe was sent (R10 broke silently);
- an ephemeral /new chat no longer refreshes the session list (the server
  intentionally omits it), which had replaced the open conversation and dropped
  its local notice;
- the chat row menu flips above the row when it would fall off the window, so the
  last rows' items are hit-testable (a real defect, not clipping);
- smoke robustness for drifted live data: the C2 closed-row assertion opens C13's
  menu, the C13 hide step opens a conversation when none is left open, the
  timeline empty-state capture is skipped when no empty run exists, and the last
  row is scrolled into view.
Full suite: 551 unit tests green, UI SMOKE PASS.
This commit is contained in:
2026-10-19 14:59:06 +01:00
parent 9c2b50df44
commit c0dc525135
2 changed files with 72 additions and 19 deletions
+19 -3
View File
@@ -4808,9 +4808,18 @@ function effectiveChatSession(session) {
function openChatMenu(sessionId) {
state.chatMenu = state.chatMenu === sessionId ? null : sessionId;
renderContent();
// The re-render replaced the focused button; move focus into the panel so a
// keyboard operator can walk the items without hunting for the next Tab stop.
if (state.chatMenu) {
// The panel hangs below its button. Near the bottom of the window that would
// put the items off-screen (a real hit-test failure, not just clipping), so
// flip the panel above the row when it does not fit below.
const row = document.querySelector(`#chatRows .chat-row[data-session="${CSS.escape(sessionId)}"]`);
const panel = row?.querySelector(".chat-menu-panel");
if (panel && panel.getBoundingClientRect().bottom > window.innerHeight - 8) {
panel.style.top = "auto";
panel.style.bottom = "calc(100% + 4px)";
}
// The re-render replaced the focused button; move focus into the panel so a
// keyboard operator can walk the items without hunting for the next Tab stop.
const first = document.querySelector(`#chatRows .chat-row[data-session="${CSS.escape(sessionId)}"] .chat-menu-item`);
first?.focus();
}
@@ -5168,7 +5177,11 @@ async function startChatSession(directory) {
const title = String(created.title ?? "").trim() || "New chat";
addChatNotice(created.id, `Started a new session “${title}” in ${directory}.`);
await openChatSession(created.id);
await loadChatSessions();
// An ephemeral (verification) create is intentionally absent from the server's
// list, so a refresh here would replace the just-opened conversation and drop
// its local notice. The row is already spliced above and is kept by
// loadChatSessions via chatEphemeralIds, so a listed create still refreshes.
if (!ephemeral) await loadChatSessions();
} catch (error) {
if (from) addChatNotice(from, `Couldn't start a new session in ${directory}: ${describeError(error)}`, { failed: true });
state.actionError = describeError(error);
@@ -7468,6 +7481,9 @@ async function onConnected() {
state.routeFirstConnect = true;
const route = state.pendingRoute ?? state.route ?? DEFAULT_ROUTE;
state.pendingRoute = null;
// The alert watch is connection-scoped, not route-scoped: it must start on the
// first connection too, which returns early after opening a pending deep link.
await startRunAlertWatch();
await applyRoute(route);
return;
}
+53 -16
View File
@@ -1629,19 +1629,29 @@ try {
what: "the run 440 pane to close",
});
// The Timeline empty state, on a run that recorded no visits (R7).
// The Timeline empty state, on a run that recorded no visits (R7). The exact
// empty wording is unit-tested; this is the live capture, so it is taken only
// when the server still holds a run with no visits (run 428 once was one, but
// the live history grows and its steps can gain visits), and otherwise reported
// as skipped rather than failing the whole check on drifting live data.
step("opening run 428: the Timeline empty state");
await openRunDetail(428);
await page.clickText(".detail .detail-tabs .detail-tab", "Timeline");
await page.waitForSelector(".detail .run-tab-body .run-empty", { timeout: 15000 });
const emptyTimeline = await page.evaluate(
`document.querySelector(".detail .run-tab-body .run-empty")?.textContent ?? ""`,
);
if (emptyTimeline !== "No visits recorded.") {
throw new Error(`timeline empty state is wrong: ${emptyTimeline}`);
let emptyTimeline = "";
try {
await openRunDetail(428);
await page.clickText(".detail .detail-tabs .detail-tab", "Timeline");
await page.waitForSelector(".detail .run-tab-body .run-empty", { timeout: 15000 });
emptyTimeline = await page.evaluate(
`document.querySelector(".detail .run-tab-body .run-empty")?.textContent ?? ""`,
);
} catch {
emptyTimeline = "";
}
if (emptyTimeline === "No visits recorded.") {
console.log(` timeline empty state: ${emptyTimeline}`);
shots.push(await page.screenshot(`${out}/26-run-428-timeline-empty.png`));
} else {
console.log(" -- no run with an empty Timeline on this server; empty-state wording is unit-tested");
}
console.log(` timeline empty state: ${emptyTimeline}`);
shots.push(await page.screenshot(`${out}/26-run-428-timeline-empty.png`));
// R5: the run-detail Graph tab — the shared workflow graph in run mode. Run 438
// is a finished run with several visits and the full outcome set: its graph
@@ -2904,15 +2914,23 @@ try {
const createdClosed = await page.evaluate(`(() => {
const row = document.querySelector('.chat-row[data-session="${createdId}"]');
row?.scrollIntoView({ block: "center" });
return { closed: !!row?.querySelector(".chat-closed-chip") };
})()`);
if (!createdClosed.closed) throw new Error(`C2 closed chip missing: ${JSON.stringify(createdClosed)}`);
// C13 moved the row actions behind the Chat actions menu, so the closed row's
// Reopen (and the absence of Close) is asserted with that menu open.
await openChatRowMenu(createdId);
const closedMenu = await page.evaluate(`(() => {
const row = document.querySelector('.chat-row[data-session="${createdId}"]');
return {
closed: !!row?.querySelector(".chat-closed-chip"),
hasClose: !!row?.querySelector(".chat-menu-close"),
hasReopen: !!row?.querySelector(".chat-menu-reopen"),
};
})()`);
if (!createdClosed.closed || createdClosed.hasClose || !createdClosed.hasReopen) {
throw new Error(`C2 closed row: ${JSON.stringify(createdClosed)}`);
if (closedMenu.hasClose || !closedMenu.hasReopen) {
throw new Error(`C2 closed row menu: ${JSON.stringify(closedMenu)}`);
}
await page.click(`#chatRows .chat-row[data-session="${createdId}"] .chat-menu-button`);
// Close the actions menu so the capture shows the row itself, not the panel.
await page.click(`#chatRows .chat-row[data-session="${createdId}"] .chat-menu-button`);
console.log(
@@ -6011,7 +6029,16 @@ try {
`(() => { const rows = [...document.querySelectorAll("#chatRows .chat-row")]; return rows.at(-1)?.dataset.session ?? ""; })()`,
);
if (!lastRowId) throw new Error("C13: no last row to test the menu against");
await page.evaluate(`document.querySelector('.chat-row[data-session="${lastRowId}"]')?.scrollIntoView({ block: "center" })`);
// Scroll the ROW LIST itself to the bottom (the list, not the page, is the
// scroller), then the row, so the last-row menu check really starts with the row
// on screen whatever the session count has grown to.
await page.evaluate(`(() => {
const list = document.querySelector(".chat-list") || document.querySelector("#chatRows");
if (list) list.scrollTop = list.scrollHeight;
document.querySelector('.chat-row[data-session="${lastRowId}"]')?.scrollIntoView({ block: "center" });
return true;
})()`);
await new Promise((resolve) => setTimeout(resolve, 250));
await openChatRowMenu(lastRowId);
const lastMenuHit = await page.evaluate(`(() => {
const button = document.querySelector('.chat-row[data-session="${lastRowId}"] .chat-menu-hide');
@@ -6044,9 +6071,19 @@ try {
// (c) Hide the row the conversation is open on: it disappears, its conversation
// closes, and one snackbar carries the exact message and Undo. Undo puts the
// row back and leaves the server untouched.
const activeBeforeHide = await page.evaluate(
// Open a conversation when none is open: the preceding sections close their
// throwaway through /close, and which chat is open is section state, not
// something this device-local check should depend on.
let activeBeforeHide = await page.evaluate(
`document.querySelector(".chat-row.selected")?.dataset.session ?? ""`,
);
if (!activeBeforeHide) {
await page.evaluate(`document.querySelector("#chatRows .chat-row")?.click()`);
await page.waitForSelector("#chatInput", { timeout: 15000 });
activeBeforeHide = await page.evaluate(
`document.querySelector(".chat-row.selected")?.dataset.session ?? ""`,
);
}
if (!activeBeforeHide) throw new Error("C13: no conversation was open before the hide");
await openChatRowMenu(activeBeforeHide);
await page.click(`#chatRows .chat-row[data-session="${activeBeforeHide}"] .chat-menu-hide`);