web: attention / "Needs you" surface — bell, sheet, dismissals (R15, R2)

This commit is contained in:
2026-10-19 04:52:34 +01:00
parent 9555bfe58f
commit f3bc6ed126
6 changed files with 1107 additions and 5 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu
| # | Feature | Protocol | Status |
| --- | --- | --- | --- |
| R1 | Run history list with status roll-up | `list_runs` | done |
| R2 | Filter by status, sort, "needs you" markers | client-side | partial (status/pipeline/time filter + sort implemented and captured; the per-row "needs you" mark has no Android counterpart and its wording is deferred to R15, still todo) |
| R2 | Filter by status, sort, "needs you" markers | client-side | done — status/pipeline/time filter + sort implemented and captured (`captures/09-runs-day-groups.png`–`captures/15-runs-sorted.png`); the "needs you" requirement is delivered exactly as the app does it: a bell/badge + sheet (R15), not a per-row mark. No other R2 work is outstanding |
| R3 | Run detail: run fields, steps/visits, targets, sessions | `get_run` | done — tabbed Summary / Graph / Input / Output / Timeline; the Timeline opens a per-visit stage pane with the headline rows (Status, Outcome, Duration, Visit `{v} / {max}`, Model target, Target, Session), the Verdict block (option chip + reason with inline artifact links) and the visit sections Artifacts / Session / Output / Input / This run / Stage definition. Captured 2026-10-19: `captures/20-run-430-summary.png`, `captures/23-run-430-timeline.png`, `captures/24-run-430-stage-artifacts.png`, `captures/25-run-440-verdict.png` |
| R4 | Summary tab incl. collapsible **Changes** viewer (raw + rendered diff) | `get_run` file changes | done — a collapsed-by-default **Changes** section in the Summary tab (`{N} file(s) changed · ±stat · partial capture`; the empty variants read `Changes · capture unavailable` / `capture pending` / `partial capture` / `not recorded for this run` / `capture incomplete` / `no changes observed`) whose rows open a full-screen diff viewer with **Rendered** (each `@@` hunk header on a raised surface, old/new gutter numbers, the shared `+`/`-`/space line language) and **Raw patch** forms, Previous/Next file paging (disabled at the ends), a raw-patch copy control, Escape/backdrop/Close close, and honest binary/truncated/no-patch messages instead of a fabricated diff. Pure logic in `src/changes.js`. Captured 2026-10-19: `captures/28-run-438-changes-collapsed.png`, `captures/29-run-438-changes-expanded.png`, `captures/30-run-438-changes-diff-rendered.png`, `captures/31-run-438-changes-diff-raw.png`, `captures/32-run-442-changes-binary.png`, `captures/33-run-450-changes-truncated.png`, `captures/34-run-455-changes-pending.png` |
| R5 | Graph tab (per-stage panes, verdicts) | `get_run` | done — the run detail's Graph tab (between Summary and Input) mounts the shared `src/graph.js` renderer in run mode with the app's run note: a visited stage is executed (solid fill + border), an unvisited one hollow with a dashed muted border, a terminal executed only when a visit resolved to it, a route executed only when a visit produced that outcome (solid with an arrowhead; success first, error last, others alphabetical, `error*` for a fallback error route), the Executed / Not executed legend (runs only, never the definition view), and — while executing — the current stage's pulsing halo + elapsed badge (a static ring under `prefers-reduced-motion`; nothing for a finished run). Clicking a stage opens the existing visit pane at that stage's latest visit with its Verdict; Back/Escape close it and restore focus. The empty state is the exact `This server did not include the run graph.` (unit-tested; no live run currently carries a graph-less payload). Captured 2026-10-19: `captures/28-run-438-graph.png` (finished run 438: legend + executed styling + dashed untaken routes), `captures/29-run-438-graph-pane.png` (a graph-opened stage pane showing a Verdict), `captures/30-run-440-graph.png` (failed run 440: hollow/dashed not-executed stages) |
@@ -45,7 +45,7 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu
| R12 | Cancel run | `cancel_run` | todo |
| R13 | Retry failed stage (resume) / restart from start | `retry_run` | todo |
| R14 | Rename a run | `set_run_title` | todo |
| R15 | Attention / "Needs you" surface: counts, open, individual dismiss, clear all | derived from `list_runs` + run events | todo |
| R15 | Attention / "Needs you" surface: counts, open, individual dismiss, clear all | derived from `list_runs` + run events | done — the pure `src/attention.js` model mirrors `ui/Attention.kt` and feeds a bell action in the top bar (badge only when non-empty; accessible name `Notifications` / `Notifications, {n} needing attention`) and a bottom sheet titled `Needs you` in `src/app.js`. Only a `waiting` run (kind Decision, rank 0) and a `failed` run (kind Failed, rank 1) qualify; order is kind rank, then recency descending (`finished_at` else `created_at`), then run id descending. Rows carry a status icon, the trimmed-title-else-pipeline label, the exact `{pipeline} · {detail}` line (`Waiting for your decision`, or the trimmed diagnostic else `Run failed`) and a trailing `Dismiss`; tapping a row opens the run, dismissing a Failed row first while a Decision row is left for its answer. Clear all acts only on the snapshot taken when the sheet opened; dismissals persist as one JSON array of `{runId}:{kind}` identities under `pipelines.web.attention.v1` with no expiry (blank/unreadable storage decodes to empty and never throws). Entries are derived from `list_runs` here; R10 will feed the same pure model the pushed `run_event` summaries, with no wording or ordering change. Captured 2026-10-19: `captures/35-attention-bell.png` (bell + badge on the Runs list), `captures/36-attention-sheet.png` (the open sheet), `captures/37-attention-dismissed.png` (one entry individually dismissed, badge 171→170), `captures/38-attention-cleared.png` (Clear all: the empty copy, no Clear all, badge gone). No run was parked in `waiting` on the live server at capture time, so the sheet is exercised with real failed runs and the decision-open path is unit-tested |
Two wording decisions in R3's stage pane, recorded here as the app-authoritative
choice: the visit's exported session is titled **Session** (the item text said
+277 -3
View File
@@ -133,6 +133,18 @@ import {
runChangesHeader,
runChangesNote,
} from "./changes.js";
import {
ATTENTION_STORAGE_KEY,
AttentionKind,
attentionBadgeLabel,
attentionDismissAll,
attentionDismiss,
attentionDismissalSnapshot,
attentionEntries,
attentionRowDescription,
decodeAttentionDismissals,
encodeAttentionDismissals,
} from "./attention.js";
const STORAGE_KEY = "pipelines.web.serverUrl.v2";
@@ -209,6 +221,14 @@ const state = {
runSections: new Set(),
runStagePane: null,
runStageSections: new Set(),
// The attention / "Needs you" surface (R15). `attentionDismissed` is the set
// of `{runId}:{kind}` identities the operator has explicitly dealt with, loaded
// once at boot from localStorage. `attentionSheetOpen` drives the sheet and
// `attentionSnapshot` holds the entries captured when it opened, so Clear all
// only ever removes identities the operator actually saw.
attentionDismissed: new Set(),
attentionSheetOpen: false,
attentionSnapshot: null,
};
let runPoll = null;
@@ -260,7 +280,10 @@ const header = h("header", { class: "topbar" });
// the header (never fixed/overlaying), so it can never cover the content.
const connBanner = h("div", { id: "connBanner", class: "conn-banner", hidden: true });
const content = h("main", { id: "content" });
document.body.append(header, connBanner, content);
// The attention sheet lives in its own layer so it can overlay any view without
// being torn down by a content re-render; renderAttentionSheet rebuilds it.
const attentionLayer = h("div", { id: "attentionLayer" });
document.body.append(header, connBanner, content, attentionLayer);
/** Whether the URL field currently holds a usable endpoint for Reconnect. */
function endpointConfigured() {
@@ -297,11 +320,77 @@ function renderHeader() {
h("span", { class: "state", id: "stateBadge" }, connectionLabel()),
);
header.replaceChildren(
h("div", { class: "brand" }, h("strong", { text: "Pipelines" }), h("span", { class: "muted", text: "web spike" })),
h(
"div",
{ class: "brand" },
h("strong", { text: "Pipelines" }),
h("span", { class: "muted", text: "web spike" }),
renderAttentionBell(),
),
h("div", { class: "connbar" }, ...controls),
);
}
/**
* The attention bell action, shown in the top bar on every view (R15). Its
* accessible name comes from `attentionBadgeLabel`; the visible badge is drawn
* only when something genuinely needs the operator, and the count comes from the
* same pure model the sheet reads.
*/
function renderAttentionBell() {
const count = attentionCount();
const label = attentionBadgeLabel(count);
const button = h("button", {
id: "attentionBell",
class: "attention-bell",
type: "button",
"aria-label": label,
title: label,
onclick: openAttentionSheet,
});
button.append(h("span", { class: "attention-bell-glyph", "aria-hidden": "true", text: "\uD83D\uDD14" }));
if (count > 0) {
button.append(
h("span", {
class: "attention-badge",
"aria-hidden": "true",
"data-count": String(count),
text: String(count),
}),
);
}
return button;
}
/** The number of entries the attention surface currently holds. */
function attentionCount() {
return attentionEntries(state.runs, state.attentionDismissed).length;
}
/**
* Update the bell in place after the run list (which the surface derives from)
* loads, without rebuilding the header and disturbing the URL field.
*/
function refreshAttentionBell() {
const button = document.querySelector("#attentionBell");
if (!button) return;
const count = attentionCount();
const label = attentionBadgeLabel(count);
button.setAttribute("aria-label", label);
button.title = label;
let badge = button.querySelector(".attention-badge");
if (count > 0) {
if (!badge) {
badge = h("span", { class: "attention-badge", "aria-hidden": "true" });
button.append(badge);
}
badge.dataset.count = String(count);
badge.textContent = String(count);
} else if (badge) {
badge.remove();
}
}
/**
* The persistent connection banner. Its copy/tone come from the pure
* `bannerState`, and it also carries the last server build and a protocol
@@ -327,10 +416,183 @@ function connectionLabel() {
return h("span", { class: `dot ${info.tone}`, text: info.text });
}
// --- Attention / "Needs you" surface (R15) ---------------------------------
/**
* The attention sheet: the ordered list from the pure `attentionEntries` model,
* opened from the bell in the top bar. It is a single managed dialog — Escape,
* a backdrop click and the Close button all close it — with the exact app
* wording: title `Needs you`, rows of status icon + the run label + the
* `{pipeline} · {detail}` line + a trailing `Dismiss`, and the empty state
* `Nothing needs you right now.` with no Clear all.
*
* `state.attentionSnapshot` is captured only when the sheet opens and kept until
* it closes, so Clear all acts on what the operator actually saw and an entry
* that arrives while it is open is shown but not cleared.
*/
function renderAttentionSheet() {
if (!state.attentionSheetOpen) {
attentionLayer.replaceChildren();
return;
}
const entries = attentionEntries(state.runs, state.attentionDismissed);
const overlay = h("div", {
class: "attention-sheet",
role: "dialog",
"aria-modal": "true",
"aria-label": "Needs you",
});
overlay.addEventListener("click", (event) => {
if (event.target === overlay) closeAttentionSheet();
});
const head = h(
"div",
{ class: "attention-sheet-head" },
h("h2", { class: "attention-sheet-title", text: "Needs you" }),
h("button", {
class: "attention-sheet-close",
type: "button",
text: "Close",
onclick: () => closeAttentionSheet(),
}),
);
const body = h("div", { class: "attention-sheet-body" });
if (entries.length === 0) {
body.append(h("p", { class: "attention-empty", text: "Nothing needs you right now." }));
} else {
body.append(
h("button", {
class: "attention-clear",
type: "button",
text: "Clear all",
onclick: clearAttentionSheet,
}),
);
for (const entry of entries) body.append(renderAttentionRow(entry));
}
const sheet = h("div", { class: "attention-sheet-panel", tabindex: "-1" }, head, body);
overlay.append(sheet);
attentionLayer.replaceChildren(overlay);
}
/** One attention row: status icon, the two text lines, and a trailing Dismiss. */
function renderAttentionRow(entry) {
const glyphState = entry.kind === AttentionKind.Decision ? "waiting" : "failed";
const open = h(
"button",
{
class: "attention-row-open",
type: "button",
"data-run-id": String(entry.runId),
"data-kind": entry.kind.name.toLowerCase(),
onclick: () => activateAttentionEntry(entry),
},
h("span", {
class: `attention-icon chip-${glyphState}`,
"aria-hidden": "true",
text: stateGlyph(glyphState),
}),
h(
"span",
{ class: "attention-text" },
h("span", { class: "attention-label", text: entry.label }),
h("span", { class: "attention-desc", text: attentionRowDescription(entry) }),
),
);
const dismiss = h("button", {
class: "attention-dismiss",
type: "button",
"aria-label": "Dismiss",
title: "Dismiss",
onclick: (event) => {
// The trailing control must never activate the row it sits in.
event.stopPropagation();
dismissAttentionEntries([entry]);
},
});
dismiss.append(h("span", { "aria-hidden": "true", text: "\u2715" }));
return h("div", { class: "attention-row", "data-key": entry.key }, open, dismiss);
}
/** Open the sheet, capturing the dismissal snapshot it will act on. */
function openAttentionSheet() {
state.attentionSheetOpen = true;
state.attentionSnapshot = attentionDismissalSnapshot(
attentionEntries(state.runs, state.attentionDismissed),
);
render();
document.querySelector(".attention-sheet-close")?.focus();
}
/** Close the sheet, dropping the snapshot; focus returns to the bell. */
function closeAttentionSheet({ restoreFocus = true } = {}) {
if (!state.attentionSheetOpen) return;
state.attentionSheetOpen = false;
state.attentionSnapshot = null;
render();
if (restoreFocus) document.querySelector("#attentionBell")?.focus();
}
/** Dismiss one or more entries for good, persisting the identity set. */
function dismissAttentionEntries(entries) {
if (!entries?.length) return;
let next = new Set(state.attentionDismissed);
for (const entry of entries) next = attentionDismiss(next, entry.key);
persistAttentionDismissed(next);
render();
}
/** Clear all applies only the identities captured when the sheet opened. */
function clearAttentionSheet() {
const snapshot = state.attentionSnapshot ?? [];
const next = attentionDismissAll(state.attentionDismissed, snapshot);
persistAttentionDismissed(next);
render();
}
/**
* Activating a row closes the sheet and opens the run. A Failed row is dismissed
* first (opening it is the operator dealing with it); a Decision row is not —
* only answering the decision clears it.
*/
function activateAttentionEntry(entry) {
if (entry.kind === AttentionKind.Failed) {
persistAttentionDismissed(attentionDismiss(state.attentionDismissed, entry.key));
}
state.attentionSheetOpen = false;
state.attentionSnapshot = null;
state.view = "runs";
render();
selectRun(entry.runId);
}
/** Store the dismissed identities as one JSON array under one localStorage key. */
function persistAttentionDismissed(next) {
state.attentionDismissed = next;
try {
localStorage.setItem(ATTENTION_STORAGE_KEY, encodeAttentionDismissals(next));
} catch {
// Storage disabled or full: the in-memory set still applies for this session.
}
}
/** The dismissed identities from storage at boot; anything unreadable is empty. */
function loadAttentionDismissed() {
try {
return decodeAttentionDismissals(localStorage.getItem(ATTENTION_STORAGE_KEY));
} catch {
return new Set();
}
}
function render() {
renderHeader();
renderBanner();
renderContent();
renderAttentionSheet();
}
function renderContent() {
@@ -2366,6 +2628,9 @@ async function loadCurrentView(force = false) {
}
state.loading = false;
renderContent();
// The run list the attention surface derives from has just (re)loaded, so
// bring the bell's badge up to date.
refreshAttentionBell();
// Keep the current selection fresh after a refresh.
if (force && state.view === "runs" && state.selectedRunId) {
await selectRun(state.selectedRunId, { silent: true });
@@ -2543,10 +2808,16 @@ client.addEventListener("state", (event) => {
// The stage pane is a modal dialog: Escape closes it (a stacked overlay — the
// artifact viewer or the diff viewer, when either is above — owns Escape first).
// The attention sheet, when open, is the topmost overlay and owns Escape first.
// Registered once; it is a no-op when no pane is open.
document.addEventListener("keydown", (event) => {
if (event.key !== "Escape") return;
if (state.attentionSheetOpen) {
event.preventDefault();
closeAttentionSheet();
return;
}
if (
event.key === "Escape" &&
state.runStagePane &&
!document.querySelector(".artifact-viewer") &&
!document.querySelector(".change-viewer")
@@ -2565,4 +2836,7 @@ document.addEventListener("visibilitychange", () => {
window.addEventListener("online", onForegroundActive);
// Prefill from a previous session only; the user still confirms with Connect.
// The attention surface's dismissed identities are loaded once here, before the
// first render, so the bell's badge is correct from the very first paint.
state.attentionDismissed = loadAttentionDismissed();
render();
+209
View File
@@ -0,0 +1,209 @@
// Pure, DOM-free model for the browser client's attention / "Needs you" surface
// (R15). It mirrors android/.../ui/Attention.kt and the wording shown by
// ui/components/AttentionSurface.kt, so the browser's bell, its badge and the
// sheet read exactly what the app reads.
//
// The surface is derived here from the same `list_runs` summaries the runs list
// is folded from (and from any run state already in the page). R10, the live
// `run_event` fold, is a separate item: when it lands it will feed these same
// pure functions the pushed summaries, and neither the ordering nor the wording
// will change.
//
// Everything in this file is pure: no DOM, no clock, no storage. app.js keeps the
// wiring; a malformed stored value can never throw into the page because decode
// is total. Every server-provided string is only ever compared or rendered,
// never parsed as markup; the caller sets it with textContent.
// ---------------------------------------------------------------------------
// Kinds and qualification
// ---------------------------------------------------------------------------
/**
* The two things the attention surface ranks, most important first. The rank is
* what orders the list; the name is what a dismissal identity is keyed by.
*/
export const AttentionKind = Object.freeze({
Decision: Object.freeze({ name: "Decision", rank: 0 }),
Failed: Object.freeze({ name: "Failed", rank: 1 }),
});
/**
* The attention kind a run status maps to, or null when the run needs nobody. It
* reads the server's own words only (trimmed/lowercased `waiting` and `failed`),
* so queued, running, succeeded, canceled, interrupted and any unknown status
* can never invent an entry.
*/
export function attentionKindOf(status) {
switch (String(status ?? "").trim().toLowerCase()) {
case "waiting":
return AttentionKind.Decision;
case "failed":
return AttentionKind.Failed;
default:
return null;
}
}
// ---------------------------------------------------------------------------
// Identity and wording
// ---------------------------------------------------------------------------
/** The identity of one run+kind entry; the unit an explicit dismissal removes. */
export function attentionKey(runId, kind) {
return `${runId}:${kind.name}`;
}
/**
* What one entry asks of the operator, in the operator's words. A failed run
* shows the server's own diagnostic when it recorded one so the line is
* actionable rather than a bare "failed".
*/
export function attentionDetail(kind, run) {
if (kind === AttentionKind.Decision) return "Waiting for your decision";
const diagnostic = String(run?.diagnostic ?? "").trim();
return diagnostic !== "" ? diagnostic : "Run failed";
}
/**
* The one-line secondary text for a row: the pipeline the run belongs to, then
* what it needs. Exactly `{pipeline} · {detail}`, as AttentionSurface.kt draws.
*/
export function attentionRowDescription(entry) {
return `${entry.pipeline} · ${entry.detail}`;
}
/**
* The bell action's accessible name: the bare `Notifications` when nothing needs
* the operator, else the count. The visible badge is drawn only in the second
* case, from the same count.
*/
export function attentionBadgeLabel(count) {
const n = Number(count) || 0;
return n > 0 ? `Notifications, ${n} needing attention` : "Notifications";
}
// ---------------------------------------------------------------------------
// The ordered list
// ---------------------------------------------------------------------------
/**
* The ordered attention list. Every run that needs the operator becomes one
* entry, ranked by kind (decision, then failure), then newest-first within a
* kind (its finish time else its creation time, as the server wrote it), then by
* run id descending so the order is stable and never reshuffles between reads.
* An entry the operator explicitly dismissed never returns. A run status that
* asks nobody is dropped, so the surface can only ever hold actionable work.
*/
export function attentionEntries(runs, dismissed) {
const dismissedKeys =
dismissed instanceof Set ? dismissed : new Set(Array.isArray(dismissed) ? dismissed : []);
return (runs ?? [])
.map((run) => {
const kind = attentionKindOf(run?.status);
if (!kind) return null;
const key = attentionKey(run.id, kind);
if (dismissedKeys.has(key)) return null;
const title = String(run.title ?? "").trim();
const finished = String(run.finished_at ?? "");
return {
runId: run.id,
pipeline: String(run.name ?? ""),
label: title !== "" ? title : String(run.name ?? ""),
kind,
detail: attentionDetail(kind, run),
recency: finished.trim() !== "" ? finished : String(run.created_at ?? ""),
key,
};
})
.filter((entry) => entry != null)
.sort(
(a, b) =>
a.kind.rank - b.kind.rank ||
descendingText(a.recency, b.recency) ||
(b.runId > a.runId ? 1 : b.runId < a.runId ? -1 : 0),
);
}
/**
* Captures the entries shown when the sheet opens. Bulk dismissal uses this
* snapshot so entries that arrive while the sheet is open are not removed. A
* defensive copy, so the live list can never mutate what Clear all will apply.
*/
export function attentionDismissalSnapshot(entries) {
return [...(entries ?? [])];
}
// ---------------------------------------------------------------------------
// Dismissal bookkeeping
// ---------------------------------------------------------------------------
/** Adds one identity to the dismissed set, ignoring a blank or already-present key. */
export function attentionDismiss(dismissed, key) {
const next = new Set(dismissed instanceof Set ? dismissed : []);
if (String(key ?? "") !== "") next.add(key);
return next;
}
/**
* Unions a snapshot's identities into the dismissed set. Only the identities in
* the snapshot are added, so an entry that arrived after the sheet opened (and
* is therefore not in the snapshot) is left alone. This is what Clear all does.
*/
export function attentionDismissAll(dismissed, snapshot) {
const next = new Set(dismissed instanceof Set ? dismissed : []);
for (const entry of snapshot ?? []) {
if (entry?.key) next.add(entry.key);
}
return next;
}
// ---------------------------------------------------------------------------
// Persistence
// ---------------------------------------------------------------------------
/**
* The single localStorage key the dismissed identities live under: one JSON
* array of `{runId}:{kind}` strings, with no expiry or TTL of any kind.
*/
export const ATTENTION_STORAGE_KEY = "pipelines.web.attention.v1";
/**
* The one-line JSON a dismissed set is stored as: a JSON array of strings. The
* array is sorted so an unchanged set always encodes to the same bytes.
*/
export function encodeAttentionDismissals(dismissed) {
const keys = [...(dismissed instanceof Set ? dismissed : [])].filter(
(key) => typeof key === "string" && key !== "",
);
keys.sort();
return JSON.stringify(keys);
}
/**
* Decodes a stored value into a dismissed set. Total: blank, unreadable JSON, a
* non-array value and non-string members all decode to empty, so a malformed
* value can never throw into the page.
*/
export function decodeAttentionDismissals(stored) {
const text = stored == null ? "" : String(stored).trim();
if (text === "") return new Set();
let parsed;
try {
parsed = JSON.parse(text);
} catch {
return new Set();
}
if (!Array.isArray(parsed)) return new Set();
return new Set(parsed.filter((key) => typeof key === "string" && key !== ""));
}
// ---------------------------------------------------------------------------
// Internals
// ---------------------------------------------------------------------------
/** Descending compare of two strings, matching the app's `thenByDescending`. */
function descendingText(a, b) {
if (a < b) return 1;
if (a > b) return -1;
return 0;
}
+115
View File
@@ -1028,3 +1028,118 @@ code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-
.diff-add { color: var(--ok); }
.diff-remove { color: var(--bad); }
.diff-context { color: var(--muted); }
/* ---------------------------------------------------------------------------
Attention / "Needs you" surface (R15): the header bell with its conditional
badge, and the bottom sheet of everybody a run needs. Hand-written, dark
palette; the sheet is responsive and echoes the app's ModalBottomSheet.
--------------------------------------------------------------------------- */
.attention-bell {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 5px 9px;
margin-left: 6px;
background: transparent;
border-color: transparent;
line-height: 1;
}
.attention-bell-glyph { font-size: 15px; }
.attention-badge {
position: absolute;
top: -4px;
right: -4px;
min-width: 16px;
height: 16px;
padding: 0 4px;
border-radius: 999px;
background: var(--bad);
color: #1b0b0b;
font-size: 11px;
font-weight: 700;
line-height: 16px;
text-align: center;
}
.attention-sheet {
position: fixed;
inset: 0;
z-index: 30;
display: flex;
align-items: flex-end;
justify-content: center;
background: rgba(0, 0, 0, 0.55);
}
.attention-sheet-panel {
display: flex;
flex-direction: column;
width: min(560px, 100%);
max-height: 80vh;
min-width: 0;
background: var(--surface);
border: 1px solid var(--border);
border-bottom: 0;
border-radius: 14px 14px 0 0;
box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
outline: none;
}
.attention-sheet-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
padding: 12px 14px 8px;
border-bottom: 1px solid var(--border);
}
.attention-sheet-title { margin: 0; font-size: 16px; }
.attention-sheet-close { background: transparent; }
.attention-sheet-body {
flex: 1;
overflow-y: auto;
padding: 10px 14px 16px;
display: grid;
gap: 8px;
align-content: start;
}
.attention-empty { margin: 4px 0; color: var(--muted); }
.attention-clear { justify-self: start; background: transparent; color: var(--accent); border-color: transparent; padding: 4px 0; }
.attention-row {
display: flex;
align-items: center;
gap: 10px;
border: 1px solid var(--border);
border-radius: 10px;
background: var(--surface-2);
padding: 4px 4px 4px 0;
}
.attention-row-open {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10px;
text-align: left;
background: transparent;
border: 0;
border-radius: 10px;
padding: 8px 6px 8px 12px;
}
.attention-icon { font-size: 15px; flex: 0 0 auto; }
.attention-text { display: grid; gap: 2px; min-width: 0; }
.attention-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-desc { color: var(--muted); font-size: 12px; }
.attention-dismiss {
flex: 0 0 auto;
background: transparent;
border-color: transparent;
color: var(--muted);
padding: 6px 10px;
}
.attention-dismiss:hover { color: var(--text); border-color: var(--border); }
@media (max-width: 760px) {
.attention-sheet-panel { width: 100%; max-height: 88vh; }
}
+284
View File
@@ -0,0 +1,284 @@
// Pure unit tests for the attention / "Needs you" model (R15): qualification,
// identity, wording, ordering and tie-breaks, dismissal filtering, the
// Clear-all snapshot semantics and the localStorage encoding. No server, no DOM.
import { test } from "node:test";
import assert from "node:assert/strict";
import {
ATTENTION_STORAGE_KEY,
AttentionKind,
attentionBadgeLabel,
attentionDetail,
attentionDismiss,
attentionDismissAll,
attentionDismissalSnapshot,
attentionEntries,
attentionKey,
attentionKindOf,
attentionRowDescription,
decodeAttentionDismissals,
encodeAttentionDismissals,
} from "../src/attention.js";
/** A run summary with every field the attention model reads. */
function run(overrides = {}) {
return {
id: 1,
name: "Plan and land",
title: null,
status: "failed",
created_at: "2026-10-19T10:00:00Z",
finished_at: "2026-10-19T10:05:00Z",
diagnostic: "",
...overrides,
};
}
// ---------------------------------------------------------------------------
// Qualification
// ---------------------------------------------------------------------------
test("only waiting and failed qualify; every other status never produces an entry", () => {
assert.equal(attentionKindOf("waiting"), AttentionKind.Decision);
assert.equal(attentionKindOf("failed"), AttentionKind.Failed);
for (const status of [
"queued",
"running",
"succeeded",
"canceled",
"cancelled",
"interrupted",
"active",
"blocked",
"skipped",
"unknown",
"",
" ",
null,
undefined,
"FAILED?",
]) {
assert.equal(attentionKindOf(status), null, `status ${JSON.stringify(status)} should not qualify`);
}
});
test("qualification trims and lowercases the server's own words", () => {
assert.equal(attentionKindOf(" Waiting "), AttentionKind.Decision);
assert.equal(attentionKindOf("Failed\n"), AttentionKind.Failed);
assert.equal(attentionKindOf("WAITING"), AttentionKind.Decision);
});
test("ranks are Decision 0 then Failed 1", () => {
assert.equal(AttentionKind.Decision.rank, 0);
assert.equal(AttentionKind.Failed.rank, 1);
});
// ---------------------------------------------------------------------------
// Identity and wording
// ---------------------------------------------------------------------------
test("identity is exactly {runId}:{kind}", () => {
assert.equal(attentionKey(440, AttentionKind.Failed), "440:Failed");
assert.equal(attentionKey(12, AttentionKind.Decision), "12:Decision");
});
test("detail is the fixed decision line and the trimmed diagnostic else Run failed", () => {
assert.equal(attentionDetail(AttentionKind.Decision, run()), "Waiting for your decision");
assert.equal(
attentionDetail(AttentionKind.Failed, run({ diagnostic: " boom " })),
"boom",
);
assert.equal(attentionDetail(AttentionKind.Failed, run({ diagnostic: " " })), "Run failed");
assert.equal(attentionDetail(AttentionKind.Failed, run({ diagnostic: "" })), "Run failed");
assert.equal(attentionDetail(AttentionKind.Failed, run({ diagnostic: null })), "Run failed");
});
test("label is the trimmed title else the pipeline name", () => {
const [titled] = attentionEntries([run({ title: " My run " })], new Set());
assert.equal(titled.label, "My run");
assert.equal(titled.pipeline, "Plan and land");
const [untitled] = attentionEntries([run({ title: " " })], new Set());
assert.equal(untitled.label, "Plan and land");
const [missing] = attentionEntries([run({ title: null })], new Set());
assert.equal(missing.label, "Plan and land");
});
test("row description is exactly {pipeline} · {detail}", () => {
const [entry] = attentionEntries([run({ title: "T", diagnostic: "failed hard" })], new Set());
assert.equal(attentionRowDescription(entry), "Plan and land · failed hard");
});
test("badge label is bare Notifications when empty, else the count", () => {
assert.equal(attentionBadgeLabel(0), "Notifications");
assert.equal(attentionBadgeLabel(-3), "Notifications");
assert.equal(attentionBadgeLabel(1), "Notifications, 1 needing attention");
assert.equal(attentionBadgeLabel(171), "Notifications, 171 needing attention");
});
// ---------------------------------------------------------------------------
// Ordering
// ---------------------------------------------------------------------------
test("orders by kind rank, then recency descending, then run id descending", () => {
const runs = [
run({ id: 10, status: "failed", finished_at: "2026-10-19T10:00:00Z" }),
run({ id: 11, status: "waiting", finished_at: "2026-10-19T09:00:00Z" }),
run({ id: 12, status: "failed", finished_at: "2026-10-19T11:00:00Z" }),
run({ id: 13, status: "waiting", finished_at: "2026-10-19T08:00:00Z" }),
];
const entries = attentionEntries(runs, new Set());
assert.deepEqual(
entries.map((entry) => entry.runId),
[11, 13, 12, 10],
);
});
test("recency falls back to created_at when finished_at is blank", () => {
const runs = [
run({ id: 1, status: "failed", finished_at: "", created_at: "2026-10-19T12:00:00Z" }),
run({ id: 2, status: "failed", finished_at: "2026-10-19T11:00:00Z" }),
];
const entries = attentionEntries(runs, new Set());
assert.deepEqual(entries.map((entry) => entry.runId), [1, 2]);
});
test("equal kind and recency break ties by run id descending and stay stable", () => {
const runs = [
run({ id: 3, status: "failed", finished_at: "2026-10-19T10:00:00Z" }),
run({ id: 9, status: "failed", finished_at: "2026-10-19T10:00:00Z" }),
run({ id: 5, status: "failed", finished_at: "2026-10-19T10:00:00Z" }),
];
const first = attentionEntries(runs, new Set()).map((entry) => entry.runId);
const second = attentionEntries([...runs].reverse(), new Set()).map((entry) => entry.runId);
assert.deepEqual(first, [9, 5, 3]);
assert.deepEqual(second, [9, 5, 3]);
});
test("non-qualifying runs are dropped entirely", () => {
const runs = [
run({ id: 1, status: "succeeded" }),
run({ id: 2, status: "running" }),
run({ id: 3, status: "failed" }),
run({ id: 4, status: "queued" }),
];
assert.deepEqual(
attentionEntries(runs, new Set()).map((entry) => entry.runId),
[3],
);
assert.deepEqual(attentionEntries(null, new Set()), []);
});
// ---------------------------------------------------------------------------
// Dismissal filtering
// ---------------------------------------------------------------------------
test("a dismissed identity is filtered out; a still-waiting dismissed entry never returns", () => {
const runs = [run({ id: 7, status: "waiting", title: "Wait" })];
const dismissed = new Set(["7:Decision"]);
assert.deepEqual(attentionEntries(runs, dismissed), []);
// Re-deriving from the same live list stays empty.
assert.deepEqual(attentionEntries(runs, dismissed), []);
});
test("a different kind for the same run is a different identity and still appears", () => {
const waiting = run({ id: 7, status: "waiting" });
const dismissed = new Set(["7:Decision"]);
assert.deepEqual(attentionEntries([waiting], dismissed), []);
// The same run later fails: a new kind, a new identity, a new entry.
const failed = run({ id: 7, status: "failed", diagnostic: "later failure" });
const entries = attentionEntries([failed], dismissed);
assert.equal(entries.length, 1);
assert.equal(entries[0].key, "7:Failed");
assert.equal(entries[0].detail, "later failure");
});
test("dismissing one kind leaves the other kind of the same run", () => {
const runs = [
run({ id: 7, status: "waiting" }),
run({ id: 7, status: "failed" }),
];
// Two entries for one run id, one per kind.
const both = attentionEntries(runs, new Set());
assert.equal(both.length, 2);
const afterDismiss = attentionEntries(runs, new Set(["7:Failed"]));
assert.deepEqual(afterDismiss.map((entry) => entry.kind), [AttentionKind.Decision]);
});
// ---------------------------------------------------------------------------
// Dismissal bookkeeping and the Clear-all snapshot
// ---------------------------------------------------------------------------
test("attentionDismiss adds a key once and ignores a blank key", () => {
const one = attentionDismiss(new Set(), "1:Failed");
assert.deepEqual([...one], ["1:Failed"]);
const again = attentionDismiss(one, "1:Failed");
assert.deepEqual([...again], ["1:Failed"]);
const blank = attentionDismiss(one, "");
assert.deepEqual([...blank], ["1:Failed"]);
});
test("clear all applies only the identities in the open snapshot", () => {
const [a] = attentionEntries([run({ id: 1, status: "failed" })], new Set());
const snapshot = attentionDismissalSnapshot([a]);
// A later entry (arrived while the sheet was open) is not in the snapshot.
const [b] = attentionEntries([run({ id: 2, status: "failed" })], new Set());
const after = attentionDismissAll(new Set(), snapshot);
assert.deepEqual([...after].sort(), ["1:Failed"]);
assert.equal(after.has(b.key), false);
// And it does not retroactively appear from the live set either.
assert.deepEqual(
attentionEntries([run({ id: 1, status: "failed" }), run({ id: 2, status: "failed" })], after).map(
(entry) => entry.runId,
),
[2],
);
});
test("the dismissal snapshot is a defensive copy", () => {
const [a, b] = attentionEntries(
[run({ id: 1, status: "failed" }), run({ id: 2, status: "failed" })],
new Set(),
);
const live = [a, b];
const snapshot = attentionDismissalSnapshot(live);
live.push(run({ id: 3, status: "failed" }));
live.reverse();
assert.deepEqual(
snapshot.map((entry) => entry.runId),
[a.runId, b.runId],
);
assert.notEqual(snapshot, live);
});
// ---------------------------------------------------------------------------
// Persistence
// ---------------------------------------------------------------------------
test("the storage key is the one documented key", () => {
assert.equal(ATTENTION_STORAGE_KEY, "pipelines.web.attention.v1");
});
test("encoding is one sorted JSON array and round-trips", () => {
const encoded = encodeAttentionDismissals(new Set(["9:Failed", "1:Decision", "4:Failed"]));
assert.deepEqual(JSON.parse(encoded), ["1:Decision", "4:Failed", "9:Failed"]);
const decoded = decodeAttentionDismissals(encoded);
assert.deepEqual([...decoded].sort(), ["1:Decision", "4:Failed", "9:Failed"]);
assert.deepEqual(JSON.parse(encodeAttentionDismissals(new Set())), []);
});
test("blank or unreadable storage decodes to empty and never throws", () => {
for (const stored of ["", " ", null, undefined, "not json", "{", '"a string"', "{}", "42"]) {
assert.deepEqual([...decodeAttentionDismissals(stored)], []);
}
});
test("a JSON array with non-string members keeps only the strings", () => {
const decoded = decodeAttentionDismissals('["1:Failed", 2, null, {"a":1}, "3:Decision", ""]');
assert.deepEqual([...decoded].sort(), ["1:Failed", "3:Decision"]);
});
test("there is no expiry: a stored identity survives any timestamp", () => {
// The encoding is opaque to time; decoding never consults a clock or drops by age.
const stored = encodeAttentionDismissals(new Set(["7:Decision"]));
assert.deepEqual([...decodeAttentionDismissals(stored)], ["7:Decision"]);
});
+220
View File
@@ -187,6 +187,14 @@ try {
browser = await launchChrome({ width: 1440, height: 900 });
page = await browser.openPage(`http://127.0.0.1:${port}/`);
// Deterministic dismissals: the attention set is read from localStorage once at
// boot, so clear the key and reload before connecting so the surface derives
// from an empty set regardless of any stale profile state.
step("clearing the attention storage key before connecting");
await page.evaluate(`localStorage.removeItem("pipelines.web.attention.v1")`);
await page.evaluate(`location.reload()`);
await page.waitForSelector("#url", { timeout: 15000 });
step("connecting the page to the server through its own proxy");
await page.fill("#url", `ws://127.0.0.1:${port}/connect`);
await page.click("#connectBtn");
@@ -455,6 +463,218 @@ try {
console.log(` usage: ${usageLabels.join(", ")}`);
console.log(` day headers: ${dayHeaders.slice(0, 3).join(" | ")}`);
// ---------------------------------------------------------------------
// R15: the attention / "Needs you" surface. The bell lives in the top bar on
// every view; its badge, the sheet's rows and the dismissal identities all
// come from the pure src/attention.js model. The live server currently has
// failed runs and no run parked in `waiting`, so the sheet is exercised with
// real failed entries and that live-data limitation is reported below. The
// decision path (open without dismissing) is unit-tested.
// ---------------------------------------------------------------------
step("checking the attention bell + badge");
await page.waitForSelector("#attentionBell", { timeout: 15000 });
const bell = await page.evaluate(`(() => {
const b = document.querySelector("#attentionBell");
const badge = b.querySelector(".attention-badge");
return {
label: b.getAttribute("aria-label"),
hasBadge: !!badge,
count: badge ? badge.textContent : null,
dataCount: badge ? badge.dataset.count : null,
};
})()`);
const attentionCount = Number(bell.dataCount ?? 0);
if (!(attentionCount > 0)) {
throw new Error(`no attention entries on the live server: ${JSON.stringify(bell)}`);
}
if (bell.label !== `Notifications, ${attentionCount} needing attention`) {
throw new Error(`the bell's accessible name is wrong: ${bell.label}`);
}
if (!bell.hasBadge || bell.count !== String(attentionCount)) {
throw new Error(`the badge is wrong: ${JSON.stringify(bell)}`);
}
if (await page.evaluate(`!!document.querySelector(".attention-sheet")`)) {
throw new Error("the sheet was already open before the bell was clicked");
}
console.log(` bell: aria-label="${bell.label}", badge=${bell.count}`);
shots.push(await page.screenshot(`${out}/35-attention-bell.png`));
step("opening the Needs you sheet");
await page.click("#attentionBell");
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
const sheet = await page.evaluate(`(() => {
const rows = [...document.querySelectorAll(".attention-sheet .attention-row")];
return {
title: document.querySelector(".attention-sheet-title")?.textContent ?? "",
clearAll: document.querySelector(".attention-clear")?.textContent ?? null,
empty: document.querySelector(".attention-empty")?.textContent ?? null,
focused: document.activeElement?.className ?? "",
rows: rows.map((row) => {
const open = row.querySelector(".attention-row-open");
const dismiss = row.querySelector(".attention-dismiss");
return {
runId: Number(open?.dataset.runId),
kind: open?.dataset.kind ?? "",
label: open?.querySelector(".attention-label")?.textContent ?? "",
desc: open?.querySelector(".attention-desc")?.textContent ?? "",
icon: open?.querySelector(".attention-icon")?.textContent ?? "",
dismissName: dismiss?.getAttribute("aria-label") ?? "",
};
}),
};
})()`);
if (sheet.title !== "Needs you") throw new Error(`the sheet title is wrong: ${sheet.title}`);
if (sheet.empty !== null) throw new Error(`a non-empty sheet showed the empty copy: ${sheet.empty}`);
if (sheet.clearAll !== "Clear all") throw new Error(`Clear all is missing: ${sheet.clearAll}`);
if (sheet.rows.length !== attentionCount) {
throw new Error(`the sheet drew ${sheet.rows.length} rows for a badge of ${attentionCount}`);
}
if (!sheet.focused.includes("attention-sheet-close")) {
throw new Error(`focus did not move into the sheet on open: ${sheet.focused}`);
}
const kindRanks = { decision: 0, failed: 1 };
let lastKindRank = -1;
for (const row of sheet.rows) {
if (!row.icon) throw new Error(`row ${row.runId} has no status icon`);
if (!row.label) throw new Error(`row ${row.runId} has no primary label`);
if (!row.desc.includes(" · ")) throw new Error(`row ${row.runId} description is wrong: ${row.desc}`);
if (row.dismissName !== "Dismiss") {
throw new Error(`row ${row.runId}'s trailing control is not named Dismiss: ${row.dismissName}`);
}
const rank = kindRanks[row.kind];
if (rank == null) throw new Error(`row ${row.runId} has an unknown kind ${row.kind}`);
if (rank < lastKindRank) throw new Error(`the rows are out of kind order at run ${row.runId}`);
lastKindRank = rank;
}
const firstRow = sheet.rows[0];
const kindName = (kind) => (kind === "decision" ? "Decision" : "Failed");
console.log(
` sheet: ${sheet.rows.length} row(s); first ${firstRow.runId} (${firstRow.kind}) ` +
`"${firstRow.label}" — ${firstRow.desc}`,
);
if (!sheet.rows.some((row) => row.kind === "decision")) {
console.log(
" -- no `waiting` run exists on the live server; the sheet used real failed runs " +
"and the decision path (open without dismissing) is covered by unit tests",
);
}
shots.push(await page.screenshot(`${out}/36-attention-sheet.png`));
step("dismissing one entry individually");
await page.evaluate(`document.querySelector(".attention-sheet .attention-row .attention-dismiss").click()`);
await eventually(
async () =>
(await page.evaluate(`document.querySelectorAll(".attention-sheet .attention-row").length`)) ===
attentionCount - 1,
{ what: "the individual dismissal to land" },
);
const afterDismiss = await page.evaluate(`(() => ({
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
badge: document.querySelector("#attentionBell .attention-badge")?.dataset.count ?? null,
stored: localStorage.getItem("pipelines.web.attention.v1"),
}))()`);
if (afterDismiss.rows !== attentionCount - 1) {
throw new Error(`the sheet still shows ${afterDismiss.rows} rows after one dismissal`);
}
if (Number(afterDismiss.badge) !== attentionCount - 1) {
throw new Error(`the badge did not follow the dismissal: ${afterDismiss.badge}`);
}
if (!String(afterDismiss.stored).includes(`${firstRow.runId}:${kindName(firstRow.kind)}`)) {
throw new Error(`the dismissed identity was not persisted: ${afterDismiss.stored}`);
}
console.log(
` dismissed ${firstRow.runId}:${kindName(firstRow.kind)}; rows ${attentionCount} -> ` +
`${afterDismiss.rows}, stored ${afterDismiss.stored}`,
);
shots.push(await page.screenshot(`${out}/37-attention-dismissed.png`));
step("opening a Failed row: it opens the run and persists its dismissal");
const rowToOpen = await page.evaluate(`(() => {
const open = document.querySelector(".attention-sheet .attention-row .attention-row-open");
return { runId: Number(open.dataset.runId), kind: open.dataset.kind };
})()`);
if (rowToOpen.kind !== "failed") {
throw new Error(`expected a Failed row to open, got ${rowToOpen.kind}`);
}
await page.evaluate(`document.querySelector(".attention-sheet .attention-row .attention-row-open").click()`);
await eventually(
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
{ what: "the sheet to close on row activation" },
);
await page.waitForSelector(".detail .detail-tabs", { timeout: 25000 });
const openedIdentity = await page.evaluate(
`document.querySelector(".run-identity")?.textContent ?? ""`,
);
if (!openedIdentity.startsWith(`run ${rowToOpen.runId} ·`)) {
throw new Error(`row ${rowToOpen.runId} did not open its run: ${openedIdentity}`);
}
const storedAfterOpen = await page.evaluate(`localStorage.getItem("pipelines.web.attention.v1")`);
if (!String(storedAfterOpen).includes(`${rowToOpen.runId}:Failed`)) {
throw new Error(`opening a Failed row did not persist its dismissal: ${storedAfterOpen}`);
}
console.log(` opened run ${rowToOpen.runId}; ${rowToOpen.runId}:Failed now persisted`);
step("reopening the sheet and clearing all");
await page.click("#attentionBell");
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
const beforeClear = await page.evaluate(
`document.querySelectorAll(".attention-sheet .attention-row").length`,
);
if (beforeClear !== attentionCount - 2) {
throw new Error(`expected ${attentionCount - 2} rows before Clear all, got ${beforeClear}`);
}
await page.evaluate(`document.querySelector(".attention-sheet .attention-clear").click()`);
await eventually(
async () =>
(await page.evaluate(`document.querySelector(".attention-empty")?.textContent ?? ""`)) ===
"Nothing needs you right now.",
{ what: "the empty attention state after Clear all" },
);
const cleared = await page.evaluate(`(() => ({
empty: document.querySelector(".attention-empty")?.textContent ?? "",
rows: document.querySelectorAll(".attention-sheet .attention-row").length,
clearAll: !!document.querySelector(".attention-clear"),
badge: !!document.querySelector("#attentionBell .attention-badge"),
label: document.querySelector("#attentionBell").getAttribute("aria-label"),
badges: document.querySelectorAll(".attention-badge").length,
}))()`);
if (cleared.empty !== "Nothing needs you right now.") {
throw new Error(`the empty copy is wrong: ${cleared.empty}`);
}
if (cleared.rows !== 0) throw new Error(`the cleared sheet still shows ${cleared.rows} rows`);
if (cleared.clearAll) throw new Error("Clear all is still offered on the empty sheet");
if (cleared.badge || cleared.badges !== 0) throw new Error("the badge is still visible after Clear all");
if (cleared.label !== "Notifications") {
throw new Error(`the emptied bell is named wrong: ${cleared.label}`);
}
console.log(` after Clear all: "${cleared.empty}", no Clear all, bell aria-label="${cleared.label}"`);
shots.push(await page.screenshot(`${out}/38-attention-cleared.png`));
step("closing the sheet with Escape returns focus to the bell");
await page.evaluate(
`document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`,
);
await eventually(
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
{ what: "Escape to close the attention sheet" },
);
const focusAfterEscape = await page.evaluate(`document.activeElement?.id ?? ""`);
if (focusAfterEscape !== "attentionBell") {
throw new Error(`Escape did not return focus to the bell: ${focusAfterEscape}`);
}
console.log(" Escape closed the sheet and focus returned to #attentionBell");
step("closing the sheet with a backdrop click");
await page.click("#attentionBell");
await page.waitForSelector(".attention-sheet", { timeout: 15000 });
await page.evaluate(`document.querySelector(".attention-sheet").click()`);
await eventually(
async () => !(await page.evaluate(`!!document.querySelector(".attention-sheet")`)),
{ what: "the backdrop click to close the attention sheet" },
);
console.log(" backdrop click closed the sheet");
step(`scrolling the list to the older day group (${fullDateHeader})`);
const scrolledTo = await page.evaluate(`(() => {
const scroll = document.querySelector(".run-scroll");